Please enable JavaScript.
Coggle requires JavaScript to display documents.
Scheduling (CFS (Completely Fair Scheduler) (Goal is to ensure that each…
Scheduling
-
-
Multiple CPU's
Cache Affinity
Refers to the concept where as a thread continues to run on a CPU it increases adds stuff to the CPU's cache increasing its affinity for it.
If the thread is run on another CPU then it loses the data it already stored on the previous CPU.
We want to try and run a thread on the same CPU that its been run on.
Works well for per-cord ready queues but not shared ready queues.
Per-Core Ready Queue
-
Advantages
-
Cache Affinity
Does not suffer from cache affinity since when a thread is scheduled for a job the CPU it was scheduled on is the only one it runs on
Disadvantages
Load Imbalance
Queue's may have different lengths which results in load imbalance across cores. Cores with lighter loads may be idle. Threads on cores with lighter loads might get more running time than others
-
Work Stealing
Technique where a CPU queue peaks at other queues when its workload is less to see if it can steal jobs from other queues
Shared Ready Queue
-
-
Disadvantages
Doesn't scale well
Since we need to use locks to provide security when accessing shared data increasing the number of jobs will increase contention
Cache Affinity
Since a single ready-queue is being shared among multiple CPU's we have to do extra work to try and ensure threads are run on the same core they were previously run on.
Scheduling
-
Scheduling Policies
FCFS (First Come, First Served)
-
-
Disadvantage
Convey Effect
FCFS doesn't work well when jobs have different run times. It has bad performance when shorted jobs are queued after a large job. Since the shorter jobs have to wait for the big one to finsih
SJF (Shortest Job First)
Definition
Runs the shortest job first, then the next shortest, etc
-
Disadvantages
Also suffers from the convey effect. Since jobs can arrive at anytime, if a big job arrives before the little ones SJF still suffers the same as FCFS
-
Round Robin
Definition
RR runs a job for a time slice (scheduling quantum) and then switches to the next job in the run queue
-
Disadvantages
Bad for turnaround time since jobs are only worked on in small increments, causing the time it takes for jobs to complete to increase.
Also bad context switching is costly.