[go: up one dir, main page]

0% found this document useful (0 votes)
5 views3 pages

OS Assignment3 Solved

The document discusses process scheduling in operating systems, explaining its importance in optimizing CPU utilization and minimizing wait times. It outlines three types of schedulers: long-term, short-term, and medium-term, and provides examples of scheduling algorithms such as FCFS, SJF, and Round Robin. Additionally, it compares preemptive and non-preemptive scheduling, highlighting their differences in CPU control, responsiveness, and potential for starvation.

Uploaded by

john.the.don2312
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)
5 views3 pages

OS Assignment3 Solved

The document discusses process scheduling in operating systems, explaining its importance in optimizing CPU utilization and minimizing wait times. It outlines three types of schedulers: long-term, short-term, and medium-term, and provides examples of scheduling algorithms such as FCFS, SJF, and Round Robin. Additionally, it compares preemptive and non-preemptive scheduling, highlighting their differences in CPU control, responsiveness, and potential for starvation.

Uploaded by

john.the.don2312
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/ 3

OS Assignment-3: Solved Answers

------------------------------------------------------------

Question 1:

Explain Process Scheduling. Discuss different types of schedulers.

Answer:

Process Scheduling is the method by which the OS decides which process runs at a given time. It

improves CPU utilization and throughput while minimizing waiting and turnaround time.

Types of Schedulers:

1. Long-term Scheduler - Controls jobs admitted to the system.

2. Short-term Scheduler - Chooses processes from the ready queue for execution.

3. Medium-term Scheduler - Handles process swapping and suspension.

------------------------------------------------------------

Question 2:

Given processes:

| Process | Arrival | Burst |

|---------|---------|-------|

| P1 |0 |8 |

| P2 |1 |4 |

| P3 |2 |9 |

| P4 |3 |5 |

(a) FCFS Scheduling:

Order: P1 -> P2 -> P3 -> P4


Gantt: 0--8--12--21--26

Avg TAT = 15.25 ms

Avg WT = 8.75 ms

(b) SJF (Non-Preemptive):

Order: P1 -> P2 -> P4 -> P3

Gantt: 0--8--12--17--26

Avg TAT = 14.25 ms

Avg WT = 7.75 ms

------------------------------------------------------------

Question 3:

Difference between Preemptive and Non-Preemptive Scheduling

| Aspect | Preemptive | Non-Preemptive |

|----------------|---------------------|-----------------------|

| CPU Control | Taken forcefully | Till process ends |

| Responsiveness | High | Low |

| Starvation | Possible | Less likely |

| Examples | RR, SRTF | FCFS, SJF |

------------------------------------------------------------

Question 4:

Round Robin (Time Quantum = 4)

Processes:

P1: 0,10 | P2: 1,4 | P3: 2,5 | P4: 3,3


Execution Order:

P1 -> P2 -> P3 -> P4 -> P1 -> P3 -> P1

Completion Times:

P1: 22 | P2: 8 | P3: 20 | P4: 15

TAT:

P1: 22 | P2: 7 | P3: 18 | P4: 12

WT:

P1: 12 | P2: 3 | P3: 13 | P4: 9

Avg TAT = 14.75 ms

Avg WT = 9.25 ms

You might also like