Unit 4 OSY
Unit 4 OSY
P2 8
P3 7
P4 3
P1 24
P2 3
P3 3
• Waiting time and turnaround time of each process is shown in foll. Table
Process Waiting Time Turnaround Time
P1 16-10=6 ms 16-0=16 ms
P2 1-1=0 ms 2-1=1 ms
P3 16-2=14 ms 18-2=16 ms
P4 16-1=15 ms 19-3=16 ms
P5 5-5=0 ms 9-4=5 ms
CPU
Multilevel Queue Scheduling (MLQ) cont…
• Advantage : Low scheduling overhead
• Disadvantage:
1. It is inflexible (Jobs cannot switch from queue to
queue)
2. Starvation possible.
4.3 Deadlock
Introduction:
• In a multiprogramming environment, several processes
may compete for a finite number of resources.
• A process requests resources; if the resources are not
available at that time, the process enters a waiting state.
• Sometimes, a waiting process is never again able to
change state, because the resources it has requested are
held by other waiting processes. This situation is called a
deadlock.
System Model
• System consists of resources
• Examples of Resource Types
– CPU cycles, files, and I/O devices (such as printers and DVD
drives)
• Resource may have its ‘N’ number of instances
– If a system has 5 printers then resource type printer has five
instances
• Each process utilizes a resource as follows:
• Request : The process requests the resource.
• Use : The process can operate on the resource.
• Release: The process releases the resource.
Deadlock
• Definition: A deadlock consists of a set of blocked processes,
each holding a resource and waiting to acquire a resource held
by another process in the set.
2.
Questions
3.
4.