سوال ۹۶ کنکور ارشد مهندسی کامپیوتر ۱۴۰۲
درخواستهایی برای دیسک بهترتیب (از راست به چپ) برای سیلندرهای ۳۸، ۶، ۴۰، ۲، ۲۰، ۲۲، ۱۰ به گرداننده دیسک میرسند، زمان جستجوی هر سیلندر بهازای حرکت از هر سیلندر به سیلندر مجاور ۶ میکروثانیه است. در الگوریتم آسانسور (ابتدا در جهت بالا حرکت کنیم) درصورتیکه بازوی دیسک در ابتدا بر روی سیلندر ۲۰ قرار داشتهباشد، زمان جستجو چند میلیثانیه است؟
پاسخ صحیح: گزینهٔ B — ۳۴۸
The elevator / SCAN (LOOK) algorithm sweeps the head in one direction, servicing every request it passes, then reverses.
Requests sorted by cylinder: .
The head starts at cylinder and is told to move upward first. So it services the requests at or above in increasing order, then turns around and services the lower requests in decreasing order.
Upward sweep (from ): . The arm only needs to reach the highest pending request (), so the upward travel is
Downward sweep (reverse, from ): . The arm travels down to the lowest pending request ():
Total head movement:
Each single-cylinder move costs time units, so the total seek time is
This equals option (2). (The intended unit is microseconds: ; the printed word «milliseconds» is a known typo in this booklet, but the matching numeric value is unambiguously .)
Exam trick: SCAN/LOOK distance is just (top reached − start) + (top reached − bottom reached). Total movement is independent of how many requests sit in between — only the extreme cylinders in each direction matter. Note that because the head reverses only at the last request (, not a fixed disk end), this is technically the LOOK variant.