Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Similar documents
CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure

OS Concepts and structure

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

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Operating System Components

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

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

Chapter 2 System Structures

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

Components of a Computer System

Chapter 3 Operating-System Structures

Chapter 3: Operating-System Structures. Common System Components

CS161: Operating Systems

Operating System Structure

Example of Standard API

Operating Systems 4 th Class

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

Outline: Operating Systems

Operating System Structures

Operating System Structures

CHAPTER 15: Operating Systems: An Overview

Operating Systems OS Architecture Models

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

OPERATING SYSTEMS STRUCTURES

Operating system Dr. Shroouq J.

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Chapter 2: OS Overview

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Overview of Operating Systems Instructor: Dr. Tongping Liu

System Structures. Services Interface Structure

Introduction. What is an Operating System?

Chapter 3. Operating Systems

Chapter 6, The Operating System Machine Level

CPS221 Lecture: Operating System Structure; Virtual Machines

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Operating System Tutorial

Operating System Components and Services

Have both hardware and software. Want to hide the details from the programmer (user).

Principles of Operating Systems CS 446/646

Linux Kernel Architecture

Operating System Software

LSN 10 Linux Overview

ELEC 377. Operating Systems. Week 1 Class 3

Operating Systems. Notice that, before you can run programs that you write in JavaScript, you need to jump through a few hoops first

Star System Deitel & Associates, Inc. All rights reserved.

1 Organization of Operating Systems

Unit 4 Objectives. System Software. Component 4: Introduction to Information and Computer Science. Unit 4: Application and System Software Lecture 2

Lecture 1 Operating System Overview

COS 318: Operating Systems

Operating System Overview. Otto J. Anshus

CS3600 SYSTEMS AND NETWORKS

Lesson 06: Basics of Software Development (W02D2

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 2 Introducing Operating Systems

I/O. Input/Output. Types of devices. Interface. Computer hardware

Lecture 25 Symbian OS

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

OPERATING SYSTEMS Software in the Background. Chapter 2

VMware Server 2.0 Essentials. Virtualization Deployment and Management

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

About Parallels Desktop 7 for Mac

TEST CHAPTERS 1 & 2 OPERATING SYSTEMS

Operating Systems: Basic Concepts and History

Security Overview of the Integrity Virtual Machines Architecture


Chapter 10 Case Study 1: LINUX

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

Overview and History of Operating Systems

Computers: Tools for an Information Age

Chapter 8 Objectives. Chapter 8 Operating Systems and Utility Programs. Operating Systems. Operating Systems. Operating Systems.

Kernel. What is an Operating System? Systems Software and Application Software. The core of an OS is called kernel, which. Module 9: Operating Systems

This tutorial will take you through step by step approach while learning Operating System concepts.

VMWARE Introduction ESX Server Architecture and the design of Virtual Machines

theguard! ApplicationManager System Windows Data Collector

COS 318: Operating Systems. Virtual Machine Monitors

Components of a Computing System. What is an Operating System? Resources. Abstract Resources. Goals of an OS. System Software

CSC 2405: Computer Systems II

MODULE 3 VIRTUALIZED DATA CENTER COMPUTE

A single user ran a single program ran on a single computer there was no need for Page 1 of 6 Copyright Virtual University of Pakistan

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2007 Lecture 5 - DBMS Architecture

Software: Systems and Application Software

Introduction to Virtual Machines

Chapter 5: System Software: Operating Systems and Utility Programs

4.1 Introduction 4.2 Explain the purpose of an operating system Describe characteristics of modern operating systems Control Hardware Access

1. Computer System Structure and Components

Technology in Action. Alan Evans Kendall Martin Mary Anne Poatsy. Eleventh Edition. Copyright 2015 Pearson Education, Inc.

Common Operating-System Components

Upon completion of this chapter, you will able to answer the following questions:

Anh Quach, Matthew Rajman, Bienvenido Rodriguez, Brian Rodriguez, Michael Roefs, Ahmed Shaikh

Fall Lecture 1. Operating Systems: Configuration & Use CIS345. Introduction to Operating Systems. Mostafa Z. Ali. mzali@just.edu.

Embedded Systems. 6. Real-Time Operating Systems

CS420: Operating Systems OS Services & System Calls

Processes and Non-Preemptive Scheduling. Otto J. Anshus

File Management. COMP3231 Operating Systems. Kevin Elphinstone. Tanenbaum, Chapter 4

STUDY GUIDE CHAPTER 4

Kernel comparison of OpenSolaris, Windows Vista and. Linux 2.6

Transcription:

Review from last time CS 537 Lecture 3 OS Structure What HW structures are used by the OS? What is a system call? Michael Swift Remzi Arpaci-Dussea, Michael Swift 1 Remzi Arpaci-Dussea, Michael Swift 2 What you should learn from this lecture What are the major components of an operating system? How are operating systems structured and why? 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 P1 P2 dispatch P3 P4 exception OS interrupt D1 D2 D3 start i/o D4 Remzi Arpaci-Dussea, Michael Swift 3 Remzi Arpaci-Dussea, Michael Swift 4 1

Major OS components processes memory I/O secondary storage file systems protection accounting 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, Remzi Arpaci-Dussea, Michael Swift 5 Remzi Arpaci-Dussea, Michael Swift 6 Process / processor / procedure States of a user process Note that a program is totally passive just bytes on a disk that contain 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 dispatch running ready interrupt exception Linux: ps -auwwx to list all processes process A process B code stack PC registers page tables resources code stack PC registers page tables resources interrupt blocked Remzi Arpaci-Dussea, Michael Swift 7 Remzi Arpaci-Dussea, Michael Swift 8 2

Process operations The OS provides the following kinds of 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) 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., 60 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 Remzi Arpaci-Dussea, Michael Swift 9 Remzi Arpaci-Dussea, Michael Swift 10 I/O A big chunk of the OS kernel deals with I/O Millions of lines in Windows/XP (including drivers) 70% of Linux code 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! 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 Remzi Arpaci-Dussea, Michael Swift 11 Remzi Arpaci-Dussea, Michael Swift 12 3

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 long-term storage unit 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 but one possibility! Remzi Arpaci-Dussea, Michael Swift 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 Remzi Arpaci-Dussea, Michael Swift 14 Protection Protection is a general mechanism used throughout the OS all resources needed to be protected memory processes files devices protection mechanisms help to detect and contain 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., MSDOS, 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 Remzi Arpaci-Dussea, Michael Swift 15 Remzi Arpaci-Dussea, Michael Swift 16 4

Accounting OS Control Flow Keeps track of resource usage both to enforce quotas you re over your disk space limit or to produce bills important for timeshared computers like mainframes main() From boot Initialization Interrupt System call Exception GUI Networking etc. Idle Loop Operating System Modules RTI Remzi Arpaci-Dussea, Michael Swift 17 Remzi Arpaci-Dussea, Michael Swift 18 OS structure It s not always clear how to stitch OS modules together: Protection System Process Management Information Services Error Handling Memory Management Command Interpreter File System Secondary Storage Management I/O System Accounting System 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, Remzi Arpaci-Dussea, Michael Swift 19 Remzi Arpaci-Dussea, Michael Swift 20 5

Early structure: Monolithic Traditionally, OS s (like UNIX) were built as a monolithic entity: OS user programs everything hardware Monolithic design Examples: MS-DOS, Unix Major advantage: cost of module interactions is low (procedure call) easy to get started requires no HW support 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 Remzi Arpaci-Dussea, Michael Swift 21 Remzi Arpaci-Dussea, Michael Swift 22 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 Remzi Arpaci-Dussea, Michael Swift 23 Problems with layering Imposes hierarchical structure limited information available because each layer depends only on layers below 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 Remzi Arpaci-Dussea, Michael Swift 24 6

Microkernels Microkernel structure illustrated Popular in the late 80 s, early 90 s recent resurgence of popularity for small devices Goal: minimize what goes in kernel organize rest of OS as user-level processes communicate with messages This results in: better reliability (isolation between components) ease of extension and customization poor performance (user/kernel boundary crossings) (4 vs 2) First microkernel system was Hydra (CMU, 1970) follow-ons: Mach (CMU), Chorus (French UNIX-like OS), and in some ways NT (Microsoft), OS X (Apple) user processes system processes microkernel netscape Threads file system scheduling low-level VM apache Services network communication protection hardware powerpoint Services paging device control processor control user mode kernel Remzi Arpaci-Dussea, Michael Swift 25 Remzi Arpaci-Dussea, Michael Swift 26 Modules Most modern OSs implement kernel modules Uses object-oriented approach Each core component is separate Each talks to the others over known interfaces Each is loadable as needed within the kernel Overall, similar to layers but with more flexible Modules can interact with many other modules Standard module interfaces allow replacement, extension via layering Examples: Solaris, Linux, MAC OS X, Windows Vista Windows Structure Remzi Arpaci-Dussea, Michael Swift 27 Remzi Arpaci-Dussea, Michael Swift 28 7

Other structures Question: do you need hardware support for protection? Singularity: reorganize OS around software protection Type-safe language (C#) for isolation, safety Microkernel with memory, IO, scheduling, IPC Communication via interfaces and typed channels extensions are separate processes Drivers Network protocols File systems Benefits: Avoid cost of HW protection: Runs in kernel mode with no virtual memory Fast IPC due to direct invocation Drawbacks Limited to a single language environment Requires rewriting the world 2004-2007 Ed Lazowska, Hank Levy, Andrea and 9/10/07 29 Remzi Arpaci-Dussea, Michael Swift 8