CPU SCHEDULING
CPU SCHEDULING
The term “share” is used to define a portion of the system's CPU resources that
is allocated to a project .
CPU shares are not equivalent to percentages of CPU resources. Shares are
used to define the relative importance of workloads in relation to other workloads.
When you assign CPU shares to a project, your primary concern is not the
number of shares the project has. Knowing how many shares the project has in
comparison with other projects is more important. You must also take into
account how many of those other projects will be competing with it for CPU
resources.
Classes vs Algorithim
Scheduling Classes are like "teams" in a workplace, each with its own set of
rules and goals.
Scheduling Algorithms are the specific workflows or methods the team uses
to achieve its objectives.
In essence, classes define "what to do" (policies), and algorithms define "how to
do it"
Uses dynamic priorities that change based on the CPU usage and sleep time of the
processes.
Processes in this class are given precedence over all other classes.
These processes are non-preemptive and have the highest priority to ensure system
stability.
Processes with higher priorities run before those with lower priorities, regardless of
their behavior.
Schedulung algorithims
1. Round-Robin (RR)
Definition:
How It Works:
1.All processes are placed in a queue.
2.The CPU executes each process for a fixed time slice (if it’s ready).
3.If a process is not finished, it goes back to the queue; if it finishes, it exits.
Advantages:
Disadvantages:
Definition:
A multilevel feedback queue uses multiple queues with different priority levels.
Processes can move between these queues based on their execution behavior (e.g.,
CPU burst, waiting time).
How It Works:
1.New processes start in the highest-priority queue.
2.If a process uses its entire time slice, it is moved to a lower-priority queue.
4.Higher-priority queues are processed first; lower-priority queues are only served if
higher-priority queues are empty.
Advantages:
Disadvantages:
Definition:
FCFS is the simplest scheduling algorithm where processes are executed in the order
they arrive, without preemption.
How It Works:
2.Once a process starts, it runs to completion before the next one begins.
Advantages:
Disadvantages:
Convoy Effect: Long processes can block shorter ones, leading to poor overall
performance.
4. Fixed-Priority Preemptive
Definition:
1.Processes are assigned fixed priorities (usually numeric, lower numbers = higher
priority).
Advantages:
Suitable for real-time systems where certain tasks must meet deadlines.
Disadvantages: