Os (Written)
Os (Written)
Trap:
User Mode:
Kernel Mode:
Occurs when allocated memory is larger than the requested memory, leaving
unused space within a partition.
Solution: Use smaller or variable-sized partitions, or use paging.
External Fragmentation:
Frame:
A non-preemptive algorithm.
Processes are executed in the order they arrive in the ready queue.
The first process to arrive is the first to execute.
The CPU is allocated to processes without interruption until they complete.
Round-Robin Scheduling:
A preemptive algorithm.
Each process is assigned a fixed time slice (quantum).
The CPU is allocated in a circular order.
When a process’s time slice expires, it moves to the back of the queue.
This continues until all processes are completed.
A non-preemptive algorithm.
The process with the shortest burst time (execution time) is executed first.
If two processes have the same burst time, they are scheduled in arrival
order.
Minimizes average waiting time but can lead to "starvation" of longer
processes.
17. What is the difference between preemptive and non-preemptive
scheduling?
Preemptive Scheduling:
The CPU can be taken from a running process before it completes, allowing
another process to run.
Provides better responsiveness and fair distribution of CPU time.
Example: Round-Robin, Preemptive Shortest Job First (SJF).
Non-Preemptive Scheduling: