Five Major Activities of an Operating System With Respect to Process Management
There are five major activities that an operating system must maintain in order to manage the processes that it is running. Without these five activities, an operating system would not be able to remain stable for any length of time.
When you first turn on your computer, the operating system opens processes to run services for everything from the print spooler to computer security. When you log in to the computer and start programs, the programs create dependent processes. A process is not the program itself, but rather the instructions that the CPU uses to execute the program. A process either belongs to Windows or to some other program that you have installed.
The state of a process may be "created," "running," "waiting," or "blocked." You can say that a process is "waiting" the moment after you start its parent program, and before it has been processed by the CPU. A process is "running" when the CPU is processing it. You can consider a process "blocked" if the computer does not have enough memory to process it or if files associated with the process cannot be located. All operating systems have some sort of process handling system, though they have different names for each state.
Once processes are running, the operating system needs a way to ensure that no two processes access the same resources at the same time. Specifically, no two processes can attempt to execute the same area of code at once. If two processes did attempt to execute this code at the same time, a crash could occur as they attempt to call the same files and send the same instructions to the CPU at the same time. If two processes need to run the same code, one must wait for the other to finish before proceeding.
The computer must ensure that processes can communicate with the CPU and with each other. For example, a program can have many processes, and each process can have a different permission level. A permission level is simply an indication of the level of access a process should have to the system. Process communication ensures that the computer can determine the permissions of each process. This is very important in preventing malware from deleting system files or adding instructions to the operating system itself.
Finally, the computer must have a way to ensure that processes do not become deadlocked. Deadlock occurs when two processes each require a resource that the other is currently using, and so neither process can finish what it is doing. The resources cannot be released, and programs lock up. You can also refer to this situation as a "circular wait." Operating systems prevent deadlock in different ways, but the most common method is to force a process to declare the resources it will need before it can start up. Alternatively, a process may be forced to request resources in blocks, and then release the resources as it finishes with them.