Don OS
Don OS
Odhiambo
REG.NO: IN14/00094/24.
SCHOOL: SIST
DEPARTMENT: COMPUTING
UNIT CODE: COMP 113
ASSIGNMENT 1
Q.1: DISCUSS CPU SCHEDULING ALGORITHMS IN OPERATING SYSTEM
.CPU Scheduling is the process of deciding which process will own the CPU to use while other
process is suspended .It ensures that whenever the CPU remains idle , the operating system has at
least selected one of the processes available in a ready to use line.
1.Arrival time – The time at which the process arrives in the ready queue
2.Completion time – The time at which the process completes its execution.
4.Turn Around time – Time difference between completion time and arrival time
5.Waiting Time – Difference between Turn around Time and Burst Time .
1.First Come First Serve – This is where the process which arrives first ,gets executed first or The
process which requests the CPU first, gets the CPU allocated first. i.e the process is executed in the
order they arrive .
Disadvantage : Can cause Convoy effect , leading to high waiting time for shorter processes.
NB: Convoy effect is a situation where many processes , who need to use a resource for short time
are blocked by one process holding that resource for a long time.
2.Short Job First Scheduling (SJFS) – This is where the process that has the shortest Burst time will be
executed first.
Preemptive is CPU scheduling technique where a running process can be interrupted and moved to
the ready queue if a higher priority process arrives or its time slice expires.
Non Preemptive is a CPU scheduling technique where once the process once assigned the CPU ,runs
to completion or until it voluntarily releases the CPU.
Disadvantage :Hard to predict burst time and may cause starvation for long processes.
3.Priority Scheduling: This is where the scheduling is done on the basis of priority of the process
where the process which I most urgent is processed first followed by the ones with lesser priority in
order.
The processes with same priority will be served in the basis of First Come First Servs.
a. Preemptive Priority Scheduling-If the new jo arrives at the queue and has higher priority, the
processing of the current job is stopped and the incoming job with higher priority gets to
the CPU for processing.
b. B. Non preemptive Priority Scheduling- If a new process arrives with higher priority than the
current running process, the incoming process is put on to of the ready queue so after the
execution of the current process it will be processed.
Advantage: improves system performance as High priority tasks completes faster enhancing
system responsiveness for time sensitive applications
Disadvantage: Starvation problem – Low priority tasks may never get CPU time incase higher
priority tasks keep on arriving.
4.Round Robin Scheduling- this algorithm assigns a fixed time slice to each job in the ready queue
circles through them in a circular manner .If the process does not complete within its allotted time
it’s moved to the back of the queue allowing the next process a turn .this continues till completion
of all processes.
5.Multilevel Queue Scheduling- is a CPU scheduling algorithm that divide the ready queue into
multiple separate queues, each assigned different scheduling algorithms and priorities.
Disadvantage: Processes in lower priority queues may suffer starvation if those in higher priority
queues are always busy.
6.Multilevel feedback scheduling- This an algorithm which allows jobs to move between multiple
priority queues based on their behavior and execution history.
Advantage: Prevents starvation by allowing low priority tasks to get CPU time.
2.Process state- Describes whether the process is new ,Ready ,Running ,Waiting or Terminated.
3.Program Counter- Stores the address of the next instructions to execute.
4.CPU Registers -Holds the values of registers like the accumulator ,stack pointer and general-
purpose registers.
5.Memory management Information- Includes details like base and limits registers and page tables
used in memory allocation.
6.Scheduling Information- Contains priority level, scheduling queue pointers and process execution
time.
7.I/O status Information- Stores information about allocated I/O devices, open files and I/O requests.
8.Accounting Information: Tracks CPU usage ,execution time, and user ID.
1.Contex Switching- The OS saves the PCB when a process is switched out and restores it when
resuming
2.Process synchronization and Communication: Aids in coordinating process and handling inter-
process communication (IPC)
3.Resource allocation: Helps in managing the memory, CPU time and I/O resources.
=Advantages: Fault detection and recovery- Helps to identifying and handling process failures.
: Improves Scheduling by helping the OS to decide which process to execute next based
on priority and scheduling algorithms.
=Disadvantages: Increases Overhead -Storing and updating PCBs require additional system resources
like memory and CPU cycles.