Process Management PPT For Operating Systems
Process Management PPT For Operating Systems
Implementing Processes
Process States and State Transitions
Process Context and the Process Control Block
Context Save, Scheduling and Dispatching
Event Handling
Sharing, Communication and Synchronization between Processes
Signals
Threads
POSIX Threads
Kernel-Level, User-Level and Hybrid Threads
Overview
What is a Process?
Child Processes
The kernel initiates an execution of a program by creating a process for it. For lack of
a technical term for this process, we will call it the primary process for the program
execution.
The primary process may make system calls ,fork( ) or vfork( ), to create other
processes.
These processes become its child processes, and the primary process becomes their parent.
????
Child Processes
Continue
Typically, a process creates one or more child processes and delegates some of
its work to each of them. It is called multitasking within an application.
It has three benefits summarized in the given table.
IMPLEMENTING PROCESSES
Accordingly, the kernel allocates resources to a process, protects the process and
its resources from interference by other processes, and ensures that the process
gets to use the CPU until it completes its operation.
Implementing Processes
An Operating system uses the notion of a process state to keep track of what a
process is doing at any moment. i.e. it describes the nature of current activity at
any moment.
The kernel uses process states to simplify its own functioning, so the number of
process states and their name many vary across Oss.
The Four fundament states of a process
Implementing Processes
Continue
A state transition for a process P is a change in its state. A state transition is caused
by the occurrence of some event such as the start or end of an I/O operation. When
the event occurs, the kernel determines its inuence on activities in processes, and
accordingly changes the state of an affected process.
The figure diagrams the fundamental state transitions for a process. A new process
is put in the ready state after resources required by it have been allocated. It may
enter the running, blocked, and ready states a number of times as a result of
events.
Implementing Processes
Continue
Implementing Processes
Continue
Implementing Processes
Exercise!!
Consider the time-sharing system, which uses a time slice of 10ms. It contains two
processes P1 and P2. P1 has a CPU burst of 15ms followed by an I/O operation that
lasts for 100ms, while P2 has a CPU burst of 30ms followed by an I/O operation that
lasts for 60ms. Execution of P2 and P1 is described in Figure. Draw a table for
process state transitions for P1 &P2.
Implementing Processes
Solution!!
Solution
Question
Implementing Processes
Suspended Processes
A kernel needs additional states to describe the nature of the activity of a process
that is not in one of the four fundamental states described earlier. Consider a
process that was in the ready or the blocked state when it got swapped out of
memory.
Implementing Processes
Implementing Processes
Implementing Processes
The process control block (PCB) of a process contains three kinds of information
concerning the process:
Identification information such as the process id, id of its parent process,
and id of the user who created it.
Process state information such as its state, and the contents of the PSW
and the general-purpose registers (GPRs).
Information that is useful in controlling its operation, such as its priority,
and its interaction with other processes.
It also contains a pointer field that is used by the kernel to form
PCB lists for scheduling, e.g., a list of ready processes.
The priority and state information is used by the scheduler. It passes the id of the
selected process to the dispatcher.
For a process that is not in the running state, the PSW and GPRs fields together
contain the CPU state of the process when it last got blocked or was preempted.
Implementing Processes
Implementing Processes
The scheduling function uses the process state information from PCBs to select a
ready process for execution and passes its id to the dispatching function.
The dispatching function sets up the context of the selected process, changes its
state to running, and loads the saved CPU state from its PCB into the CPU.
Ex:
An OS contains two processes P1 and P2, with P2 having a higher priority than P1. Let P2
be blocked on an I/O operation and let P1 be running. The actions taken place when the
I/O completion event occurs for the I/O operation of P2.
?
?
?
?
?