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

  1. First-Come, First-Served (FCFS)
  2. Shortest Seek Time First (SSTF)
  3. SCAN
  4. 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
C-SCAN disk scheduling diagram by learn loner

We assume that the disk arm is initially positioned at sector 53.

The C-SCAN algorithm works as follows:

  1. 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.
  2. When the disk arm reaches sector 199, it jumps to sector 0 without servicing any requests in between.
  3. The disk arm moves towards sector 53, servicing the requests on its way. It services requests 37 and 14 in this order.
  4. The disk arm jumps to sector 199 again.
  5. The disk arm moves towards sector 53, servicing the requests on its way. It services requests 65 and 67 in this order.
  6. 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.

(a) With a Neat Sketch, Describe the services that an Operating System provides to users, processes and other systems.

(b) What is meant by Storage Structure? Discuss Storage Hierarchy.

(c) Write the Advantages and Disadvantages of using the same system call interface for manipulating both Files and Devices.

Q-3.

(a) What are the criteria for evaluating the CPU scheduling algorithms? Why do we need it?

(b) Define process. Explain various steps involved in change of a process state with process state neat transition diagram.

Q-4.

(a) What is synchronization? Explain how semaphores can be used to deal with n-process critical problem.

(b) Define a thread. Give the benefits of multithreading. What resources are used when a thread is created?

Q-5.

(a) How dose deadlock avoidance differ from deadlock prevention? Write about deadlock avoidance algorithm in detail.

(b) Different between external fragmentation and internal fragmentation. How to solve the fragmentation using paging?

Q-6.

(a) What is the purpose of paging the page table? Consider the following page reference string 1,2,3,4,5,1,2,3,4,5 for a memory with three frames. How many page faults would LRU and FIFO replacement algorithm?

(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.

(a) Interrupt and spooling.

(b) UNIX file system.

(c) Program and system threats.