Consider the following four processes with arrival times (in milliseconds) and…
2021
Consider the following four processes with arrival times (in milliseconds) and their lengths of CPU bursts (in milliseconds) as shown below :

These processes are run on a single processor using preemptive Shortest Remaining Time First scheduling algorithm. If the average waiting time of the processes is 1 millisecond, then the value of Z is
- A.
3
- B.
2
- C.
5
- D.
7
- E.
Question not attempted
Attempted by 182 students.
Show answer & explanation
Correct answer: B
To find the value of Z, we use the preemptive Shortest Remaining Time First (SRTF) scheduling algorithm and the given average waiting time of 1 ms.
Step 1: Understand the SRTF algorithm: The process with the shortest remaining CPU burst time is executed. If a new process arrives with a shorter burst time, the current process is preempted.
Step 2: List the processes with their arrival times and CPU burst times:
P1: Arrival = 0, Burst = 3
P2: Arrival = 1, Burst = 1
P3: Arrival = 3, Burst = 3
P4: Arrival = 4, Burst = Z
Step 3: Simulate the Gantt chart for different values of Z and calculate waiting times.
Step 4: Waiting time for a process = Turnaround time - CPU burst time.
Step 5: Average waiting time = (Sum of waiting times of all processes) / 4 = 1 ms.
Step 6: Solve for Z such that the average waiting time is 1 ms.
हिन्दी उत्तर:
Z का मान ज्ञात करने के लिए, हम प्रीमेप्टिव शॉर्टेस्ट रिमेनिंग टाइम फर्स्ट (SRTF) शेड्यूलिंग एल्गोरिदम और दिए गए औसत वेटिंग टाइम 1 मिलीसेकंड का उपयोग करते हैं।
चरण 1: SRTF एल्गोरिदम को समझें: शॉर्टेस्ट रिमेनिंग CPU बर्स्ट टाइम वाली प्रोसेस को निष्पादित किया जाता है। यदि एक नई प्रोसेस आती है जिसका बर्स्ट टाइम छोटा होता है, तो वर्तमान प्रोसेस को प्रीमेप्ट किया जाता है।
चरण 2: प्रोसेसों को उनके आरिवल समय और CPU बर्स्ट समय के साथ सूचीबद्ध करें:
P1: आरिवल = 0, बर्स्ट = 3
P2: आरिवल = 1, बर्स्ट = 1
P3: आरिवल = 3, बर्स्ट = 3
P4: आरिवल = 4, बर्स्ट = Z
चरण 3: विभिन्न Z मानों के लिए गैंट चार्ट का अनुकरण करें और वेटिंग समय की गणना करें।
चरण 4: एक प्रोसेस के लिए वेटिंग समय = टर्नअराउंड समय - CPU बर्स्ट समय।
चरण 5: औसत वेटिंग समय = (सभी प्रोसेसों के वेटिंग समय का योग) / 4 = 1 मिलीसेकंड।
चरण 6: Z के लिए ऐसा मान ज्ञात करें जिससे औसत वेटिंग समय 1 मिलीसेकंड हो।