Operating System Structure

Similar documents
Operating System Structure

Operating System Structure

OS DESIGN PATTERNS II. CS124 Operating Systems Fall , Lecture 4

Operating System Kernels

OS Extensibility: SPIN and Exokernels. Robert Grimm New York University

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Operating System Architecture. CS3026 Operating Systems Lecture 03

OS concepts and structure. q OS components & interconnects q Structuring OSs q Next time: Processes

SPIN Operating System

Real Time and Embedded Systems. by Dr. Lesley Shannon Course Website:

Kernel Types Simple OS Examples System Calls. Operating Systems. Autumn CS4023

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

Cute Tricks with Virtual Memory

OS Design Approaches. Roadmap. OS Design Approaches. Tevfik Koşar. Operating System Design and Implementation

OS Structure. Kevin Webb Swarthmore College January 25, Relevant xkcd:

OS Extensibility: Spin, Exo-kernel and L4

OS structure. Process management. Major OS components. CSE 451: Operating Systems Spring Module 3 Operating System Components and Structure

Introduction: Context Switch

Design Overview of the FreeBSD Kernel CIS 657

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter

Advanced Operating Systems. COMP9242 Introduction

Staff. Advanced Operating Systems. Why are you here? What can you expect?

ADVANCED OPERATING SYSTEMS USB in a microkernel based operating system

IO-Lite: A Unified I/O Buffering and Caching System

CSC Operating Systems Fall Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. August 27 th, 2009.

Staff. Advanced Operating Systems. Why are you here? What can you expect?

Announcements. Computer System Organization. Roadmap. Major OS Components. Processes. Tevfik Ko!ar. CSC Operating Systems Fall 2009

Advanced Operating Systems. COMP9242 Introduction

Lecture 7. Architectural Patterns: Layers, Façade, Microkernel, Design Pattern: Strategy

19: I/O. Mark Handley. Direct Memory Access (DMA)

Microkernel Construction. Introduction. Michael Hohmuth. Lars Reuther. TU Dresden Operating Systems Group

Operating System. Operating System Overview. Structure of a Computer System. Structure of a Computer System. Structure of a Computer System

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

L4/Darwin: Evolving UNIX. Charles Gray Research Engineer, National ICT Australia

Extensibility, Safety, and Performance in the Spin Operating System

Distributed File Systems Issues. NFS (Network File System) AFS: Namespace. The Andrew File System (AFS) Operating Systems 11/19/2012 CSC 256/456 1

What are some common categories of system calls? What are common ways of structuring an OS? What are the principles behind OS design and

Chapter 2. Operating-System Structures

Fall 2014:: CSE 506:: Section 2 (PhD) Threading. Nima Honarmand (Based on slides by Don Porter and Mike Ferdman)

MICROKERNELS: MACH AND L4

MODERN SYSTEMS: EXTENSIBLE KERNELS AND CONTAINERS

Processes & Threads. Process Management. Managing Concurrency in Computer Systems. The Process. What s in a Process?

CHAPTER 2: SYSTEM STRUCTURES. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Microkernels and Client- Server Architectures

Processes and Threads

Four Components of a Computer System

Architectural Support for Operating Systems. Jinkyu Jeong ( Computer Systems Laboratory Sungkyunkwan University

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - II OS Structures. University at Buffalo. OS Design and Implementation

OS Design Approaches. Roadmap. System Calls. Tevfik Koşar. Operating System Design and Implementation. CSE 421/521 - Operating Systems Fall 2013

The Exokernel Or, How I Learned to Stop Worrying and Hate Operating System Abstractions. Dawson Engler, M. Frans Kaashoek, et al

Networking Performance for Microkernels. Chris Maeda. Carnegie Mellon University. Pittsburgh, PA March 17, 1992

Chapter 2: Operating-System Structures

Unit 2 : Computer and Operating System Structure

Disco. CS380L: Mike Dahlin. September 13, This week: Disco and Exokernel. One lesson: If at first you don t succeed, try try again.

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?

CSC 256/456: Operating Systems. Introduction. John Criswell! University of Rochester

Exokernel Engler, Kaashoek etc. advantage: fault isolation slow (kernel crossings)

Virtual Machines Disco and Xen (Lecture 10, cs262a) Ion Stoica & Ali Ghodsi UC Berkeley February 26, 2018

CSC Operating Systems Spring Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. January 17 th, 2007.

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems

Announcements. Operating System Structure. Roadmap. Operating System Structure. Multitasking Example. Tevfik Ko!ar

Mach External pager. IPC Costs. Why the difference? Example of IPC Performance. First generation microkernels were slow Mach, Chorus, Amoeba

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edition

Operating System Services. User Services. System Operation Services. User Operating System Interface - CLI. A View of Operating System Services

What s in a process?

Lecture 15 Designing Trusted Operating Systems

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edit9on

Background: I/O Concurrency

Design Issues 1 / 36. Local versus Global Allocation. Choosing

CS 550 Operating Systems Spring Operating Systems Overview

Threads. Raju Pandey Department of Computer Sciences University of California, Davis Spring 2011

Basic Concepts & OS History

Threads. Computer Systems. 5/12/2009 cse threads Perkins, DW Johnson and University of Washington 1

Chapter 2: Operating-System Structures. Operating System Concepts 8 th Edition

Processes and Threads

Background: Operating Systems

Lecture 3: O/S Organization. plan: O/S organization processes isolation

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Operating System Security, Continued CS 136 Computer Security Peter Reiher January 29, 2008

Networks and distributed computing

CS-736 Midterm: Beyond Compare (Spring 2008)

CSC 369H1S. Operating Systems Spring 2007 Professor Angela Demke Brown U of T

Chapter 4: Multithreaded Programming. Operating System Concepts 8 th Edition,

Microkernels. Overview. Required reading: Improving IPC by kernel design

24-vm.txt Mon Nov 21 22:13: Notes on Virtual Machines , Fall 2011 Carnegie Mellon University Randal E. Bryant.

Contents. 1.1 What Operating Systems Do Computer-System Organization Computer-System Architecture 12. Operating-System Structures

What s in a traditional process? Concurrency/Parallelism. What s needed? CSE 451: Operating Systems Autumn 2012

VM and I/O. IO-Lite: A Unified I/O Buffering and Caching System. Vivek S. Pai, Peter Druschel, Willy Zwaenepoel

Processes & Threads. Recap of the Last Class. Layered Structure. Virtual Machines. CS 256/456 Dept. of Computer Science, University of Rochester

Often, more information is required when designing system call Information varies according to OS and types of system call

Extensible Kernels: Exokernel and SPIN

Input / Output. Kevin Webb Swarthmore College April 12, 2018

Operating-System Structures

Topics. Operating System. What is an Operating System? Let s Get Started! What is an Operating System? Where in the Book are we?

Chapter 2: Operating-System Structures. Operating System Concepts Essentials 8 th Edition

The OS and Multitasking: An Example

Chapter 4: Threads. Chapter 4: Threads

Yi Shi Fall 2017 Xi an Jiaotong University

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Operating Systems History & Approaches. Computer Systems Laboratory Sungkyunkwan University

Transcription:

Operating System Structure Joey Echeverria joey42+os@gmail.com December 6, 2004 Carnegie Mellon University: 15-410 Fall 2004

Overview Motivations Kernel Structures Monolithic Kernels Open Systems Microkernels Kernel Extensions Exokernels Final Thoughts Carnegie Mellon University: 15-410 Fall 2004 2

Motivations Operating systems have a hard job. Operating systems are: Abstraction layers Resource allocators Protection boundaries Resource Schedulers Complicated Carnegie Mellon University: 15-410 Fall 2004 3

Motivations Abstraction Layer Operating systems present a simplified view of hardware Applications see a well defined interface (system calls) Resource Allocator Operating systems allocate hardware resources to processes memory network disk space CPU time I/O devices Carnegie Mellon University: 15-410 Fall 2004 4

Motivations Protection Boundaries Operating systems protect processes from each other and itself from process. Note: Everyone trusts the kernel. Resource Schedulers Operating systems schedule access to resources. e.g., process scheduling, disk scheduling, etc. Complicated See Project 3 :) Carnegie Mellon University: 15-410 Fall 2004 5

Monolithic Kernels Apache libc libpthread Mozilla libc libpthread libc Emacs Kernel CPU Scheduling Interprocess Communication Networking File System Virtual Memory Security CPU Network Memory Disk Carnegie Mellon University: 15-410 Fall 2004 6

Monolithic Kernels You ve seen this before. The kernel is all in one place with no protection between components. See Project 3 :) Applications use a well-defined system call interface to interact with the kernel. Examples: UNIX, Mac OS X, Windows NT/XP, Linux, BSD, i.e., common Carnegie Mellon University: 15-410 Fall 2004 7

Monolithic Kernels Advantages: Well understood Good performance High level of protection between applications Disadvantages: No protection between kernel components Not extensible Overall structure is complicated Everything is intermixed There aren t clear boundaries between modules Carnegie Mellon University: 15-410 Fall 2004 8

Open Systems Mozilla libpthread Kernel and Applications Apache Emacs libc Interprocess Communication Networking File System Virtual Memory CPU Network Memory Disk Carnegie Mellon University: 15-410 Fall 2004 9

Open Systems Applications, libraries, and kernel all sit in the same address space Does anyone actually do this craziness? MS-DOS Mac OS 9 and prior Windows ME, 98, 95, 3.1, etc. Palm OS Some embedded systems Used to be very common Carnegie Mellon University: 15-410 Fall 2004 10

Open Systems Advantages: Very good performance Very extensible Undocumented Windows, Schulman et al. 1992 In the case of Mac OS and Palm OS there s an extensions industry Can work well in practice Disadvantages: No protection between kernel and/or applications Not particularly stable Composing extensions can result in unpredictable results Carnegie Mellon University: 15-410 Fall 2004 11

Microkernels Mozilla libc libpthread Networking Apache libc libpthread Emacs libc Processes Virtual Memory File System Microkernel Interprocess Communication CPU Scheduling CPU Network Memory Security Disk Carnegie Mellon University: 15-410 Fall 2004 12

Microkernels Replace the monolithic kernel with a small, clean, logical set of abstractions. Tasks and Threads Virtual Memory Interprocess Communication Move the rest of the OS into server processes Examples: Mach, Chorus, QNX, GNU/Hurd Mixed results: QNX commercially successful in the embedded space, microkernels are mostly nonexistent elsewhere Carnegie Mellon University: 15-410 Fall 2004 13

Microkernels Advantages: Extensible: just add a new server to extend the OS Operating system agnostic: Support of operating system personalities Have a server for each system (Mac, Windows, UNIX) All applications can run on the same kernel IBM Workplace OS one kernel for OS/2, OS/400, and AIX based on Mach 3.0 failure Carnegie Mellon University: 15-410 Fall 2004 14

Microkernels Advantages: Mostly hardware agnostic Threads and IPC don t care about the details of the underlying hardware. Strong security, the operating system is protected even from itself. Naturally extended to distributed systems. Carnegie Mellon University: 15-410 Fall 2004 15

Microkernels Disadvantages: Performance System calls can require a large number of protection mode changes. Mach frequently criticized for its performance. Is this really an issue? Expensive to re-implement everything using a new model Carnegie Mellon University: 15-410 Fall 2004 16

Mach Started as a project at CMU (based on RIG project from Rochester) Plan 1. Proof of concept Take BSD 4.1, fix parts like VM, user visible kernel threads, IPC 2. Microkernel and a single-server Take the kernel and saw in half 3. Microkernel and multiple servers (FS, paging, network, etc.) Servers glued together by OS personality modules which catch syscalls Carnegie Mellon University: 15-410 Fall 2004 17

Mach What actually happened: 1. Proof of concept Completed in 1989 Unix: SMP, kernel threads, 5 architectures Commercial deployment: Encore Multimax, Convex Exemplar (SPP- UX), OSF/1 Avie Tevanian took this to NeXT: NeXTStep OS X 2. Microkernel and a single-server Completed, deployed to 10 s of machines (everybody graduated) 3. Microkernel and multiple servers (FS, paging, network, etc.) Never really completed (everybody graduated) Carnegie Mellon University: 15-410 Fall 2004 18

Microkernel Performance Mach was never aggressively tuned in the desktop/server context. Is it fair to compare Mach to monolithic kernels? QNX is at least strong enough to be competitive with other real-time operating systems, such as VxWorks. The literature has between 5 and 50 percent performance overhead for microkernels. Summary: Still up in the air. Carnegie Mellon University: 15-410 Fall 2004 19

GNU Hurd Hurd stands for Hird of Unix-Replacing Daemons and Hird stands for Hurd of Interfaces Representing Depth GNU Hurd is the FSF s kernel Work began in 1990 on the kernel, has run on 10 s of machines Ready for mass deployment Real Soon Now Carnegie Mellon University: 15-410 Fall 2004 20

Kernel Extensions Apache Mozilla Emacs libc libpthread libc libpthread libc Custom FS Fast Sockets FS and Sockets User Kernel Extensions Kernel File System Networking Default Services CPU Scheduler VM IPC Security Core Services CPU Memory Network Disk Carnegie Mellon University: 15-410 Fall 2004 21

Kernel Extensions Two related ideas: old way and new way Old way: System administrator adds a new module to an existing kernel This can be hot or may require a reboot: no compiling VMS, Windows NT, Linux, BSD, Mac OS X Safe? of course Carnegie Mellon University: 15-410 Fall 2004 22

Kernel Extensions New way: Allow users to download enhancements into the kernel This can be done with compiler safety (Spin: Modula-3) or proof-carrying code (PCC) Spin (University of Washington), Proof-carrying code (CMU) Safe? Guaranteed Carnegie Mellon University: 15-410 Fall 2004 23

Kernel Extensions Advantages: Extensible, just add a new extension. Safe (New way) Good performance because everything is in the kernel. Disadvantages: Rely on compilers, PCC proof checker, head of project, etc., for safety. Constrained implementation language on systems like Spin The old way doesn t give safety, but does give extensibility Carnegie Mellon University: 15-410 Fall 2004 24

Pause So far we ve really just moved things around There is still a VM system, file system, IPC, etc. Why should I trust the kernel to give me a filesystem that is good for me? Best performance for small, big, mutable, and static files. The right ACL model. Let s try something different. Carnegie Mellon University: 15-410 Fall 2004 25

Exokernels Apache Fast Sockets FS VM Mozilla Fast Sockets VM Emacs libposix Exokernel TLB Protection CPU Scheduler CPU Memory Network Disk Carnegie Mellon University: 15-410 Fall 2004 26

Exokernels Basic idea: Take the operating system out of the kernel and put it into libraries Why? Applications know better how to manage active hardware resources than kernel writers do. Is this safe? Sure, the Exokernel s job is to provide safe, multiplexed access to the hardware. This separates the security and protection from the management of resources. Carnegie Mellon University: 15-410 Fall 2004 27

Exokernels: VM Example There is no fork() There is no exec() There is no automatic stack growth Exokernel keeps track of physical memory pages and assigns them to an application on request. Application makes a call into the Exokernel and asks for a physical memory page Exokernel manages hardware level of virtual memory. Carnegie Mellon University: 15-410 Fall 2004 28

Exokernels: VM Example fork(): Application asks the kernel for a bunch of pages Application copies its pages into the new ones The point is that the kernel doesn t provide this service Alternative: mark pages copy on write except for the pages that fork() is using. Basically, the fork() implementation can choose how to handle these details. Carnegie Mellon University: 15-410 Fall 2004 29

Exokernels: VM Example To revoke a virtual to physical mapping, the Exokernel asks for a physical page victim If an application does not cooperate, the Exokernel can take a physical page by force, writing it out to disk The application is free to manage its virtual to physical mappings using any data structure it wants. Carnegie Mellon University: 15-410 Fall 2004 30

Exokernels Example: Cheetah Web Server Web server uses custom, mutually-optimized FS and protocol stack. In a typical web server the data has to go from: 1. the disk to kernel memory 2. kernel memory to user memory 3. user memory back to kernel memory 4. kernel memory to the network device In an exokernel, the application can have the data go straight from disk to the network interface. Carnegie Mellon University: 15-410 Fall 2004 31

Exokernels Processor 2 3 Memory System Bus 1 4 Disk Ethernet Carnegie Mellon University: 15-410 Fall 2004 32

Exokernels Traditional kernel and web server: 1. read() - copy from disk to kernel buffer 2. read() - copy from kernel buffer to user buffer 3. send() - user buffer to kernel buffer send() - data is check-summed 4. send() - kernel buffer to device memory Carnegie Mellon University: 15-410 Fall 2004 33

Exokernels Exokernel and Cheetah: Copy from disk to memory Copy from memory to network File system doesn t store files, stores packet-body streams Header is finished when the data is sent out This saves the system from recomputing a checksum, saves processing power Traditional Packet Construction Cheeta Packet Construction Packets: IP TCP DATA IP TCP DATA Disk: DATA DATA Carnegie Mellon University: 15-410 Fall 2004 34

Exokernels Carnegie Mellon University: 15-410 Fall 2004 35

Advantages: Exokernels Extensible: just add a new libos Fast: Applications get direct access to hardware Safe: Exokernel allows safe sharing of resources Disadvantages: Still complicated, just moving it up into user space libraries Extensible in theory, in practice need to change libposix which is a lot like changing a monolithic kernel. Expensive to rewrite existing kernels send file(2) - Why change when you can steal? Requires policy, despite assertions to the contrary Carnegie Mellon University: 15-410 Fall 2004 36

Final Thoughts Operating systems are complicated. Structure does matter. Many alternatives, but monolithic with a little bit of kernel extensions thrown in are the most common. Why did none of the other structures win? Why should I re-implement my kernel when I can just add the functionality that gave you better performance numbers? (see send file(2)). Carnegie Mellon University: 15-410 Fall 2004 37