OS が, ジョブを到着順に, 前のジョブが終わってから次のジョブを処理する場合について考える。ジョブの到着時刻と処理時間が表のとおりであるとき, ジョブ 4 は, 到着してからその処理が終了するまでに何秒を要するか。ここで, 四つのジョブ以外の処理に要する時間は無視できるものとする。表の到着時刻は, ジョブ 1 が到着した時刻を開始時刻とする。
| 到着時刻 | 処理時間 | |
|---|---|---|
| ジョブ1 | 0秒後 | 3秒 |
| ジョブ2 | 4秒後 | 4秒 |
| ジョブ3 | 5秒後 | 3秒 |
| ジョブ4 | 7秒後 | 5秒 |
This question's explanation and your answers so far.
OS が, ジョブを到着順に, 前のジョブが終わってから次のジョブを処理する場合について考える。ジョブの到着時刻と処理時間が表のとおりであるとき, ジョブ 4 は, 到着してからその処理が終了するまでに何秒を要するか。ここで, 四つのジョブ以外の処理に要する時間は無視できるものとする。表の到着時刻は, ジョブ 1 が到着した時刻を開始時刻とする。
| 到着時刻 | 処理時間 | |
|---|---|---|
| ジョブ1 | 0秒後 | 3秒 |
| ジョブ2 | 4秒後 | 4秒 |
| ジョブ3 | 5秒後 | 3秒 |
| ジョブ4 | 7秒後 | 5秒 |
5 is nothing but job 4's own processing time. The question asks for the time from arrival until processing finishes (the turnaround time), and this value does not count the 4 seconds that job 4 spends waiting for the earlier jobs after it arrives.
8 is the value you get if you overlook the idle time between 3 and 4 seconds and wrongly assume that job 2 starts at 3 seconds, immediately after job 1 finishes (job 2 from 3 to 7, job 3 from 7 to 10, job 4 from 10 to 15, giving 15−7=8). Job 2 does not arrive until 4 seconds, so it cannot start at 3 seconds.
正解 Jobs are handled in order of arrival (first-come, first-served), and the next job is processed only after the previous one has finished, so the execution timeline is as follows. Job 1 arrives at 0 seconds and starts right away, running from 0 to 3 seconds. Job 2 does not arrive until 4 seconds, so it does not start at 3 seconds when the CPU becomes free; it starts at 4 seconds and runs from 4 to 8 seconds (between 3 and 4 seconds there is no waiting job, so the CPU is idle). Job 3 has already arrived at 5 seconds, but it must wait for job 2 to finish, so it runs from 8 to 11 seconds. Job 4 has already arrived at 7 seconds, but it must wait for job 3 to finish, so it runs from 11 to 16 seconds. Therefore job 4 needs 16−7=9 seconds from its arrival (at 7 seconds) until it finishes (at 16 seconds). The same value is obtained by adding the waiting time of 4 seconds (the remaining 1 second of job 2 plus the 3 seconds of job 3) and its own processing time of 5 seconds. Hence the correct answer is ウ.
12 comes from treating job 4's waiting time as the sum of the processing times of job 2 and job 3, 4+3=7 seconds, and then calculating 7+5=12. At the moment job 4 arrives (7 seconds), job 2 has already been running for 3 seconds, so the actual wait is only the remaining 1 second of job 2 plus the 3 seconds of job 3, 4 seconds in total.