When a computer performs input/output operations with its disk drive, it needs to efficiently manage the order of accessing the disk sectors. This is where disk scheduling comes into play. Disk scheduling is a process that orders the requests for disk access in an efficient way to minimize the time it takes for the computer to perform the input/output operation. In this article, we will dive deep into the C-SCAN disk scheduling algorithm and explain how it works with an example.
What is Disk Scheduling?
Disk scheduling is the process of selecting the next disk sector to read or write data. The disk scheduling algorithm is responsible for determining the order in which the requests for disk access should be served. There are several disk scheduling algorithms, each with its own advantages and disadvantages.
Types of Disk Scheduling Algorithms
- First-Come, First-Served (FCFS)
- Shortest Seek Time First (SSTF)
- SCAN
- C-SCAN
C-SCAN Disk Scheduling Algorithm
C-SCAN is a variation of the SCAN disk scheduling algorithm. It is an improvement over the traditional SCAN algorithm because it reduces the average response time by ensuring that the head always moves in the same direction.
How C-SCAN Works
In C-SCAN, the disk arm starts at the first sector of the disk and moves towards the last sector, servicing all the requests along the way. When the last sector is reached, the disk arm jumps to the first sector of the disk without servicing any requests in between. This is called a “circular” movement.
Example
Let’s take an example to understand how C-SCAN works. Suppose we have a disk with 200 sectors numbered from 0 to 199. The requests for disk access are as follows:
98, 183, 37, 122, 14, 124, 65, 67
We assume that the disk arm is initially positioned at sector 53.
The C-SCAN algorithm works as follows:
- The disk arm moves towards sector 199, servicing the requests on its way. It services requests 98, 122, 124, 183, and 199 in this order.
- When the disk arm reaches sector 199, it jumps to sector 0 without servicing any requests in between.
- The disk arm moves towards sector 53, servicing the requests on its way. It services requests 37 and 14 in this order.
- The disk arm jumps to sector 199 again.
- The disk arm moves towards sector 53, servicing the requests on its way. It services requests 65 and 67 in this order.
- The disk arm reaches sector 53, and all the requests have been serviced.
OS-2022
Q-1.
(a) Write are the functions of operating systems? write a note on multi programmed operating systems ?
(b) Distinguish between client server and peer to peer model of distributed systems .
Q-2.
(b) What is meant by Storage Structure? Discuss Storage Hierarchy.
Q-3.
(a) What are the criteria for evaluating the CPU scheduling algorithms? Why do we need it?
Q-4.
(a) What is synchronization? Explain how semaphores can be used to deal with n-process critical problem.
Q-5.
Q-6.
(b) What are the disadvantages of single contiguous memory allocation? Explain.
Q-7.
(a) Briefly explain about single-level, two-level and three Structured directories.
(b) What is disk scheduling? Explain the C-SCAN scheduling by giving an example.
Q-8.
(b) UNIX file system.