• A network that’s congested (or filled large % of its I/O buffer space) can become deadlocked if it doesn’t have protocols to control flow of messages through network.
O.S Instructor
Friday, February 5, 2010
Case 6 : Deadlocks in Disk Sharing
Case 6 : Deadlocks in Disk Sharing
Case 5 : Deadlocks in Spooling
Case 5 : Deadlocks in Spooling
Case 4 : Deadlocks in Multiple Device Allocation
Device Allocation
Case 3: Deadlocks in Dedicated Device Allocation
Case 3: Deadlocks in Dedicated Device Allocation
• Deadlock can occur when there is a limited number of dedicated devices.
• E.g., printers, plotters or tape drives.
1. P1 requests tape drive 1 and gets it.
2. P2 requests tape drive 2 and gets it.
3. P1 requests tape drive 2 but is blocked.
4. P2 requests tape drive 1 but is blocked.
Case 2 : Deadlocks in Databases
Case 2 : Deadlocks in Databases
• Deadlock can occur if 2 processes access & lock records in database.
• 3 different levels of locking :
– entire database for duration of request
– a subsection of the database
– individual record until process is completed.
• If don’t use locks, can lead to a race condition.
Example:
1. P1 accesses R1 and locks it.
2. P2 accesses R2 and locks it.
3. P1 requests R2, which is locked by P2.
4. P2 requests R1, which is locked by P1.
Case 1 : Deadlocks on File Requests
Case 1 : Deadlocks on File Requests
• If jobs can request and hold files for duration of their execution, deadlock can occur.
• Any other programs that require F1 or F2 are put on hold as long as this situation continues.
• Deadlock remains until a programs is withdrawn or forcibly removed and its file is released.
Example:
Friday, January 15, 2010
Process Scheduling Algorithm
a. FCFS
Job A | Job B | Job C | Job D | Job E | Job F | Job G | Job H | Job I | Job J | Job K |
0-5 | 7 | 15 | 19 | 22 | 23 | 25 | 34 | 41 | 44 | 4 |
ATT = 5+7+15+19+22+23+25+34+41+44+48 = 25.73
11
b. SJN
Job F | Job B | Job G | Job E | Job J | Job D | Job K | Job A | Job I | Job C | Job H |
0-1 | 3 | 5 | 8 | 11 | 15 | 19 | 24 | 31 | 39 | 48 |
ATT = 1+3+5+8+11+15+19+24+31+39+48 = 18.55
11
c. SRT
d. Round-Robin
Job A | Job B | Job C | Job D | Job E | Job F | Job G | Job H | Job I | Job J | Job K | Job A | Job C | Job D | Job E | Job H | Job I |
0-2 | 4 | 6 | 8 | 10 | 11 | 13 | 15 | 17 | 19 | 21 | 23 | 25 | 27 | 28 | 30 | 32 |
Job J | Job K | Job A | Job C | Job H | Job I | Job C | Job H | Job I | Job H |
33 | 35 | 36 | 38 | 40 | 42 | 44 | 46 | 47 | 48 |
ATT = 36+3+42+24+24+6+7+41+39+24+25 = 24.64
11
Saturday, January 9, 2010
no. 3
page size divided by the line number to be located
200/542=2(quotient)
142(remainder)
the quotient (2) is the page number, and the remainder (142) is the displacement. So the line is located on Page 2, 143 lines (Line 142) from the top of the page.
Friday, January 8, 2010
II. Memory Utilization Problem
1. Give the Following Information:
Table A1
Job List
Job Number | Memory Requested |
J1 | 700K |
J2 | 500K |
J3 | 740K |
J4 | 850K |
J5 | 610K |
A. Best – Fit Algorithm
Memory Block | Memory Block Size | Job | Job Size | Internal Fragmentation |
1132 | 700KB | J1 | 700KB | 0 |
1003 | 720 KB | J5 | 610KB | 110KB |
1114 | 800 KB | J3 | 740KB | 60KB |
2310 | 750KB | |||
1755 | 610KB | J2 | 500KB | 110K |
B. First – Fit Algorithm
Memory Block | Memory Block Size | Job | Job Size | Internal Fragmentation |
1132 | 700KB | J1 | 700KB | 0KB |
1003 | 720 KB | J2 | 500KB | 220KB |
1114 | 800 KB | J3 | 740KB | 60KB |
2310 | 750KB | J5 | 610KB | 140K |
1755 | 610KB |
C. Next – Fit Algorithm
Memory Block | Memory Block Size | Job | Job Size | Internal Fragmentation |
1132 | 700KB | |||
1003 | 720 KB | J5 | 610KB | 140KB |
1114 | 800 KB | J3 | 740KB | 60KB |
2310 | 750KB | J1 | 700KB | 50KB |
1755 | 610KB | J2 | 500KB | 110KB |
D. Worst – Fit Algorithm
Memory Block | Memory Block Size | Job | Job Size | Internal Fragmentation |
1132 | 700KB | |||
1003 | 720 KB | J1 | 700KB | 200KB |
1114 | 800 KB | J2 | 500KB | 300KB |
2310 | 750KB | J5 | 610KB | 140KB |
1755 | 610KB |