in Operating System
183 views
0 votes
0 votes
Consider a uniprocessor system with n processes in the ready queue. Round robin scheduling with time quantum x is used for process scheduling. Assume each process requires kx seconds to complete and the context switch takes 0 seconds. At what time the first process will complete the execution? (assume all the variables as integers).

A) nkx

 B) k(nx-1)

C) k(nk+n)

D) x(nk-n+1)
in Operating System
183 views

1 comment

Correct Answer Is:-

A) nkx

To find out when the first process will complete its execution, we need to consider the total time required for all processes to complete and then determine when the first process will finish.

Each process requires kx seconds to complete, and there are n processes in the ready queue. Therefore, the total time required for all processes to complete is nkx seconds.

Since the scheduling is round-robin, the first process will complete its execution after one complete cycle through all processes. In each cycle, each process gets a time quantum x to execute. Therefore, the first process will complete its execution after nx seconds.

0
0

1 Answer

1 vote
1 vote

Since each process takes kx time, for any process to be completed, it needs to go through k cycles of scheduling.
Now, since we were asked about 1st process, we don't need to calculate for all k cycles, we only need to calculate for (k-1) cycles and plus x for last cycle.
i.e (k-1) cycles + x
We have n process in each cycle and each process takes x time, therefore time taken for (k-1) cycles is
n(k-1)x
total execution time for 1st process is
=> n(k-1)x + x
=> x(n(k-1) + 1)
=> x(nk - n + 1)

which is the answer

1 comment

D
0
0

Related questions