Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
1.1.
What is an Algorithm?
2.
LOOK Algorithm
3.
C-LOOK Algorithm
4.
Difference between Look and C-Look Disk Scheduling Algorithm
5.
Frequently Asked Questions
5.1.
What is the use of the Disk Scheduling Algorithm?
5.2.
How does C-look function?
5.3.
Which disc scheduling algorithm is the best?
5.4.
Which disc scheduling algorithm has a problem with starvation?
5.5.
What are the various types of disc scheduling?
6.
Conclusion
Last Updated: Mar 27, 2024

Difference Between Look and C-Look Disk Scheduling Algorithm

Operating Systems

Introduction

To come to the difference between Look and C-look Disk Scheduling Algorithm, we must first know Disk Scheduling. Disk Scheduling is the process that enables the I/O request in the Operating System to access the disk. This Algorithm manages those requests and determines the order of disk access granted to requests. The algorithms used for disk editing are called disk editing algorithms, and the purpose of disk algorithms is to reduce the total search time. Look and C-look Disk Scheduling Algorithm are their various types which will be discussed further.

What is an Algorithm?

In computer programming terms, an algorithm is a set of well-defined instructions for solving various problems. It gives the output you want according to the input you've entered. One typical example of an algorithm is a recipe, which contains specific instructions for preparing a meal that has to be followed one by one. Similarly, the example of adding two numbers is given below-

1-Take the inputs of two numbers

2- add those numbers using the "+" operator

3- Display the result 

 

Computer code is algorithmic. The Internet runs using these algorithms, and all online searches are done using these algorithms. In short, we can also say that algorithms are used for computations, data processing, and reasoning. 

So now we know about Algorithms let’s now discuss the different types of Disk Algorithms, as shown below-

Disk Scheduling Algorithm

In this article, we’ll be discussing the difference between the Look and C-Look Disk Scheduling Algorithms: 

Let us first look at the Look Algorithm: 

Also read, Multiprogramming vs Multitasking And Open Source Operating System

LOOK Algorithm

LOOK Algorithm is an advanced version of the SCAN Algorithm.

The head starts from the first application on one side of the disk and goes to the last request on the other side, servicing all the applications or requests in between. After reaching the final request on the other side, the head adjusts its direction by reversing. It then returns to the first request servicing all the requests in between. The process is then repeated until all requests have been accomplished. Instead of going to the last track like SCAN, this head goes to the last request before changing directions.

For example-

Consider a disk with 180 tracks (0-179) and a disk queue with the following input/output requests: 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40, 135, 50, 170, 65, 10. The Read/Write head's initial position is 45, and it will travel to the right. 

Using the LOOK disk scheduling algorithm, determine the total number of track movements of the Read/Write head.

Solution  

LOOK Disk Scheduling Algorithm

Head movements in total,

The initial head point is 45.

= (50-45) + (65-50) + (75-65) + (90-75) + (135-90) + (170-135) + (170-40) + (40-10)

= 5 + 15 + 10 + 15 + 45 + 35 + 130 + 30

= 285 

Recommended Topic: Process Control Block in OS

C-LOOK Algorithm

The LOOK Algorithm has been improved with the Circular-LOOK Algorithm.

The head begins at one end of the disc and gradually moves to the other end, serving any requests in between. The head turns around after reaching the last request on the other end.

It then returns to the first request at the beginning end without servicing any request in between.

The process is repeated. It only replies to requests in one direction, unlike LOOK.

For example-

To further understand the C-LOOK Disk Scheduling Algorithm, consider the following example. 

Consider a disc with 180 tracks (0-179) and a disc queue with the following input/output requests: 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40, 135, 50, 170, 65, 10. The Read/Write head's initial position is 45, and it will travel to the right. 

Using the C-LOOK disc scheduling method, determine the total number of track movements of the Read/Write head.

Solution-

C-LOOK Disk Scheduling Algorithm

Head movements in total,

The initial head point is 45,

= (50-45) + (65-50) + (75-65) + (90-75) + (135-90) + (170-135) + (170-10) + (40-10)

= 5 + 15 + 10 + 15 + 45 + 35 + 160 + 30

= 315

Difference between Look and C-Look Disk Scheduling Algorithm

 

The fundamental differences between the LOOK and C-LOOK disk Scheduling Algorithms will be discussed here. 

The following are the primary differences between the LOOK and C-LOOK Disk Scheduling Algorithms:

  1. The LOOK disc scheduling algorithm improves throughput and response time while reducing variation. The C-LOOK disc scheduling technique, on the other hand, provides constant waiting and response times.

2. The request processing in LOOK is not as good as it is in the C-LOOK disc scheduling technique. The C-LOOK, on the other hand, maybe able to better handle demands than the LOOK disc scheduling algorithm.

3. The improved variant of the SCAN disc scheduling algorithm is the LOOK disc scheduling algorithm. The C-LOOK, on the other hand, is a hybrid of the LOOK and SCAN algorithms.

4. The LOOK disc scheduling algorithm's head can handle requests in both directions. The head of the C-LOOK disc scheduling algorithm, on the other hand, may only service the request in one way.

Some of the point to point comparison of the Look and C-Look Disk Scheduling Algorithm is given in the following table-

  LOOK DISC SCHEDULING ALGORITHM C-LOOK SCHEDULING ALGORITHM
1. It's a more sophisticated version of the SCAN algorithm. It is the hybrid of the LOOK and SCAN algorithms.
2. The head in LOOK can serve requests from both directions. The head of the C-LOOK algorithm can only serve queries in one direction.
3. It does not outperform the C-LOOK in terms of performance. The C-LOOK method outperforms all other disc scheduling techniques.
4. When compared to the C-LOOK algorithm, the request handling isn't as good. The C-LOOK algorithm is more efficient than LOOK at handling requests.
5. It features a higher throughput and a lower variance reaction time. The C-LOOK ensures consistent waiting and response times.

FCFS Scheduling

Frequently Asked Questions

What is the use of the Disk Scheduling Algorithm?

Because a process can make several I/O requests and multiple processes can run at the same time, disc scheduling algorithms are required. A process's requests could come from distinct sectors on different tracks. As a result, the seek time may lengthen further. By arranging the requests made by the processes, these algorithms help reduce search time.

How does C-look function?

The C-LOOK algorithm is a hybrid of the LOOK and SCAN algorithms. In this method, the head advances from the first request to the last request in the opposite direction, serving all requests in between.

Which disc scheduling algorithm is the best?

The SSTF or LOOK algorithm is the most well-known request scheduling method. The primary purpose of this and most other disc scheduling algorithms is to limit the amount of disc head movements, which in turn reduces seek time. We'll need a fast access time and a lot of disc bandwidth to do this.

Which disc scheduling algorithm has a problem with starvation?

For requests on inner or outer cylinders, the SSTF disc scheduling mechanism is most likely to result in starvation.

What are the various types of disc scheduling?

 The different types of Disc Scheduling Algorithms are-

  • FCFS scheduling algorithm.
  • SSTF (shortest seek time first) Algorithm.
  • SCAN scheduling.
  • C-SCAN scheduling.
  • LOOK Scheduling.
  • C-LOOK scheduling.

Conclusion

In this article, we can clearly understand the use of algorithms and their different types where each type of Algorithm is assigned a different task. In this blog, we have focused on Disk Scheduling Algorithms, which are generally of 6 types. Then we discussed the differences between the Look and C-Look Scheduling Algorithms. You can also refer to these links Operating System Introduction, Types of Operating Systems

Recommended Reading:

Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, Uber, Microsoft, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Do upvote our blog to help other ninjas grow.

Happy Learning!

Live masterclass