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

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

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

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

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

What s in a process?

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

ELEC 377 Operating Systems. Week 1 Class 2

10/10/ Gribble, Lazowska, Levy, Zahorjan 2. 10/10/ Gribble, Lazowska, Levy, Zahorjan 4

Chapter 3: Operating-System Structures

Operating-System Structures

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

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

Operating System Services

Chapter 3: Operating-System Structures

Operating System Review

Module 3: Operating-System Structures. Common System Components

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

Chapter 2 Operating-System Structures

Operating-System Structures

CSC 453 Operating Systems

Chapter 2. Operating-System Structures

Microkernels and Client- Server Architectures

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

Unit 2 : Computer and Operating System Structure

Architectural Support. Processes. OS Structure. Threads. Scheduling. CSE 451: Operating Systems Spring Module 28 Course Review

Chapter 2: Operating-System Structures

UNIT 2. OPERATING SYSTEM STRUCTURES

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

Operating-System Structures

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

! Software ( kernel ) that runs at all times. ! OS performs two unrelated functions: Maria Hybinette, UGA. user! 1! Maria Hybinette, UGA. user! n!

Chapter 3: Operating-System Structures

Operating Systems Overview. Chapter 2

CS 390 Chapter 2 Homework Solutions

Chapter 2: Operating-System Structures

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

Chapter 2: Operating-System Structures

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

Introduction. CS3026 Operating Systems Lecture 01

Module 3: Operating-System Structures

Introduction to Operating Systems (Part II)

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

Chapter 2: Operating-System Structures

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Operating- System Structures

Introduction to Operating System

Even coarse architectural trends impact tremendously the design of systems

Four Components of a Computer System

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

Chapter 2: Operating-System Structures. Chapter 2: Operating-System Structures. Objectives. Operating System Services

Chapter 2: Operating-System

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

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

Even coarse architectural trends impact tremendously the design of systems. Even coarse architectural trends impact tremendously the design of systems

Operating System Architecture. CS3026 Operating Systems Lecture 03

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

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

CS30002: Operating Systems. Arobinda Gupta Spring 2017

Chapter 1: Introduction

Chapter 2: Operating-System Structures

Operating Systems CS3502 Spring 2018

Operating System Concepts Ch. 2: Operating System Structures

Process Description and Control

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Operating Systems 2010/2011

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services

Processes & Threads. Recap of the Last Class. Microkernel System Architecture. Layered Structure

System Call. Preview. System Call. System Call. System Call 9/7/2018

TDDI04, K. Arvidsson, IDA, Linköpings universitet Operating System Structures. Operating System Structures Overview. Operating System Services

OPERATING SYSTEM OVERVIEW

(MCQZ-CS604 Operating Systems)

Operating Systems Overview. Chapter 2

Operating Systems: Principles and Practice. Mark Zbikowski Gary Kimura (kudos to Tom Anderson)

CS370 Operating Systems

Chapter 2: System Structures

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

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

Types and Functions of Win Operating Systems

Introduction CHAPTER. Review Questions

Module 1 Introduction/OS Overview

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

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

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

Operating System Structure

Operating System Structure

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

Operating-System Structures

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Some popular Operating Systems include Linux Operating System, Windows Operating System, VMS, OS/400, AIX, z/os, etc.

OPERATING SYSTEMS UNIT - 1

Chapter 2: System Structures

CS 111. Operating Systems Peter Reiher

CHAPTER 2 BASIC OPERATING SYSTEM CONCEPT MANAGEMENT

Principles of Operating Systems CS 446/646

Operating systems Architecture

CS370 Operating Systems

Operating System Overview. Chapter 2

Transcription:

CSE 451: Operating Systems Spring 2012 Module 3 Operating System Components and Structure Ed Lazowska lazowska@cs.washington.edu Allen Center 570 The OS sits between application programs and the it mediates access and abstracts away ugliness programs request services via traps or exceptions devices request attention via s P1 dispatch trap or exception D1 P2 D2 OS P3 D3 start i/o P4 D4 2012 Gribble, Lazowska, Levy, Zahorjan 1 2012 Gribble, Lazowska, Levy, Zahorjan 2 User Apps Operating System Firefox File Systems Device Drivers Photoshop Application Interface (API) Manager Interrupt Handlers Acrobat Process Manager Hardware Abstraction Layer Java Network Support Boot & Init Portable Protection System Process Information Services Error Handling Command Interpreter File System Accounting System Secondary Storage Hardware (CPU, devices) I/O System 2012 Gribble, Lazowska, Levy, Zahorjan 3 2012 Gribble, Lazowska, Levy, Zahorjan 4 Major OS components processes memory I/O secondary storage file systems protection shells (command interpreter, or OS UI) GUI networking Process management An OS executes many kinds of activities: users programs batch jobs or scripts system programs print spoolers, name servers, file servers, network daemons, Each of these activities is encapsulated in a process a process includes the execution context PC, registers, VM, OS resources (e.g., open files), etc plus the program itself (code and data) the OS s process module manages these processes creation, destruction, scheduling, 2012 Gribble, Lazowska, Levy, Zahorjan 5 2012 Gribble, Lazowska, Levy, Zahorjan 6 1

Program/processor/process States of a user process Note that a program is totally passive just bytes on a disk that encode instructions to be run A process is an instance of a program being executed by a (real or virtual) processor at any instant, there may be many processes running copies of the same program (e.g., an editor); each process is separate and (usually) independent Linux: ps -auwwx to list all processes dispatch running ready trap or exception process A code stack PC registers page tables resources process B code stack PC registers page tables resources blocked 2012 Gribble, Lazowska, Levy, Zahorjan 7 2012 Gribble, Lazowska, Levy, Zahorjan 8 Process operations The OS provides the following kinds operations on processes (i.e., the process abstraction interface): create a process delete a process suspend a process resume a process clone a process inter-process communication inter-process synchronization create/delete a child process (subprocess) 2012 Gribble, Lazowska, Levy, Zahorjan 9 management The primary memory is the directly accessed storage for the CPU programs must be stored in memory to execute memory access is fast but memory doesn t survive power failures OS must: allocate memory space for programs (explicitly and implicitly) deallocate space when needed by rest of system maintain mappings from physical to virtual memory through page tables decide how much memory to allocate to each process a policy decision decide when to remove a process from memory also policy 2012 Gribble, Lazowska, Levy, Zahorjan 10 I/O A big chunk of the OS kernel deals with I/O hundreds of thousands of lines in NT The OS provides a standard interface between programs (user or system) and devices file system (disk), sockets (network), frame buffer (video) Device drivers are the routines that interact with specific device types encapsulates device-specific knowledge e.g., how to initialize a device, how to request I/O, how to handle s or errors examples: SCSI device drivers, Ethernet card drivers, video card drivers, sound card drivers, Note: Windows has ~35,000 device drivers! Secondary storage Secondary storage (disk, tape) is persistent memory often magnetic media, survives power failures (hopefully) Routines that interact with disks are typically at a very low level in the OS used by many components (file system, VM, ) handle scheduling of disk operations, head movement, error handling, and often management of space on disks Usually independent of file system although there may be cooperation file system knowledge of device details can help optimize performance e.g., place related files close together on disk 2012 Gribble, Lazowska, Levy, Zahorjan 11 2012 Gribble, Lazowska, Levy, Zahorjan 12 2

File systems Secondary storage devices are crude and awkward e.g., write 4096 byte block to sector 12 File system: a convenient abstraction defines logical objects like files and directories hides details about where on disk files live as well as operations on objects like read and write read/write byte ranges instead of blocks A file is the basic unit of long-term storage file = named collection of persistent information A directory is just a special kind of file directory = named file that contains names of other files and metadata about those files (e.g., file size) Note: Sequential byte stream is only one possibility! 2012 Gribble, Lazowska, Levy, Zahorjan 13 File system operations The file system interface defines standard operations: file (or directory) creation and deletion manipulation of files and directories (read, write, extend, rename, protect) copy lock File systems also provide higher level services accounting and quotas backup (must be incremental and online!) (sometimes) indexing or search (sometimes) file versioning 2012 Gribble, Lazowska, Levy, Zahorjan 14 Protection Protection is a general mechanism used throughout the OS all resources needed to be protected memory processes files devices CPU time protection mechanisms help to detect and contain unintentional errors, as well as preventing malicious destruction Command interpreter (shell) A particular program that handles the interpretation of users commands and helps to manage processes user input may be from keyboard (command-line interface), from script files, or from the mouse (GUIs) allows users to launch and control new programs On some systems, command interpreter may be a standard part of the OS (e.g., MS DOS, Apple II) On others, it s just non-privileged code that provides an interface to the user e.g., bash/csh/tcsh/zsh on UNIX On others, there may be no command language e.g., MacOS 2012 Gribble, Lazowska, Levy, Zahorjan 15 2012 Gribble, Lazowska, Levy, Zahorjan 16 It s not always clear how to stitch OS modules together: Protection System Process Information Services Error Handling Command Interpreter File System Accounting System Secondary Storage I/O System An OS consists of all of these components, plus: many other components system programs (privileged and non-privileged) e.g., bootstrap code, the init program, Major issue: how do we organize all this? what are all of the code modules, and where do they exist? how do they cooperate? Massive software engineering and design problem design a large, complex program that: performs well, is reliable, is extensible, is backwards compatible, 2012 Gribble, Lazowska, Levy, Zahorjan 17 2012 Gribble, Lazowska, Levy, Zahorjan 18 3

Early structure: Monolithic Traditionally, OS s (like UNIX) were built as a monolithic entity: user programs OS everything 2012 Gribble, Lazowska, Levy, Zahorjan 19 2012 Gribble, Lazowska, Levy, Zahorjan 20 Monolithic design Major advantage: cost of module interactions is low (procedure call) Disadvantages: hard to understand hard to modify unreliable (no isolation between system modules) hard to maintain What is the alternative? find a way to organize the OS in order to simplify its design and implementation Layering The traditional approach is layering implement OS as a set of layers each layer presents an enhanced virtual machine to the layer above The first description of this approach was Dijkstra s THE system Layer 5: Job Managers Execute users programs Layer 4: Device Managers Handle devices and provide buffering Layer 3: Console Manager Implements virtual consoles Layer 2: Page Manager Implements virtual memories for each process Layer 1: Kernel Implements a virtual processor for each process Layer 0: Hardware Each layer can be tested and verified independently 2012 Gribble, Lazowska, Levy, Zahorjan 21 2012 Gribble, Lazowska, Levy, Zahorjan 22 Problems with layering Hardware Abstraction Layer Imposes hierarchical structure but real systems are more complex: file system requires VM services (buffers) VM would like to use files for its backing store strict layering isn t flexible enough Poor performance each layer crossing has overhead associated with it Disjunction between model and reality systems modeled as layers, but not really built that way An example of layering in modern operating systems Goal: separates -specific routines from the core OS Provides portability Improves readability Core OS (file system, scheduler, system calls) Hardware Abstraction Layer (device drivers, assembly routines) 2012 Gribble, Lazowska, Levy, Zahorjan 23 2012 Gribble, Lazowska, Levy, Zahorjan 24 4

Microkernels Microkernel structure illustrated Popular in the late 80 s, early 90 s recent resurgence of popularity Goal: minimize what goes in kernel organize rest of OS as user-level processes This results in: better reliability (isolation between components) ease of extension and customization poor performance (user/kernel boundary crossings) First microkernel system was Hydra (CMU, 1970) Follow-ons: Mach (CMU), Chorus (French UNIX-like OS), OS X (Apple), in some ways NT (Microsoft) user processes system processes microkernel firefox powerpoint apache photoshop itunes word file system threads low-level VM network scheduling communication protection paging processor control user mode Kernel mode 2012 Gribble, Lazowska, Levy, Zahorjan 25 2012 Gribble, Lazowska, Levy, Zahorjan 26 From Andy Tanenbaum 27 From Andy Tanenbaum 28 Summary and Next Module Summary OS design has been a evolutionary process of trial and error. Probably more error than success Successful OS designs have run the spectrum from monolithic, to layered, to micro kernels, to virtual machine monitors The role and design of an OS are still evolving It is impossible to pick one correct way to structure an OS Next module Processes, one of the most fundamental pieces in an OS What is a process, what does it do, and how does it do it Transparently implement in software Voilà, you can boot a guest OS From http://port25.technet.com/ 29 2012 Gribble, Lazowska, Levy, Zahorjan 30 5