1. Introduction

Disk scheduling is the process of arranging the order in which read/write operations are carried out on a computer’s hard disk. In modern computer systems, hard disks have a large storage capacity, and the data is stored in tracks and sectors.

The disk scheduling algorithms aim to optimize the use of the hard disk by reducing the seek time and rotational latency, which ultimately results in improved performance and efficiency of the system.

In this tutorial, we’ll discuss two disk scheduling algorithms – LOOK and CLOOK – and compare their performance and efficiency.

2. LOOK Algorithm

The LOOK algorithm is a disk scheduling algorithm that scans the disk from the current position of the disk arm to the last request in one direction and then moves back to the first request in the opposite direction.

The LOOK algorithm is designed to reduce the seek time by minimizing the distance the disk arm has to travel to service a request. The algorithm schedules the requests in such a way that the disk arm moves continuously in one direction without any backtracking, which indirectly improves performance by maximizing throughput and reducing the total time required to access and retrieve data from the disk.

2.1. Advantages and Disadvantages of LOOK Algorithm

The LOOK algorithm is a simple and efficient algorithm that can handle high loads of requests. It is also a fair algorithm that ensures that no request is starved, i.e., no request waits indefinitely for service.

However, the LOOK algorithm can cause disk arm thrashing, where the disk arm moves rapidly back and forth between the innermost and outermost tracks of the disk, resulting in increased access time and reduced performance.

2.2. Pseudocode of LOOK Algorithm

The pseudocode of the LOOK algorithm is as follows:

Rendered by QuickLaTeX.com

Let’s consider an example of a disk with 251 tracks and a queue of disk access requests in the following order: 240, 94, 179, 51, 118, 15, 137,29 75. The current position of the Read/Write head (C) is at track 55 and moving in the Right direction. The LOOK algorithm can be illustrated as shown in the below diagram:

LOOK_algorithm

The total head movement (THM) can be calculated as follows:

    \[ \text{$THM$} = (240-51) + (240-15) \]

    \[ \text{$THM$} = 189 + 225 \]

    \[ \text{$Total Head Movement$} = 414 \]

3. CLOOK Algorithm

The CLOOK algorithm (circular LOOK) is a disk scheduling algorithm similar to the LOOK algorithm but differs in how it handles the requests. The CLOOK algorithm scans the disk in one direction only, from the current position of the disk arm to the last request in that direction, and then starts again from the first request in that direction.

The CLOOK algorithm reduces the seek time and rotational latency by scheduling the requests in a circular manner, where the disk arm moves from the outermost track to the innermost track and then back to the outermost track.

3.1. Advantages and Disadvantages of CLOOK Algorithm

The CLOOK algorithm is a more efficient algorithm than the LOOK algorithm and outperforms all other disk scheduling algorithms. However, it is not a fair algorithm and can cause some requests to starve. This is because the algorithm only services requests in one direction, and any request in the opposite direction is ignored.

3.2. Pseudocode of CLOOK Algorithm

The pseudocode of the CLOOK algorithm is as follows:

Rendered by QuickLaTeX.com

Let’s illustrate the LOOK algorithm using the example we considered in subsection 2.2:

CLOOK_algorithm

The total head movement (THM) can be calculated as follows:

    \[ \text{$THM$} = (240-51) + (240-15) + (51-15) \]

    \[ \text{$THM$} = 189 + 225 + 36 \]

    \[ \text{$Total Head Movement$} = 450 \]

4. Comparison Between LOOK and CLOOK Algorithms

Rendered by QuickLaTeX.com

Overall, the LOOK algorithm is fairer to all requests, while the CLOOK algorithm is better suited for systems that require high performance.

5. Conclusion

In this article, we discussed two disk scheduling algorithms – LOOK and CLOOK, comparing their performance and efficiency.

Both algorithms have their strengths and weaknesses, and the best algorithm should be chosen based on the needs of the system. Hence, the choice between the LOOK and CLOOK algorithms depends on the specific requirements and constraints of the system.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.