ArticleslgStudy

computer science

LOOK algorithm

LOOK algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand LOOK algorithm rather than just read about it. In short: LOOK is a hard disk scheduling algorithm used to determine the order in which new disk read and write requests are processed. Description The LOOK algorithm, similar to the SCAN algorithm, honors requests on both sweep directions of the disk head, however, it additionally "looks" ahead to see if there are any requests pending in the direction of head movement.

Key takeaways

  • LOOK algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect LOOK algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of LOOK algorithm from memory before moving on to harder problems.

Reference excerpt

LOOK is a hard disk scheduling algorithm used to determine the order in which new disk read and write requests are processed.

Description The LOOK algorithm, similar to the SCAN algorithm, honors requests on both sweep directions of the disk head, however, it additionally "looks" ahead to see if there are any requests pending in the direction of head movement. If no requests are pending in the direction of head movement, then the disk head traversal will be reversed to the opposite direction and requests on the other direction can be served. In LOOK scheduling, the arm goes only as far as final requests in each direction and then reverses direction without going all the way to the end. Consider an example, Given a disk with 200 cylinders (0-199), suppose we have 8 pending requests: 98, 183, 37, 122, 14, 124, 65, 67 and that the read/write head is currently at cylinder 53. In order to complete these requests, the arm will move in the increasing order first and then will move in decreasing order after reaching the end. So, the order in which it will execute is 65, 67, 98, 122, 124, 183, 37, 14. LOOK avoids the starvation problem of shortest seek time first (SSTF). This is because LOOK is biased against the area recently traversed, and favors tracks clustered at the outermost and innermost edges of the platter. LOOK is also biased towards more recently arriving jobs (on average).

Variants

C-LOOK One variant of LOOK is circular LOOK (C-LOOK). It is an effort to remove the bias in LOOK for track clusters at the edges of the platter. C-LOOK basically only scans in one direction. Either you sweep from the inside out, or the outside in. When you reach the end, you just swing the head all the way back to the beginning. This actually takes advantage of the fact that many drives can move the read/write head at high speeds if it's moving across a large number of tracks (e.g. the seek time from the last track to track 0 is smaller than one would expect and usually considerably less than the time it would take to seek there one track at a time). The huge jump from one end request to the other is not considered as a head movement as the cylinders are treated as a circular list.

N-LOOK and F-LOOK N and F LOOK were designed to offset LOOK’s bias towards recent jobs. Both algorithms partition the request queue into smaller sub queues and process the sub queues in order (oldest first). N-LOOK is so-called because the request queue is divided into N sub queues. F-LOOK is a simplification where there are only 2 queues, but they are used in a double-buffered fashion. While F-LOOK is processing one queue, all new requests go into the other one. To explain these algorithms we’re going to use the example of a disk with 200 tracks, and the read/write head starts at track 100. The request queue, in order, contains requests for tracks: 55, 58, 18, 90, 160, 38, we assume that the request queue is split into two, with the oldest one containing the requests for tracks: 55, 58, 18, 90. In this instance, N-LOOK and F-LOOK behave the same. Also notice, that in this configuration, it doesn’t matter which direction the head was moving in, all requested tracks are less than 100 so it will only move in the direction of decreasing tracks. Even through the average number of tracks traversed is the same as LOOK in the worst case, N and F LOOK are in some sense, more fair than plain old LOOK. The sub queue system caps the maximum latency a process can expect between a request and it being serviced (unlike SSTF that can starve processes for arbitrary lengths of time).

S-LOOK The shortest LOOK (S-LOOK) algorithm is an extension of the LOOK algorithm to handle the cases where the disk head is located between the far-end requests. The algorithm is designed to make a decision of which direction should be served first instead of only continuing to seek in the same direction before the new requests have arrived. Since the seek time is directly proportional to the seek distance, our goal is to minimize the seek distance, and hence, reduce the seek time.

Performance LOOK has slightly better average seek times than SCAN. C-LOOK has a slightly lower variance in seek time than LOOK since the worst case seek time is nearly cut in half.

See also SCAN - Elevator algorithm FSCAN N-Step-SCAN

References

Worked examples

Example 1 — a first encounter with LOOK algorithm

Start with the simplest possible case. Write down what LOOK algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to LOOK algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about LOOK algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of LOOK algorithm

In research
LOOK algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses LOOK algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
LOOK algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Disk scheduling algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for LOOK algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “LOOK algorithm” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study LOOK algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what LOOK algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain LOOK algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is LOOK algorithm in simple terms?

LOOK is a hard disk scheduling algorithm used to determine the order in which new disk read and write requests are processed. Description The LOOK algorithm, similar to the SCAN algorithm, honors requests on both sweep directions of the disk head, however, it additionally "looks" ahead to see if th…

Why does LOOK algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study LOOK algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on LOOK algorithm.

Tags

  • Disk scheduling algorithms

Keep exploring