Lecture3 Os Support
Lecture3 Os Support
CMPT 431
Dr. Alexandra Fedorova
A process directly
interacts with the OS via
system calls
Example: a web browser,
a web server
system
calls
OS
Middleware
system
calls
A process directly
interacts with the OS via
a middleware layer
A middleware layer
directly interacts with
the OS
Example: a peer-to-peer
file system implemented
over a distributed hash
table
OS
DS
component
Digression: Protection
Implementation In the Kernel
System calls are expensive
Why? Protection domains
Refresh memory protection from your
OS class
Good thing: we get memory protection
Bad thing: crossing protection domains
is expensive. Why?
So is this the best solution?
CMPT 431 A. Fedorova
Single
thread
1
request
Multip
le
thread
s
1.6
requests
10
Be scalable
Balance the load well
Ensure good interactive response
Keep context switches to a minimum (why?)
11
12
Runqueues in Solaris
Global kernel
priority queue
kpqueue
User priority
queues for CPU0
disp_qs
Pri
0
Pri
1
Pri
N
User priority
queues for CPU1
disp_qs
Pri
0
Pri
1
Pri
N
13
14
15
16
Time-Sharing Scheduler:
Answers
Minimizing context switch costs:
CPU-bound threads stay on CPU longer without a context switch
In compensation, they are scheduled less often, due to decreased
priority
Reducing the number of context switches improves performance
17
18
Thread Synchronization
19
Next
Talk about synchronization
Operating system support for efficient
synchronization
Transactional memory new
programming paradigm for efficient
synchronization
20