Process State

Download Report

Transcript Process State

OUTLINE
What is the Process Management?
What is it covers?
 process state
 process table,
 process scheduling
Process State
Process Table(process control block)
process state
memory state
resource state
Process Scheduling
What is Multiprogramming
Process
Conclusion ;
Process Management
What is Process
Management?
Ever action run inside a process.
In computer science, a process is
an application in execution.
What is Process Management?
Operating system's way of dealing
with running multiple processes.
Computing and distributing
"timeshares".
Process State
When a process is using the
CPU, it is actually running and
doing some work .
If a process does I/O ,the device
is not ready or just slow
The process states and transitions are;
Process table
The suspended process to be restarted at a
later time as if it had never been stopped
The O/S maintains information about each
process in a process table
Process table
Process control blocks must contain
information about
process state
memory state
resource state
Process State
The process state must contain all
the information
the value of each register
the program counter
the stack pointer
The process is in
runnning,
runnable,
blocked
Memory state
Details of the memory allocation such
as pointers to the various memory areas
used by the program
Resource state
Information regarding the status of
files being used by the process such
as user ID
MULTIPROGRAMMING
Process Scheduling
Processes are put into a job queue
They are kept in a list called ready
queue
The ready queue is generally stored as a
link list
Process waiting for a particular device
are placed in a I/O queue
Process Queues
cpu
ready queue
i/o
join
I/O queue
child
executes
wait queue
resource queue
I/O request
time slice
expires
fork a
child
resource
request
17
Multiprogramming Process
SCHEDULERS:
Two types of scheduler:
–Long-term schedulers (Job scheduler)
–Short-term scheduler (CPU scheduler)
Multiprogramming Process
The short-term scheduler:
selects from among the processes that are
ready to execute and allocates the CPU to
one of them
must select a new process for the CPU
frequently
must be very fast.
Multiprogramming Process
The long-term scheduler :
selects processes from a batch system
and loads them into memory for
execution
executes less frequently
SCHEDULERS
Newly arriving
jobs
Ready
Queue
Long-term
Scheduler
Running
Blocked
Short-term
Scheduler
21
Medium-term Scheduling
Partially-executed
swapped-out processes
Ready Queue
I/O
CPU
end
I/O waiting
queues
22
The CPU Scheduler
CPU scheduling decisions take place when a
process:
(i)
switches from running to waiting state
(ii) switches from running to ready state
(iii) switches from waiting to ready
(iv) terminates.
23
Scheduling Criteria
CPU utilization
Throughput
Turnaround time
Waiting time
Response time
Fairness
24
Scheduling Policies
Preemptive Scheduling:
A process switched back and forth
between running and ready state
More efficient , better capabilities
More complex and needs hardware
support
25
Scheduling Policies
Non-Preemptive Scheduling:
Once a process begins execution, it
occupies CPU until it finishes or it
blocks
Simplicity
Creates problems
26
SCHEDULING ALGORITHMS
First-Come-First-Served or
FIFO Scheduling
Shortest-Job-first Scheduling
Priority Scheduling
Round-Robin Scheduling
27
FCFS Scheduling
First process will be served by CPU
Non-preemptive
Waiting time is quite long
Example
28
FCFS Scheduling
Process
P1
P2
P3
CPU Burst Time (ms)
24
3
3
P1
0
P2
24
P3
27
30
Waiting time for P1 = 0; P2 = 24; P3 = 27
Ave. waiting time: (0 + 24 + 27) /3 = 17 ms.
29
FCFS Scheduling
P2
0
P1
P3
3
6
30
Waiting time for P1 = 6; P2 = 0; P3 = 3
Ave. waiting time : (6 + 0 + 3)/3 = 3
Much better than the previous case, where we
had a
Convoy Effect: short process behind long
process. Results in lower CPU utilization
30
Shortest-Job-First Scheduling
Selects the shortest job first
Enqueue jobs in order of estimated
completion time
It is non-preemptive
31
Priority Scheduling
Assign a priority to each job and schedule jobs in
order of priority
Typically low priority values = “High Priority”
Increasing priority means decrease its priority
value
It can be both preemptive or non-preemptive
Equal priority processes are scheduled in FCFS
order
32
Round-Robin Scheduling
Designed for time-sharing systems
Preemptive
Each process gets a small unit of CPU
time usually 10-100 milliseconds
After that time the process preempted
and added to the end of the ready queue
33
RESOURCES
http://computingdictionary.thefreedictionary.com/process+table
http://en.wikipedia.org/wiki/Process_management
http://jan.netcomp.monash.edu.au/OS/l8_2.html
http://www.cs.jhu.edu/~yairamir/cs418/os2/sld007.ht
m
http://www.bilgiyonetimi.org/cm/pages/mkl_gos.php?
nt=131
http://gaia.ecs.csus.edu/~zhangd/oscal/pschedul
ing.html