0% found this document useful (0 votes)
14 views5 pages

Unit 3,4 Question Bank

Uploaded by

Ankush Pawar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Unit 3,4 Question Bank

Uploaded by

Ankush Pawar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

----------- Chapter 3 -----------------------

Q. Write difference between process and program


Q. Explain process state with its suitable diagram
Q. Explain process control block(PCB) with diagram
Q. Explain message passing model
Q. Explain shared memory model
Q. difference between thread and process
Q. Explain scheduling queue, write types
Q. explain any one of type of scheduling queue
Q. Explain medium term scheduling

----------- Chapter 4 -----------------------


Q. Explain non-preemptive and preemptive scheduling
Q. Write types of scheduling algorithms and explain any one of them
Q. Explain Multilevel feedback queue scheduling
Q. Define Deadlock and mention the necessary conditions for deadlock to occur.
Q. Explain Deadlock prevention
Q. List out scheduling criterias and explain any two of them
Q. Explain the difference between Preemptive and Non-Preemptive Scheduling.
Q. Consider a set of 5 processes arriving in the following order with their respective burst times:
Process Arrival time Burst time

P1 0 4

P2 1 3

P3 2 1

P4 3 2

P5 4 5

Using the First Come First Serve (FCFS) scheduling algorithm (non-preemptive),
construct a Gantt chart for these processes.
Calculate the Completion Time, Waiting Time, and Turnaround Time for each process, and determine the
average waiting time and average turnaround time.
Q. Consider the following set of processes with their respective arrival times and burst times:

Process Arrival Time Burst Time


P1 0 5
P2 2 3
P3 4 1
P4 5 2
Calculate the waiting time and turnaround time for each process using the FCFS scheduling
algorithm, and find the average waiting time and average turnaround time.

Answer:
Using FCFS scheduling, we serve each process in the order they arrive in the ready queue.

Step 1: Determine the Gantt Chart


1. Process P1 arrives at time 0 and executes for 5 units of time, completing at time 5.
2. Process P2 arrives at time 2 but has to wait until P1 finishes at time 5, then it runs for 3
units, completing at time 8.
3. Process P3 arrives at time 4 but waits until P2 finishes at time 8, then it runs for 1 unit,
completing at time 9.
4. Process P4 arrives at time 5 but waits until P3 finishes at time 9, then it runs for 2 units,
completing at time 11.
The Gantt Chart is as follows:

P1 | P2 | P3 | P4
0 5 8 9 11

Step 2: Calculate Waiting Time and Turnaround Time


• Waiting Time (WT) = Start time - Arrival time
• Turnaround Time (TAT) = Finish time - Arrival time

Arrival Burst Start Finish Waiting Time Turnaround Time


Process
Time Time Time Time (WT) (TAT)
P1 0 5 0 5 0 5
P2 2 3 5 8 3 6
P3 4 1 8 9 4 5
P4 5 2 9 11 4 6
Step 3: Calculate Average Waiting Time and Average Turnaround Time
• Average Waiting Time (AWT) = (0 + 3 + 4 + 4) / 4 = 11 / 4 = 2.75
• Average Turnaround Time (ATAT) = (5 + 6 + 5 + 6) / 4 = 22 / 4 = 5.5

Final Answer:
• Waiting Time for each process: P1 = 0, P2 = 3, P3 = 4, P4 = 4
• Turnaround Time for each process: P1 = 5, P2 = 6, P3 = 5, P4 = 6
• Average Waiting Time = 2.75
• Average Turnaround Time = 5.5
Q. Consider the following set of processes with their respective arrival times and burst times:
Process Arrival Time Burst Time
P1 0 7
P2 2 4
P3 4 1
P4 5 4
Calculate the waiting time and turnaround time for each process using the SJF scheduling
algorithm, and find the average waiting time and average turnaround time.

Answer:
In SJF (non-preemptive), the process with the shortest burst time is selected when the CPU is free
and ready to execute a process.

Step 1: Determine the Execution Order


1. Process P1 arrives at time 0 and begins execution immediately as it is the only available
process. It completes after 7 units, at time 7.
2. Process P2 arrives at time 2 but has to wait because P1 is still executing. When P1 finishes,
P2 is ready to start, and it has the shortest burst time among the available processes at time
7. P2 runs for 4 units and finishes at time 11.
3. Process P3 arrives at time 4 and is ready by the time P2 completes at 11. Since P3 has the
shortest burst time of 1, it starts next and finishes at time 12.
4. Process P4 arrives at time 5 and is the only remaining process after P3 finishes. It starts at
12 and runs for 4 units, completing at time 16.
The execution order (Gantt Chart) is as follows:

P1 | P2 | P3 | P4
0 7 11 12 16

Step 2: Calculate Waiting Time and Turnaround Time


• Waiting Time (WT) = Start time - Arrival time
• Turnaround Time (TAT) = Finish time - Arrival time

Arrival Burst Start Finish Waiting Time Turnaround Time


Process
Time Time Time Time (WT) (TAT)
P1 0 7 0 7 0 7
P2 2 4 7 11 5 9
P3 4 1 11 12 7 8
P4 5 4 12 16 7 11
Step 3: Calculate Average Waiting Time and Average Turnaround Time
• Average Waiting Time (AWT) = (0 + 5 + 7 + 7) / 4 = 19 / 4 = 4.75
• Average Turnaround Time (ATAT) = (7 + 9 + 8 + 11) / 4 = 35 / 4 = 8.75

Final Answer:
• Waiting Time for each process: P1 = 0, P2 = 5, P3 = 7, P4 = 7
• Turnaround Time for each process: P1 = 7, P2 = 9, P3 = 8, P4 = 11
• Average Waiting Time = 4.75
• Average Turnaround Time = 8.75

You might also like