CS 134: Operating Systems: Multiprocessing
CS 134: Operating Systems: Multiprocessing
2013-05-17
CS 134:
Operating Systems
Multiprocessing
CS 134:
Operating Systems
Multiprocessing
1 / 13
Overview CS34 Overview
2013-05-17
Multiprocessing Designs
OS Implications
Other Issues
Multiprocessing Designs
OS Implications
Programming Models
Other Issues
2 / 13
Multiprocessing Designs
2013-05-17
Multiprocessing Designs Multiple CPUs come in several flavors:
3 / 13
Multiprocessing Designs
2013-05-17
Multiprocessing Designs MIMD can be:
I Several chips or cores, (semi-)private memories, able to
access each other’s memory (NUMA—Non-Uniform Memory
Access)
4 / 13
OS Implications
2013-05-17
OS Implications
NUMA means processes access local memory faster
⇒ Allocate process memory on local CPU
5 / 13
OS Implications
2013-05-17
OS Implications SMPs still have caches
SMP Issues I Processor 1 reads lock from own cache, sees it’s still zero. . .
6 / 13
OS Implications
2013-05-17
OS Implications
Threads are often related
I Schedule independently or together?
I Completely independent: job completion is slowest thread
SMP Scheduling I
I
Together: some CPUs may be wasted on waiting for events
Always good to keep thread x on same CPU (because cache
is filled)
7 / 13
OS Implications
2013-05-17
OS Implications Many ways to communicate
Distributed Systems
8 / 13
OS Implications
2013-05-17
OS Implications Many ways to communicate
Distributed Systems
8 / 13
OS Implications
2013-05-17
OS Implications Many ways to communicate
Distributed Systems I
I
Can’t move process to other machine (or must work hard)
Locking becomes really hard
I Programming multiprocessor systems is much harder
8 / 13
OS Implications
2013-05-17
OS Implications Many ways to communicate
Distributed Systems I
I
Can’t move process to other machine (or must work hard)
Locking becomes really hard
I Programming multiprocessor systems is much harder
I . . . and what if network connection goes down?
8 / 13
Programming Models
2013-05-17
Programming Models Programming is hard, so need abstractions that simplify things
Class Exercise
Programming is hard, so need abstractions that simplify things What are the advantages and disadvantages?
Class Exercise
What are the advantages and disadvantages?
9 / 13
Programming Models
2013-05-17
Programming Models
RPC is nice, but limits parallelism
SMPs can do cool things because memory is shared
10 / 13
Other Issues
2013-05-17
Other Issues Suppose you have servers A, B, C, and D
A and B are currently overloaded, C and D underloaded
A notices the situation and sends excess work to C and D
Simultaneously, B does the same! Now C and D are overloaded
Load Balancing Result can be thrashing
Suppose you have servers A, B, C, and D Random assignment works surprisingly well.
A and B are currently overloaded, C and D underloaded
A notices the situation and sends excess work to C and D
Simultaneously, B does the same! Now C and D are overloaded
11 / 13
Other Issues
2013-05-17
Other Issues Well, it’s a secret. . .
Solution: DNS Round Robin tricks you into picking one of many
dozens of front ends (roughly at random) to talk to
Solution: DNS Round Robin tricks you into picking one of many
dozens of front ends (roughly at random) to talk to
12 / 13
Other Issues
2013-05-17
These commands were run within 15 seconds of each other:
13 / 13