CAPE COMPUTER SCIENCE
Grade 11Teacher: Mrs. McCallum-Rodney
Operating System Function – PROCESS MANAGEMENT
Introduction to Process Management
• A process does nothing unless its instructions are executed by the CPU.
• A process can be thought of as a program in execution.
• A process needs certain resources, including CPU time, memory, files and I/O devices, to accomplish its tasks. These resources are either given to the process when it is created, or allocated to it while it is running.
• In addition to physical and logical resources that a process obtains when it is created, some initialization data (input) may be passed along. For example, a process whose function is to display the status of a file on the screen of a terminal, will be given as an input the name of the file, and will execute the appropriate instructions and system calls to obtain the desired information and display it on the terminal.
• When the process terminates, the operating system will reclaim any reusable resources.
• A program by itself is not a process; a program is a passive entity, such as the contents of a file stored on a disk. A process is an active entity, with a program counter specifying the next instruction to be executed.
• The execution of a process must be executed sequentially.
• The CPU executes one instruction of the process after another, until the process is complete. At most one instruction is executed on behalf of the process. Therefore, although two processes may be associated with the same program, they are nevertheless considered two separate execution sequences. It is common to have a program that spawns many processes as it runs.
Note: A process is the unit of work in a system.
• Such a system consists of a collection of processes, some of which are operating-system processes (those that execute system codes) and the rest of which are user processes (those that execute user code).
• All these processes can potentially execute concurrently, by multiplexing the CPU among them.
Operating System responsibilities in relation to Process Management
➢ The creation and deletion of both user and system processes
➢ The suspension and resumption of processes
➢ The provision of mechanisms for process synchronization
➢ The provision of mechanisms for process communication
➢ The provision of mechanisms for deadlock handling (deadlock is a situation in which each process in a set of processes is waiting for an event that only another process in the set can cause. since all the process are waiting, the system enters a deadlocked condition)
✓ As a process execute, it changes state.
✓ The state of a process is defined in part by the current activity of that process.
✓ Each process may be in one of the following states:
o New The process is being created
o RunningInstructions are being executed
o Blocked/WaitingThe process is waiting for some event to occur (such as an I/O
completion or reception of a signal)
o Ready The process is waiting to be assigned to a processor
o TerminatedThe process has finished execution
✓ It is important to realise that only one process can be running on any processor at any instant. Many processes can be ready and waiting.
✓ Consider the following state diagram:
Process Control Block
Each process is represented in the operating system by a process control block (PCB) – also called a task control block. The PCB simply serves as the repository for any information that may vary from process to process. It contains many pieces of information associated with a specific process, including:
• Process state
The state may be new, ready, running, waiting, halted, and so on.
• Program Counter
The counter indicates the...