سوال ۹۷ کنکور ارشد مهندسی کامپیوتر ۱۴۰۴
چهار فرایند مشابه نیاز به ۲۰ ms پردازش دارند که اجرای آنها بهصورت ۵ms پردازش و ۵ms انتظار برای تکمیل IO است. اگر سربار تعویض زمینه صفر باشد، اجرای دستهای (batch) این فرایندها روی یک پردازندهٔ دوهستهای (dual core) چند ms طول میکشد؟
پاسخ صحیح: گزینهٔ C — ۴۰
Each of the four processes needs ms of CPU work, delivered in ms CPU bursts that alternate with ms IO waits:
Total CPU demand. Four processes ms ms of CPU work. With two cores the absolute lower bound on makespan is
This bound is achievable because the ms IO waits of one process exactly match the ms CPU bursts of a partner process, so each core can stay busy by interleaving two processes. Put on core 1 and on core 2; core 1 runs:
While does IO, uses the core, and vice-versa, so the core never idles and finishes both processes at ms. Core 2 mirrors this for . Hence the batch completes in ms (option 3).
Option 1 ( ms) corresponds to the no-overlap / single-stream reading where the IO waits and the second core give no benefit (). The official key therefore accepts both options 1 and 3; the rigorous optimal-schedule answer is ms (option 3).
Exam trick: With a perfectly matched CPU-burst / IO-wait ratio, the makespan is just (total CPU work) / (number of cores) — IO time hides completely behind another process's computation.