Spring - 23-24 - OS - Lecture - Slide - 7
Spring - 23-24 - OS - Lecture - Slide - 7
1. Thread Scheduling
2. Multi-Processor Scheduling
3. Real-Time CPU Scheduling
4. Operating Systems Examples
5. Algorithm Evaluation
Multilevel Queue
❑ With priority scheduling, have separate
queues for each priority.
❑ Three queues:
❑ Q0 – RR with time quantum 8 milliseconds
❑ Q1 – RR time quantum 16 milliseconds
❑ Q2 – FCFS
❑ Scheduling
❑ A new job enters queue Q0 which is served RR
❑ When it gains CPU, job receives 8 milliseconds
❑ If it does not finish in 8 milliseconds, job is moved to queue Q1
❑ At Q1 job is again served RR and receives 16 additional milliseconds
❑ If it still does not complete, it is preempted and moved to queue Q2 served
FCFS.
Thread Scheduling
❑ Distinction between user-level and kernel-level threads
❑ When a thread has been running on one processor, the cache contents of
that processor stores the memory accesses by that thread.
❑ Load balancing may affect processor affinity as a thread may be moved from
one processor to another to balance loads, yet that thread loses the
contents of what it had in the cache of the processor it was moved off of.
❑ Hard affinity – allows a process to specify a set of processors it may run on.
NUMA and CPU Scheduling
If the operating system is NUMA-aware, it will assign
memory closes to the CPU the thread is running on.
Real-Time CPU Scheduling
❑ Can present obvious challenges
❑ Linux scheduling
❑ Windows scheduling
❑ Solaris scheduling
Algorithm Evaluation
❑ How to select CPU-scheduling algorithm for an OS?
❑ Determine criteria, then evaluate algorithms
❑ Deterministic modeling
❑ Type of analytic evaluation
❑ Takes a particular predetermined workload and defines the
performance of each algorithm for that workload
❑ Consider 5 processes arriving at time 0:
Deterministic Evaluation
❑ For each algorithm, calculate minimum average waiting time
❑ Simple and fast, but requires exact numbers for input, applies
only to those inputs
❑ FCS is 28ms:
❑ RR is 23ms:
Queueing Models
❑ Describes the arrival of processes, and CPU and I/O bursts
probabilistically
❑ Commonly exponential, and described by mean
❑ Computes average throughput, utilization, waiting time, etc