Professional Documents
Culture Documents
Unit3_OS
Unit3_OS
Greater Noida
Operating System
ACSE0403A
Unit: 3
Course outcome: After completion of this course students will be able to:
CO5 Understand and analyze the I/O management and File systems K2, K4
ACSE0403A .1 3 3 2 2 1 2 - 2 3 2 2 3
ACSE0403A .2 3 3 3 2 2 3 - 2 3 1 1 3
ACSE0403A .3 3 3 2 2 2 2 - 2 2 3 1 3
ACSE0403A .4 3 2 2 3 1 2 - 1 2 1 2 3
ACSE0403A .5 3 1 2 2 2 2 - 1 2 2 2 3
Average 3 2.4 2.2 2.2 1.6 2.2 - 1.8 2.2 1.8 1.6 3
ACSE0403A .1 2 1 2 2
ACSE0403A .2 2 2 1 2
ACSE0403A .3 2 3 3 2
ACSE0403A .4 2 2 1 2
ACSE0403A .5 2 2 2 2
Average 2 2 1.8 2
• Deadlock
• Deadlock characterization
• Deadlock Prevention
• Deadlock Avoidance
• Recovery from Deadlock
• Principle of Concurrency
• Process Synchronization & it’s Problems
• Mutual Exclusion
• Process
• Pi requests instance of Rj Pi
• Pi is holding an instance of Rj
• Shared entities (read only files) don't need mutual exclusion (and
aren’t susceptible to deadlock.)
Assignment
edge Request
edge
Claim Claim
edge edge
Assignment
edge Request
edge
Assignment
Claim edge
edge
•Multiple instances
•Each process must a priori claim maximum use
•When a process requests a resource it may have to
wait
•When a process gets all its resources it must return
them in a finite amount of time
4.If Finish [i] == true for all i, then the system is in a safe
state
8 June 2023 Surbhi Jha ACSE0403A OS Unit-3 53
Resource-Request Algorithm for Process Pi(CO3)
Requesti = request vector for process Pi. If Requesti [j] = k then
process Pi wants k instances of resource type Rj
Need
ABC
P0 743
P1 122
P2 600
P3 011
P4 431
• The system is in a safe state since the sequence < P1, P3, P4, P2,
P0> satisfies safety criteria
• Executing safety algorithm shows that sequence < P1, P3, P4, P0,
P2> satisfies safety requirement
– Information sharing
– Computation speed-up
– Modularity
– Convenience
Consumer code
while (true) {
while (counter == 0)
; /* do nothing */
next_consumed = buffer[out];
out = (out + 1) % BUFFER_SIZE;
counter--;
/* consume the item in next consumed */
}
do {
while (turn == j);
critical section
turn = j;
remainder section
} while (true);
• Boolean flag[2]
• The variable turn indicates whose turn it is to enter the critical
section
synchronization schemes
• Bounded-Buffer Problem
• Dining-Philosophers Problem
do {
wait(full); wait(mutex);
...
/* remove an item from buffer to next_consumed */
...
signal(mutex); signal(empty);
...
/* consume the item in next consumed */
...
}while(true);
• Shared data
// think
} while (TRUE);
What is the problem with this algorithm?
• Deadlock handling
A. dynamic condition
B. race condition
C. essential condition
D. critical condition
A. mutex locks
B. binary semaphores
C. both mutex locks and binary semaphores
D. none of the mentioned
A. data consistency
B. data insecurity
C. data inconsistency
D. none of the mentioned
• https://www.youtube.com/watch?v=_zOTMOubT1M
• https://www.youtube.com/playlist?list=PLmXKhU9FNesSF
vj6gASuWmQd23Ul5omtD
• https://www.youtube.com/watch?v=x_UpLHXF9dU
• https://www.youtube.com/watch?v=cviEfwtdcEE
• https://nptel.ac.in/courses/106108101
https://drive.google.com/drive/folders/1UPXvZ7NY09OunSLrEkTFWpw_M3
xLzjhs?usp=sharing
A. Readers
B. Writers
C. readers and writers
D. none of the mentioned