suppose each time slice in a time-sharing system is 50 milliseconds and each context switch requires at most a microsecond.?

2014-11-05 2:31 pm
a) If there are 100 compute-bound processes to be served, how many processes can the machine service in a single second? b) What fraction of the machine's time is spent actually performing compute-bound processes? c) What would this fraction be if each process executes an I/O request a microsecond after its time slice begins?(Assume OS terminates a process performing I/O operation and allows another process to run while the first is waiting.)

回答 (1)

2014-11-05 2:49 pm
1000 / 50.001 = 19.9996 but it's less than 20 so that's 19 processes.
19 * 50 = 950 ms so 950 / 1000 = 95% of the time is compute. (although you could argue that the 20th process will have partially computed and therefore [950 + (1000 - (50.001*19))] / 1000 = 99.9981% compute time

0.001 compute + 0.001 context per process :: 1000ms / 0.002 = 500000 processes, compute time is 0.001 per processes = 500 so 500/1000 = 50% of the time is compute.
Which makes sense because half the time you are computing and the other half is context switching.


收錄日期: 2021-04-15 17:08:11
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20141105063138AAaymFO

檢視 Wayback Machine 備份