1. Acomputer system has two CPUs and each CPU can support two threads in hardwar
ID: 3752606 • Letter: 1
Question
1. Acomputer system has two CPUs and each CPU can support two threads in hardware, i.e., it can support the execution of two processes simultaneously. Suppose there are five processes P1, P2, P3, P4 and P5 that must execute and their execution times are 5, 5, 10, 15, and 20 seconds respectively. Assume that all the processes are 100% CPU bound and that no process will block on resources. All the processes arrive at the same time, and once assigned to a CPU, each process will execute to completion on the same CPU. How long will it take for all the five processes to complete execution?Explanation / Answer
The given system can support two threads in hardware that means load of the processor can be distributed.
1.
First task is stored in thread 1 and second task is stored in thread 2 while processor's 100% capapcity is utilized for thread.
For the given scenario
CPU 1 CPU 2
Thread 1 P1(5 SECONDS) P3(10 SECONDS)
Thread 2 P2(5 SECONDS) P4(15 SECONDS)
P5( 20 SECONDS)
CPU1(30 SECONDS) CPU2(25 SECONDS)
Total time: 30 seconds
EXPLANATION:
Starts with processor 1 (CPU1)
CPU 1(THREAD 1) gets P1(5 SECONDS) and simultaneously CPU1(THREAD 2) gets P2(5 SECONDS).
Here processor 1(CPU 1) is full.
Now, CPU 2( THREAD 1) gets P3( 10 SECONDS) and CPU 2( THREAD 2) gets P4(15 SECONDS)
After CPU 1 gets idle it gets P5( 20 SECONDS)
So, CPU1 on completing all its processes completes at 30 seconds and CPU 2 on completing all its processes completes at 25 seconds and remain idle for 5 seconds.
Total time taken for all processes to complete execution is 30 seconds.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.