2079 3

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]

Operating SystemsChapter 6: Device ManagementDisk SchedulingNumerical: disk scheduling algorithmsVideo solution

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

StepPosClosestDist
1958213
2824339
3432419
424168
516140124
614017030
717019020

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$

FromToDist
9514045
14017030
17019020
19020010
2000200
01616
16248
244319
438239

$$45+30+20+10+200+16+8+19+39 = \boxed{387}$$


Summary

AlgorithmTotal Seek (cylinders)
FCFS623
SSTF253
SCAN289
C-SCAN387

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.