Assuming a disk has 200 cylinders, numbered 0--199 and has just finished No. 130 cylinder service request. The read-write head is located at the No. 143 cylinder now. Assuming the request sequence is as below: 55, 718, 39, 18, 90, 160, 150, 38, 184, please give the disk scheduling sequences and average seek lengths of first come first served (FCFS), shortest seek time first (SSTF) and scan (SCAN) algorithm.
时间: 2023-07-14 08:14:05 浏览: 90
Here are the disk scheduling sequences and average seek lengths for FCFS, SSTF, and SCAN algorithms:
1. FCFS (First Come First Served):
- Sequence: 130, 55, 718, 39, 18, 90, 160, 150, 38, 184
- Seek lengths:
- 75 (130-55)
- 663 (718-55)
- 679 (718-39)
- 721 (718-18)
- 53 (90-18)
- 70 (160-90)
- 10 (160-150)
- 105 (184-79)
- 146 (199-53)
- Average seek length: (75+663+679+721+53+70+10+105+146)/9 = 348.22
2. SSTF (Shortest Seek Time First):
- Sequence: 130, 150, 160, 184, 55, 38, 39, 18, 90, 718
- Seek lengths:
- 20 (150-130)
- 10 (160-150)
- 24 (184-160)
- 75 (55-18)
- 17 (90-73)
- 17 (55-38)
- 1 (39-38)
- 21 (90-69)
- 628 (718-90)
- Average seek length: (20+10+24+75+17+17+1+21+628)/9 = 113.44
3. SCAN (Elevator):
- Sequence: 130, 150, 160, 184, 199, 55, 39, 38, 18, 90, 718
- Seek lengths:
- 20 (150-130)
- 10 (160-150)
- 24 (184-160)
- 15 (199-184)
- 144 (199-55)
- 16 (55-39)
- 1 (39-38)
- 20 (90-70)
- 628 (718-90)
- Average seek length: (20+10+24+15+144+16+1+20+628)/9 = 132.22
Therefore, the shortest seek time first (SSTF) algorithm has the lowest average seek length of 113.44.
阅读全文