In: Computer Science
Assume there are three processes A, B and C. All processes are submitted for execution at the same time. The process A executes for 2 milliseconds and then does I/O for 3 milliseconds and then executes for 3 milliseconds more. The process B executes for 4 milliseconds and then does I/O for 7 milliseconds. The process C executes for 2 millisecond and then does I/O for 4 milliseconds. Assume no contention for the resources and the order of execution (priority) is A, B and C.
Assume that the computer system has 512 Mbytes of available memory. What is the memory utilization with multiprogramming if Process A requires 256 Mbytes, Process B requires 128 Mbytes and Process C requires 64 Mbytes of memory. Note that: all processes are submitted for execution at the same time.
Process | CPU (in milliseconds) | I/O (in milliseconds) |
A | 2 + 3 = 5 | 3 |
B | 4 | 7 |
C | 2 | 4 |
Total execution time for three processes = (5 + 3 + 4 + 7 + 2 + 4) milliseconds = 25 milliseconds
Among the total time of 25 milliseconds, (5 + 4 + 2) milliseconds = 11 milliseconds will be utilized for CPU and the remaining (25 - 11) milliseconds = 14 milliseconds will be utilized for the I/O. This I/O interaction can't support multiprogramming, but the CPU interaction can support multiprogramming.
Process A can utilize ((256/512) * 100) % = 50% of the memory.
Process B can utilize ((128/512) * 100) % = 25% of the memory.
Process C can utilize ((64/512) * 100) % = 12.50% of the memory.
Total system memory = 512 MB
Memory requirement for all three processes = (256 + 128 + 64) MB = 448 MB
As the total required memory (448) < Available memory (512)
So, there will be enough memory to support multiprogramming for these three processes.
With multiprogramming the memory utilization will be ((448/512) * 100) % = 87.5%
For CPU operations we have,
Memory utilization = (utilization of all three processes * total CPU time of all three processes)
or, Memory utilization = (0.875 * 11)
or, Memory utilization = 9.625 seconds (the effective utilization time)
For I/O operations we have,
Memory utilization = (utilization of process A * I/O time of process A) + (utilization of process B * I/O time of process B) + (utilization of process C * I/O time of process C)
or, Memory utilization = (0.5 * 3) + (0.25 * 7) + (0.125 * 4)
or, Memory utilization = (1.5 + 1.75 + 0.5)
or, Memory utilization = 3.75 seconds (the effective utilization time)
So, the memory utilization with multiprogramming = (((9.625 + 3.75) / 25) * 100) % = ((13.375 / 25) * 100) % = 53.50 %
Please comment in case of any doubt.
Please upvote if this helps.