This document discusses scheduling for multicore processors. It begins by explaining that multicore processors pack multiple CPU cores onto a single chip to increase processing speed. However, traditional C programs only use one CPU, so simply adding more CPUs does not speed programs up. The document then covers several challenges in multicore scheduling, such as cache coherence and affinity. It proposes some solutions like multi-queue scheduling, where each CPU has its own job queue, to help address issues like lack of scalability from single-queue approaches. Common Linux schedulers like the O(1) scheduler and Completely Fair Scheduler that use multiple queues are also mentioned.
3. Difficulties in Multicore
C Program uses only one CPU.
Adding more CPUs doesn’t make the program run faster.
To OVERCOME this difficulty we need to rewrite the C program to run in parallel
(Threads).
4. Difference B/W Single CPU and Multi-CPU
Hardware
Use of Hardware Caches.
Caches are small, fast memories that hold copies of popular data.
5. Temporal locality and spatial locality
Temporal locality is that when a piece of data is accessed, it is likely to be
accessed again in the near future. E.g. Loop
Spatial locality is that if a program accesses a data item at address x, it is likely
to access data items near x as well. E.g. Arrays
7. Bus Snooping
Each cache pays attention to memory updates by observing the bus that
connects them to main memory.
it will notice the change.
Then it will remove it from its cache or it will update the data.
8. Locking
In this case, allocating a simple mutex (e.g., pthread mutex tm;)
and then adding a lock at the beginning of the routine and an
unlock at the end will solve the problem, ensuring that the code will
execute as desired.
9. Cache Affinity
One process is running on CPU1 and then terminates and wants to run again it will
run fast on CPU!.
But if this process will run on diff processor every time then performance of this
process will be worse because each time it has to reload state each time.
10. SQMS
Single Queue Multiprocessor Scheduling.
Reuse the basic framework for single processor scheduling, by putting all jobs that
need to be scheduled into a single queue.
13. Multi-Queue Scheduling
Problems caused in single-queue schedulers, some systems opt for multiple
queues, e.g., one per CPU.
By using RR system will behave like this
14. MQS Drawback and Solution
What if A and C finishes ealrly?
Solution:
Migration is the only option to overcome this drawback.
15. Linux Multiprocessor Schedulers
O(1) scheduler.
Completely Fair Scheduler (CFS).
BF Scheduler (BFS).
Both O(1) and CFS use multiple queues, whereas BFS uses a single queue,