Operating System Kernels Presenter: Saikat Guha Cornell University - - PowerPoint PPT Presentation

operating system kernels
SMART_READER_LITE
LIVE PREVIEW

Operating System Kernels Presenter: Saikat Guha Cornell University - - PowerPoint PPT Presentation

Operating System Kernels Presenter: Saikat Guha Cornell University CS 614, Fall 2005 Operating System Kernels CS 614, Fall 2005 Operating Systems Initially, the OS was a run-time library Batch (5565): Resident, spooled jobs


slide-1
SLIDE 1

Operating System Kernels

Presenter: Saikat Guha

Cornell University

CS 614, Fall 2005

Operating System Kernels CS 614, Fall 2005

slide-2
SLIDE 2

Operating Systems

◮ Initially, the OS was a run-time library ◮ Batch (’55–’65): Resident, spooled jobs ◮ Multiprogrammed (late ’60): Multiple jobs ◮ Time-sharing (’70s): Interactive jobs

◮ Multics, UNIX

◮ Networked OS, Distributed OS, Parallel OS,

Real-time OS

Operating System Kernels CS 614, Fall 2005

slide-3
SLIDE 3

UNIX

◮ THE operating system

◮ Dennis Ritchie, Ken Thompson at AT&T

◮ “File” Abstraction ◮ Kernel

◮ Processes, IPC ◮ Filesystem ◮ Networking (eventually) ◮ Graphics (Windows)

◮ Userspace

◮ Shell ◮ Commands Operating System Kernels CS 614, Fall 2005

slide-4
SLIDE 4

Operating Systems

Process 1 Process 2 Process 3 Process 4 Process 5 Kernel Hardware

User-Kernel Split

Operating System Kernels CS 614, Fall 2005

slide-5
SLIDE 5

Operating Systems

Process 1 Process 2 Process 3 Process 4 Process 5 Kernel Hardware Filesystem Pipe

Monolothic Kernel

Operating System Kernels CS 614, Fall 2005

slide-6
SLIDE 6

Operating Systems

Process 1 Process 2 Process 3 Filesystem Network Kernel Hardware IPC

Microkernel

Operating System Kernels CS 614, Fall 2005

slide-7
SLIDE 7

µ-Kernels

◮ Minimal services ◮ Usually threads or processes, address space and

inter-process communication (IPC)

◮ User-space Filesystem, Network, Graphics, even

device drivers sometimes.

Operating System Kernels CS 614, Fall 2005

slide-8
SLIDE 8

Monolithic Kernels: Advantages

◮ Kernel has access to everything

◮ All optimizations possible ◮ All techniques/mechanisms/concepts can be

implemented

◮ Extended by simply adding more code

◮ Linux at 3.3M lines of code

◮ Tackle complexity

◮ Layered kernels ◮ Modular kernels ◮ Object oriented kernels. Do C++, Java, C# help? Operating System Kernels CS 614, Fall 2005

slide-9
SLIDE 9

µ-Kernels: Advantages

◮ Minimal

◮ Smaller trusted base ◮ Less error prone ◮ Server malfunction easily isolated

◮ Elegant

◮ Enforces modularity ◮ Restartable user-level services

◮ Extensible

◮ Different servers/API can coexist Operating System Kernels CS 614, Fall 2005

slide-10
SLIDE 10

µ-Kernels

◮ 1st generation µ-kernels

◮ Mach (CMU)1 ◮ Chorus (Inria, Chorus systems) ◮ Amoeba (Vrije University) ◮ L3 (GMD)2

1External pager 2User-Level Driver

Operating System Kernels CS 614, Fall 2005

slide-11
SLIDE 11

µ-Kernels: Problems

◮ Overheads

◮ Chen and Bershad, ’93 ◮ Impact of caches, locality, TLB collisions ◮ Up 66% degradation in Mach

◮ Co-located servers for performance ◮ Can be optimized to be fast on an architecture

◮ But, performance not preserved on other

architectures

Operating System Kernels CS 614, Fall 2005

slide-12
SLIDE 12

µ-Kernels

◮ 2nd generation µ-kernels

◮ Spin (UWash) ◮ Exokernel (MIT) ◮ L4 (GMD/IBM/UKa)3

3User-Level Address Space

Operating System Kernels CS 614, Fall 2005

slide-13
SLIDE 13

Summary of First Paper

◮ The Performance of µ-Kernel-Based Systems

(H¨ artig et al., SOSP ’97)

◮ Evaluates a L4 µ-kernel based system ◮ Ports Linux to run on top of L4 ◮ Suggests improvements

Operating System Kernels CS 614, Fall 2005

slide-14
SLIDE 14

L4-Linux

Process 1 Process 2 Process 3 Linux L4 Kernel Hardware L4 Backend filesystem network

L4-Linux

Operating System Kernels CS 614, Fall 2005

slide-15
SLIDE 15

L4-Linux

◮ 2 basic concepts

◮ Threads ◮ Address Spaces (AS)

◮ Recursive construction of AS

◮ Grant - Give a page to another AS ◮ Map - Share a page with another AS ◮ Demap - Revoke a mapped or granted page

◮ I/O ports treated as AS ◮ Hardware interrupts treated as IPC

Operating System Kernels CS 614, Fall 2005

slide-16
SLIDE 16

L4-Linux

◮ TLB caches page-table lookups

◮ Flused during context switch ◮ Flushing not necessary for tagged TLBs

◮ L4-Linux avoids frequent flushes

◮ Pentium CPU’s emulate tagged TLBs for small

address spaces

◮ syscall time

◮ Unix – 20µs ◮ Mach – 114µs ◮ L4 – 5µs Operating System Kernels CS 614, Fall 2005

slide-17
SLIDE 17

Performance

Is L4-Linux a practical system?

Operating System Kernels CS 614, Fall 2005

slide-18
SLIDE 18

Performance

Is L4-Linux a practical system? Yes

Operating System Kernels CS 614, Fall 2005

slide-19
SLIDE 19

Performance

Is L4-Linux a practical system? Yes

Operating System Kernels CS 614, Fall 2005

slide-20
SLIDE 20

Performance

◮ L4 incurs 5%–10% overhead ◮ Collocation alone does not solve performance

problems

◮ What about L4 without collocation?

◮ L4-Linux is proof-of-concept

◮ Pipes can be made faster ◮ Better VM in non-legacy mode ◮ Can benefit from cache partitioning Operating System Kernels CS 614, Fall 2005

slide-21
SLIDE 21

Comparison

L4-Linux

◮ Highly optimized

(for x86)

◮ Functionality

limited by Linux

◮ Untrusted

components isolated Flux OSKit

◮ Tons of

functionality

(Linux, BSD, Java, SML, ...)

◮ Not tuned for high

performance

◮ Implementation

details exposed

Operating System Kernels CS 614, Fall 2005

slide-22
SLIDE 22

Flux OSKit

◮ Framework and reusable OS components ◮ Focus on component of research-interest ◮ Reuse other existing components for

functionality

Operating System Kernels CS 614, Fall 2005

slide-23
SLIDE 23

Flux OSKit

Flux OSKit Components

Operating System Kernels CS 614, Fall 2005

slide-24
SLIDE 24

Flux OSKit

◮ Bootloader

◮ Multiboot compliant

◮ Kernel Support Library

◮ Architecture specific

◮ Memory Management Library

◮ kmalloc(), alignment etc.

◮ Minimal libc

◮ non-buffered read(), write() etc. ◮ minimizes dependencies Operating System Kernels CS 614, Fall 2005

slide-25
SLIDE 25

Flux OSKit

◮ Debugging Support

◮ GDB over serial line

◮ Device Driver Support

◮ Drivers from Linux, FreeBSD inside wrappers

◮ Protocol Stacks

◮ “Wrapped” FreeBSD network stack

◮ File System

◮ “Wrapped” NetBSD code Operating System Kernels CS 614, Fall 2005

slide-26
SLIDE 26

Flux OSKit

◮ OSKit components are separable, no

dependence

◮ Other OS: Modularity does not imply independence

{ ... malloc() ... } void *malloc() { ... } Filesystem Memory Manager

{ ... malloc() ... } void *malloc() { ... } void *malloc() { c_malloc(); } void *my_malloc() { malloc(); } ... c_malloc = my_malloc ... Filesystem Memory Manager

Very little overhead

◮ Provides abstractions ◮ Doesn’t hide implementation

Operating System Kernels CS 614, Fall 2005

slide-27
SLIDE 27

Case Studies

◮ ML/OS

◮ SML: Static Typing, Concurrency through

continuations, No stack, Aggressive heap usage, Interpreted.

◮ ML/OS: 2 people, one semester using OSKit

◮ Java

◮ Existing JVM ◮ Java/OS: 3 weeks using OSKit

◮ SR

◮ Concurrent programming language Operating System Kernels CS 614, Fall 2005

slide-28
SLIDE 28

Summary

◮ L4-Linux: µ-Kernels can be fast

◮ Full system binary-compatible with Linux runs

5%–10% slower.

◮ FluxOSKit: Kernels from reusable components

◮ Write fully-functional research OS in weeks Operating System Kernels CS 614, Fall 2005