CSC 660: Advanced OS
CSC 660: Advanced Operating Systems Slide #1
1. What is a microkernel?
2. Mach and L4
3. Microkernel IPC
4. Microkernel Memory Management
5. Userspace Device Drivers
CSC 660: Advanced Operating Systems Slide #2
What is a Microkernel?
Kernel with minimal features
Interprocess communication (IPC)
Other OS features run as user-space servers.
CSC 660: Advanced Operating Systems Slide #3
Example Microkernel Architecture:
CSC 660: Advanced Operating Systems Slide #4
A concept is tolerated inside the microkernel
only if moving it outside the kernel, i.e.,
permitting competing implementations would
prevent the implementation of the systems'
- Jochen Liedtke
CSC 660: Advanced Operating Systems Slide #5
Why use Microkernels?
Flexibility: can implement competing versions
of key OS features, like filesystem or paging,
for best performance with applications.
Safety: server malfunction restricted to that
server (even drivers), not affecting rest of OS.
Modularity: fewer interdepencies and a smaller
trusted computing base (TCB).
CSC 660: Advanced Operating Systems Slide #6
First generation microkernel.
Runs OS personality on top of microkernel.
Tasks and Threads (kernel provides scheduling)
Messages (instead of system calls)
Memory Objects (allow userspace paging)
CSC 660: Advanced Operating Systems Slide #7
Task: unit of execution consisting of an address
space, ports, and threads.
Thread: basic unit of execution, shares address space,
ports with other threads in task.
Port: communication channel used to send messages
between tasks. Tasks must have correct port rights
to send message to a task.
Message: basic unit of communication consisting of a
typed set of data objects.
Memory Object: source of memory tasks can map
into their address space; includes files and pipes.
CSC 660: Advanced Operating Systems Slide #8
Mach Threads and Messages
• Threads have
• Send messages to
ports instead of
• Task must have
port rights to
send message to
CSC 660: Advanced Operating Systems Slide #9
Message passing instead of system calls.
Provide uniform interface to kernel.
Can extend messages w/o recompiling kernel.
Different tasks can use different pagers.
Multiprocessor / distributed OS.
Ports can reside on system across network.
Message passing works identically across
network as on local system with NetMsgServer
forwarding messages across network.
CSC 660: Advanced Operating Systems Slide #10
System calls take 5-6X as long as UNIX.
Uses pointers, copy-on-write, and memory
mapping to avoid unnecessary copies.
Port rights checks are expensive.
Pageout kernel thread determines system paging
policy (which pages are paged out to disk.)
Pager servers handle actual writing.
CSC 660: Advanced Operating Systems Slide #11
• Second generation microkernel.
– IPC is about 10X faster than Mach.
– IPC security checks moved to user space
processes if needed.
– L4 is 12KB. Compare to Mach 3 (330KB)
– Memory management policy moved entirely to
CSC 660: Advanced Operating Systems Slide #12
Uniform way to handle kernel interactions.
Most performance critical component.
All interactions require 2 IPCs: request, response.
Hand-off scheduling: CPU control may be
transferred with message so recipient can respond
without waiting to be rescheduled.
CSC 660: Advanced Operating Systems Slide #13
Handle Interrupts as IPC
Microkernel captures interrupts.
Forwards interrupts to process as IPC.
CSC 660: Advanced Operating Systems Slide #14
Microkernel forwards page fault to a pager server.
Kernel or server decides which pages need to be
written to disk in low memory situations.
Pager server handles writing pages to disk.
CSC 660: Advanced Operating Systems Slide #15
Recursive Address Spaces (L4)
• Initial address space controlled by first process.
– Controls all available memory.
– Other address spaces empty at boot.
• Other processes obtain memory pages from first or
from their other processes that got pages from first.
• Why is memory manager flexibility useful?
– Different applications: real-time, multimedia, disk cache.
CSC 660: Advanced Operating Systems Slide #16
Constructing Address Spaces
grant: remove page from your address space and give
to another consenting process.
map: share page with another process.
demap: remove page from all other processes that
received it directly or indirectly from demapper.
CSC 660: Advanced Operating Systems Slide #17
User Space Device Driver
How do they work?
Receive interrupts as IPC.
I/O ports mapped to user address space.
Device drivers have 3-7X bugs as kernel code.
User space driver bugs don’t reduce reliability.
User space driver bugs don’t reduce security.
CSC 660: Advanced Operating Systems Slide #18
User Space Device Driver
wait for (msg, sender)
if sender = my hw interrupt
read/write i/o ports
reset hw interrupt
CSC 660: Advanced Operating Systems Slide #19
Problem: Most kernel bugs in device drivers.
Drivers written by less experienced programmers.
Drivers are tested less than core kernel code.
Solution: Lightweight protection domains.
Kernel-mode env w/ restricted mem write access.
Isolate drivers from kernel code.
CSC 660: Advanced Operating Systems Slide #20
1. Isolation: Isolate kernel from extension failures.
2. Recovery: Automatic recovery after extension
failure so applications can continue execution.
3. Backwards compatibility: Extensions should not
have to be rewritten to use Nooks.
CSC 660: Advanced Operating Systems Slide #21
CSC 660: Advanced Operating Systems Slide #22
Problem with traditional OS
Most resource management decisions made once
in a global fashion.
• Let programmers make resource management
decisions when they write their applications.
• Allows experimentation.
• Allows for high performance for applications
that don’t fit OS assumptions, e.g. RDBMS.
CSC 660: Advanced Operating Systems Slide #23
What makes Exokernels Different?
• Separate security from abstraction.
– ex: Protect disk blocks not files.
• Exokernel securely multiplexes hardware.
• Move abstractions into userspace libraries
called library operating systems (libOSes.)
• Exokernels vs Microkernels
– Microkernel concerned with implementing
kernel in user space rather than kernel space.
– Exokernel concerned with separating security
from abstraction to give applications control.
CSC 660: Advanced Operating Systems Slide #24
Applications on an Exokernel
CSC 660: Advanced Operating Systems Slide #25
1. Tracking ownership of resources.
2. Performing access control by guarding all
usage or binding points.
3. Revoking access to resources.
CSC 660: Advanced Operating Systems Slide #26
– Most OSes deallocate memory, CPU without
– Exokernels visibly request that a resource be returned to
– Ex: Exokernel informs app that CPU is revoked at end of
time slice, and app responds by saving required
– If application does not return resource, exokernel will
take it from the application.
CSC 660: Advanced Operating Systems Slide #27
Aegis/ExOS vs Ultrix performance
System calls 10X faster.
IPC 10-20+X faster.
Virtual memory1-5X faster.
OS syscall matrix pipe lrpc
Aegis 2.9 5.2s 22.6 10.4
Ultrix 33.7 5.2s 231 457
CSC 660: Advanced Operating Systems Slide #28
Cheetah Web Server
Exokernel web server performance features:
– Transmits data directly from page cache w/o copying.
– Colocates hyperlinked files within filesystem.
– Network stack tuned to reduce packets by 20%.
CSC 660: Advanced Operating Systems Slide #29
Apps that directly use exokernel aren’t
portable to different architectures.
Exokernel tied closely to hardware.
Library operating systems can provide
portability for other applications.
LibOSes can provide POSIX interface.
Can run multiple LibOSes on exokernel.
CSC 660: Advanced Operating Systems Slide #30
Microkernels in Use
Underlying microkernel for UNIX systems.
Examples: Mac OS X, MkLinux, NeXTStep
POSIX-compliant real-time OS for embedded sys.
Fits on a single floppy.
Underlying microkernel for Cisco IOS XR.
Microkernel OS for cell phones.
CSC 660: Advanced Operating Systems Slide #31
1. Microkernel provides minimal features
1. Address spaces
2. Microkernel advantages
3. Early microkernels were slow, but flexible memory/disk
policies can allow for superior application performance.
4. Exokernels focus on separation of protection from
abstraction instead of focusing on user/kernel divide.
CSC 660: Advanced Operating Systems Slide #32
1. Dawson R. Engler, M. Frans Kaashoek, James O'Toole Jr., “Exokernel: An Operating System
Architecture for Application-Level Resource Management,” Proc 15th Symposium on Operating
Systems Principles (SOSP), December 1995.
2. David Golub, Randall Dean, Alessandro Forin, Richard Rashid, “UNIX as an Application Program,”
Proceedings of the Summer 1990 USENIX Conference, pages 87-95, June 1990.
3. Per Brinch Hansen. “The Nucleus of a Multiprogramming System,” Communications of the ACM
13(4):238-241, http://brinch-hansen.net/papers/1970a.pdf, April 1970.
4. Hermann Härtig, Michael Hohmuth, Jochen Liedtke, Sebastian Schönberg, “The performance of μ-
kernel-based systems”. Proc. 16th ACM symposium on Operating Systems Principles (SOSP), 1997.
5. Jochen Liedtke. “On µ-Kernel Construction,” Proc. 15th ACM Symposium on Operating System
Principles (SOSP), December 1995
6. Jochen Liedtke, “Towards Real Microkernels,” Communications of the ACM, 39(9):70-77,
7. Avi Silberchatz et. al., Operating System Concepts, 7th edition, http://codex.cs.yale.edu/avi/os-
8. Michael M. Swift, Brian N. Bershad, and Henry M. Levy, “Improving the Reliability of Commodity
Operating Systems,” Proc. 19th ACM Symposium on Operating System Principles (SOSP), Oct.
9. Andrew S. Tanenbaum, Modern Operating Systems, 3rd edition, Prentice-Hall, 2005.
10. Andrew S. Tanenbaum, J. Herder, and H. Bos. “Can We Make Operating Systems Reliable and
Secure?” IEEE Computer, May 2006.
11. Andrew S. Tanenbaum, J. Herder, and H. Bos. “A Lightweight Method for Building Reliable
Operating Systems Despite Unreliable Device Drivers,” TR IR-CS-018,
12. Andrew S. Tannenbaum, “Tanenbaum-Torvalds Debate: Part II,” http://www.cs.vu.nl/~ast/reliable-
CSC 660: Advanced Operating Systems Slide #33