CSE 451: Operating Systems Spring 2006 Module 3 Operating System Components and Structure John Zahorjan zahorjan@cs.washington.edu Allen Center 534.

Slides:



Advertisements
Similar presentations
Operating Systems Components of OS
Advertisements

OS Components and Structure
Operating System Structures
1 CSE451 Introduction to Operating Systems Spring 2007 Module 3 Components and Structure Gary Kimura & Mark Zbikowski March 30, 2007.
Cs238 Lecture 3 Operating System Structures Dr. Alan R. Davis.
Common System Components
1 Gary Kimura Lecture #3 October 4, 2002 CSE451 Operating Systems Components and Basic Organization Autumn 2002.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
CSE 451: Operating Systems Spring 2012 Module 3 Operating System Components and Structure Ed Lazowska Allen Center 570 © 2012.
1 Lecture 3: OS Functions and Design Approaches  OS duties process management memory management disk/file management protection & security  interaction.
Stack Management Each process/thread has two stacks  Kernel stack  User stack Stack pointer changes when exiting/entering the kernel Q: Why is this necessary?
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
IT 344: Operating Systems Winter 2010 Module 3 Operating System Components and Structure Chia-Chi Teng 265G CTB 1.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
3.1 Operating System Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual.
OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM,
Processes Introduction to Operating Systems: Module 3.
CS 346 – Chapter 2 OS services –OS user interface –System calls –System programs How to make an OS –Implementation –Structure –Virtual machines Commitment.
Types of OS and OS Components
CSE 451: Operating Systems Winter 2015 Module 25 Virtual Machine Monitors Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 3: Operating-System Structures System Components Operating System Services.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Operating System Structure Lecture: - Operating System Concepts Lecturer: - Pooja Sharma Computer Science Department, Punjabi University, Patiala.
Overview of today’s lecture Major components of an operating system Structure and internal architecture of an operating system Monolithic Vs Micro-kernels.
OPERATING SYSTEMS STRUCTURES Jerry Breecher 2: Operating System Structures 1.
Chapter 3: Operating-System Structures
Introduction to Operating Systems Concepts
Module 3: Operating-System Structures
Operating System Concepts
OS Overview & Structure CSE 410 Winter 2017
Chapter 1: Introduction
Chapter 2: System Structures
Operating System Structure
Operating Systems Georgios Varsamopoulos
Chapter 2: Operating-System Structures
Chapter 2: System Structures
Chapter 3: Operating-System Structures
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Chapter 1 Introduction to Operating System Part 5
CSE 451: Operating Systems Autumn 2004 Module 3 Operating System Components and Structure Hank Levy 1.
CSE451 Operating Systems Winter 2010
Basic Concepts Protection: Security:
Lecture Topics: 11/1 General Operating System Concepts Processes
CSE 451: Operating Systems Winter 2007 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
Hank Levy (for Hank Levy :)
Chapter 2: Operating-System Structures
Operating Systems Lecture 3.
Introduction to Operating Systems
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
CSE 451: Operating Systems Autumn 2009 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
OS Components and Structure
CSE 451: Operating Systems Spring 2005 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
CSE 451: Operating Systems Winter 2004 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
OPERATING SYSTEMS STRUCTURES
© 2007 Gribble, Lazowska, Levy, Zahorjan
CSE 451: Operating Systems Winter 2003 Lecture 3 Operating System Structure: Components and Interfaces Hank Levy 412 Sieg Hall.
System calls….. C-program->POSIX call
CSE 451: Operating Systems Autumn 2010 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
Chapter-1 Computer is an advanced electronic device that takes raw data as an input from the user and processes it under the control of a set of instructions.
CSE 451: Operating Systems Autumn 2003 Lecture 3 Operating System Structure: Components and Interfaces Hank Levy Allen Center 596.
Chapter 2: Operating-System Structures
Operating Systems Structure
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
CSE 451: Operating Systems Winter 2006 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
III. Operating System Structures
Presentation transcript:

CSE 451: Operating Systems Spring 2006 Module 3 Operating System Components and Structure John Zahorjan zahorjan@cs.washington.edu Allen Center 534 1

© 2006 Gribble, Lazowska, Levy, Zahorjan OS structure The OS sits between application programs and the hardware it mediates access and abstracts away ugliness programs request services via exceptions (traps or faults) devices request attention via interrupts P2 P3 P4 P1 dispatch exception OS interrupt D1 start i/o D4 D2 D3 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Application Interface (API) User Apps Firefox Photoshop Acrobat Java Portable Application Interface (API) Operating System File Systems Memory Manager Process Manager Network Support Device Drivers Interrupt Handlers Boot & Init Hardware Abstraction Layer Hardware (CPU, devices) 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Secondary Storage Management Process Management Command Interpreter Information Services Error Handling Accounting System File System Protection System Memory Management Secondary Storage Management Process Management I/O System 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan Major OS components processes memory I/O secondary storage file systems protection accounting shells (command interpreter, or OS UI) GUI networking 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan 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, … 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Program/processor/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 process A process B code stack PC registers code stack PC registers page tables resources page tables resources 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

States of a user process running dispatch interrupt ready exception interrupt blocked 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan 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) 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan Memory management The primary memory (or RAM) is the directly accessed storage for the CPU programs must be stored in memory to execute memory access is fast (e.g., 10 ns to load/store) 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 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan 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 interrupts or errors examples: SCSI device drivers, Ethernet card drivers, video card drivers, sound card drivers, … Note: Windows has ~35,000 device drivers! 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan 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 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan 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! 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

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 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan 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 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

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 (or csh or tcsh or zsh or sh) on UNIX On others, there may be no command language e.g., MacOS 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan Accounting Keeps track of resource usage both to enforce quotas “you’re over your disk space limit” or to produce bills timeshared computers like mainframes hosted services GUI … Networking … etc. 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan OS structure It’s not always clear how to stitch OS modules together: Conceptual Organization (Linux 1998) (from http://plg.uwaterloo.ca/~itbowman/CS746G/a2/#_Toc411854285) 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan OS structure Actual Organization (from http://plg.uwaterloo.ca/~itbowman/CS746G/a2/#_Toc411854285) 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan OS structure 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, … 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Early structure: Monolithic Traditionally, OS’s (like UNIX) were built as a monolithic entity: user programs everything OS hardware 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan 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 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan 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 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Problems with layering 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 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

OS structure Command Interpreter Information Services Error Handling Accounting System Process Management Memory Management I/O System Secondary Storage Management File System Protection System Command Interpreter Information Services Error Handling Actual Organization (artist’s rendition) 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan Microkernels 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) 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Microkernel structure illustrated user mode firefox powerpoint user processes apache network file system system processes paging threads scheduling kernel communication processor control microkernel low-level VM protection hardware 7/17/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan