CSC264 ยท 2079 ยท 10 marks
Define shell and system call. Suppose a disk has 201 cylinders, numbered from 0 to 200. At same time the disk arm is at cylinder 95, and there is a queue of disk access requests for cylinders 82,170,43,140,24,16 and 190. Calculate the seek time for the disk scheduling algorithm FCFS,SSTF,SCAN and C-
Define shell and system call. Suppose a disk has 201 cylinders, numbered from 0 to 200. At same time the disk arm is at cylinder 95, and there is a queue of disk access requests for cylinders 82,170,43,140,24,16 and 190. Calculate the seek time for the disk scheduling algorithm FCFS,SSTF,SCAN and C-SCAN.[10]
Shell, System Call, and Disk Scheduling
Part 1: Definitions
Shell
A shell is a command interpreter that provides the interface between the user and the operating system kernel. It accepts user commands, interprets them, and hands them to the OS for execution. It also lets users run programs, manage files, and control processes. Examples: Bash, sh, csh, zsh.
System Call
A system call is the programmatic interface through which a user process requests a service from the OS kernel. It transfers control from user mode to kernel mode for privileged operations. Examples: fork(), exec(), read(), write(), open().
Part 2: Disk Scheduling
Given data:
- Cylinders: 201 (numbered 0 to 200)
- Head start: 95
- Queue (arrival order): 82, 170, 43, 140, 24, 16, 190
1. FCFS
Order: $95 \to 82 \to 170 \to 43 \to 140 \to 24 \to 16 \to 190$
$$|95-82|+|82-170|+|170-43|+|43-140|+|140-24|+|24-16|+|16-190|$$ $$= 13+88+127+97+116+8+174 = \boxed{623}$$
2. SSTF
| Step | Pos | Closest | Dist |
|---|---|---|---|
| 1 | 95 | 82 | 13 |
| 2 | 82 | 43 | 39 |
| 3 | 43 | 24 | 19 |
| 4 | 24 | 16 | 8 |
| 5 | 16 | 140 | 124 |
| 6 | 140 | 170 | 30 |
| 7 | 170 | 190 | 20 |
Order: $95 \to 82 \to 43 \to 24 \to 16 \to 140 \to 170 \to 190$
$$13+39+19+8+124+30+20 = \boxed{253}$$
3. SCAN (moving up toward 200)
Sorted: $16, 24, 43, 82, [95], 140, 170, 190$
Order: $95 \to 140 \to 170 \to 190 \to 200 \to 82 \to 43 \to 24 \to 16$
$$45+30+20+10+118+39+19+8 = \boxed{289}$$
Total = $(200-95) + (200-16) = 105 + 184 = 289$ โ
4. C-SCAN (moving up toward 200, then wrap to 0)
Order: $95 \to 140 \to 170 \to 190 \to 200 \to 0 \to 16 \to 24 \to 43 \to 82$
| From | To | Dist |
|---|---|---|
| 95 | 140 | 45 |
| 140 | 170 | 30 |
| 170 | 190 | 20 |
| 190 | 200 | 10 |
| 200 | 0 | 200 |
| 0 | 16 | 16 |
| 16 | 24 | 8 |
| 24 | 43 | 19 |
| 43 | 82 | 39 |
$$45+30+20+10+200+16+8+19+39 = \boxed{387}$$
Summary
| Algorithm | Total Seek (cylinders) |
|---|---|
| FCFS | 623 |
| SSTF | 253 |
| SCAN | 289 |
| C-SCAN | 387 |
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.