Lect 4
Lect 4
SYSTEM (O.S)
Lect-5
PROCESS MANAGEMENT
Total 24 slides
PROCESS
A process is a program in execution , in different O.s process may
called job or Activity
A process is a unit of work in some system
A program in execution is called Process
A process include:
Program counter (to indicate the current activity)
Stack (keep temporary data)
Data Section( global variable)
Total 24 slides
If you run same application program twice it means you create
two process
For Example
If you open two editor in two different windows each editor is a
separate process
A C.P.U may shared among many process
Active process May either be waiting to the C.P.U or executing on
it
A process which is waiting for the C.P.U is ready and a process
which has been allocated to the C.P.U is running
Total 24 slides
OPERATIONS ON THE PROCESS
1. Creation
Once the process is created, it will be ready and come into the ready queue (main
memory) and will be ready for the execution.
2. Scheduling
Out of the many processes present in the ready queue, the Operating system chooses one
process and start executing it. Selecting the process which is to be executed next, is
known as scheduling.
3. Execution
Once the process is scheduled for the execution, the processor starts executing it.
Process may come to the blocked or wait state during the execution then in that case the
processor starts executing the other processes.
4. Deletion/killing
Once the purpose of the process gets over then the OS will kill the process. The Context
of the process (PCB) will be deleted and the process gets terminated by
Totalthe Operating
24 slides
Process
States
PROCESS STATES
New Active Waiting Halt
As the process executes, it changed its states.
Each process may be in one of the following state:
Ready Running
Total 24 slides
PROCESS STATES
New: A process is being created
Active: Active process may either be waiting for the C.P.U or executing
on it
Ready: A process which is waiting for the C.P.U
Running: Instruction are being executed
Waiting: A process which is waiting for an event(e.g, I/O)
Halt: A process terminate when interrupt occurs.
Terminate: The process has finished execution.
New Active Halt
Terminated
Waiting Total 24 slides
DETAIL DIAGRAM
Total 24 slides
PROCESS CONTROL BLOCK(PCB)
While creating a process, the operating system performs several
operations. To identify the processes, it assigns a process identification
number (PID) to each process.
The process control block (PCB) is used to track the process’s execution
status.
Each block of memory contains information about the process state,
program counter, stack pointer, status of opened files etc.
All this information is required and must be saved when the process is
switched from one state to another.
Total 24 slides
PROCESS CONTROL BLOCK(PCB)
When the process makes a transition from one state to another,
the operating system must update information in the process’s
PCB.
A process control block (PCB) contains information about the
process, i.e. registers, quantum, priority, etc.
Each process is represented in the operating system by a
process control block (PCB) also called a task control block.
The information of the Process is used by the CPU at the Run
time.
There’s a data structure called the process control block (PCB)
that holds all this stuff.
The PCB serves as the repository for any information which can
vary from process to process.
Total 24 slides
PROCESS CONTROL BLOCK(PCB)
PCB CONTAINS MANY PIECES OF INFORMATION ASSOCIATED WITH
A SPECIFIC PROCESS WHICH ARE DESCRIBED BELOW.
The process scheduling is the activity of the process manager that handles the
removal of the running process from the CPU and the selection of another
process on the basis of a particular strategy.
When more than one process is runnable, the O.S must decide which one first to
run
The part of the O.S concerned with the decision is called the Scheduler and
algorithm it uses called Scheduling Algorithm.
Any recourses before utilization it must be schedule
Process scheduling is an essential part of a Multiprogramming operating system.
Such operating systems allow more than one process to be loaded into the
executable memory at a time and loaded process shares the CPU using time
multiplexing.
Total 24 slides
PROCESS SCHEDULING
Through Scheduling:
Response Time: Scheduler minimize the response time for users
Turn-around Time: Scheduler minimize the Turn-around time for
users
C.P.U Utilization: Scheduler maximize the C.P.U utilization
Throughput: Scheduler maximize the no. of jobs per unit time
Total 24 slides
CATEGORIES OF SCHEDULING
Total 24 slides
SCHEDULING QUES
Total 24 slides
Scheduling
Ques
TYPES OF SCHEDULING QUES
Job Que Ready Que Device Que
Shared
Dedicated Que
Que
Total 24 slides
TYPES OF SCHEDULING QUES
Job Que:
When the process enters into the system, then this process is put into a
job queue. This queue consists of all processes in the system.
Ready Que:
The process that are residing in main memory and wait for C.P.U are
kept in list called Ready Que
Ready Que are implemented by link list, FIFO Que, Priority Que, Tree,
Stack etc.
Device Que:
The process that are waiting for Device to become availaible or to
deliver data are placed in device Que
Total 24 slides
PROCESS SCHEDULING
Total 24 slides
LONG-TERM SCHEDULER/JOB SCHEDULER:
Total 24 slides
MEDIUM-TERM SCHEDULER/C.P.U
SCHEDULER:
Total 24 slides
CONTEXT SWITCH
The Context switching is a technique or method used by the operating
system to switch a process from one state to another to execute its
function using CPUs in the system.
When switching perform in the system, it stores the old running
process's status in the form of registers and assigns the CPU to a new
process to execute its tasks.
While a new process is running in the system, the previous process
must wait in a ready queue.
The execution of the old process starts at that point where another
process stopped it.
It defines the characteristics of a multitasking operating system in
which multiple processes shared the same CPU to perform multiple
tasks without the need for additional processors in the system.
Total 24 slides
NEED OF CONTEXT SWITCHING
Total 24 slides
The following steps are taken when switching Process P1 to Process 2:
First, thes context switching needs to save the state of process P1 in the form of the program
counter and the registers to the PCB (Program Counter Block), which is in the running state.
Now update PCB1 to process P1 and moves the process to the appropriate queue, such as the
ready queue, I/O queue and waiting queue.
After that, another process gets into the running state, or we can select a new process from
the ready state, which is to be executed, or the process has a high priority to execute its task.
Now, we have to update the PCB (Process Control Block) for the selected process P2. It
includes switching the process state from ready to running state or from another state like
blocked, exit, or suspend.
If the CPU already executes process P2, we need to get the status of process P2 to resume its
execution at the same time point where the system interrupt occurs.
Similarly, process P2 is switched off from the CPU so that the process P1 can resume execution.
P1 process is reloaded from PCB1 to the running state to resume its task at the same point.
Otherwise, the information is lost, and when the process is executed again, it starts execution at
the initial level.
Total 24 slides