Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure

Similar documents
Architectural Support for Operating Systems

CSE 451: Operating Systems Winter Module 2 Architectural Support for Operating Systems

Even coarse architectural trends impact tremendously the design of systems

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

Even coarse architectural trends impact tremendously the design of systems

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

Computer System Overview

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

Computer Architecture and OS. EECS678 Lecture 2

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture

Operating Systems. Introduction & Overview. Outline for today s lecture. Administrivia. ITS 225: Operating Systems. Lecture 1

Architectural Support for Operating Systems

CS370 Operating Systems

CS 537 Lecture 2 Computer Architecture and Operating Systems. OS Tasks

CS370 Operating Systems

CS 333 Introduction to Operating Systems Class 2 OS-Related Hardware & Software The Process Concept

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

What Operating Systems Do An operating system is a program hardware that manages the computer provides a basis for application programs acts as an int

Introduction to Operating Systems. Chapter Chapter

Basic Computer Hardware

Introduction to Operating. Chapter Chapter

Chapter 2: Computer-System Structures. Hmm this looks like a Computer System?

Uniprocessor Computer Architecture Example: Cray T3E

Introduction to Operating Systems. Chapter Chapter

CS399 New Beginnings. Jonathan Walpole

Four Components of a Computer System

CS 333 Introduction to Operating Systems. Class 2 OS-Related Hardware & Software The Process Concept

CSE 153 Design of Operating Systems

CS510 Operating System Foundations. Jonathan Walpole

Module 2: Computer-System Structures. Computer-System Architecture

OS And Hardware. Computer Hardware Review PROCESSORS. CPU Registers. CPU Registers 02/04/2013

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

Computer-System Architecture (cont.) Symmetrically Constructed Clusters (cont.) Advantages: 1. Greater computational power by running applications

Hardware OS & OS- Application interface

CSE 153 Design of Operating Systems Fall 18

Part I Overview Chapter 1: Introduction

CSE 120 Principles of Operating Systems

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

Lecture 2: Architectural Support for OSes

CSC 2405: Computer Systems II

Chapter 1: Introduction. Operating System Concepts 8th Edition,

CS330: Operating System and Lab. (Spring 2006) I/O Systems

CS450/550 Operating Systems

Operating Systems (2INC0) 2018/19. Introduction (01) Dr. Tanir Ozcelebi. Courtesy of Prof. Dr. Johan Lukkien. System Architecture and Networking Group

I/O Systems. Jo, Heeseung

Cycle Time for Non-pipelined & Pipelined processors

Input Output (IO) Management

Anne Bracy CS 3410 Computer Science Cornell University

CS5460: Operating Systems

Topic 18: Virtual Memory

Final Lecture. A few minutes to wrap up and add some perspective

Instruction Cycle. Computer-System Architecture. Computer-System Operation. Common Functions of Interrupts. Chapter 2: Computer-System Structures

CSE 120 Principles of Operating Systems

Architectural Support for Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Summary of Computer Architecture

Architectural Support for Operating Systems

Misc. Third Generation Batch Multiprogramming. Fourth Generation Time Sharing. Last Time Evolution of OSs

Operating Systemss and Multicore Programming (1DT089)

Protection and System Calls. Otto J. Anshus

Introduction and Overview

I/O Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Architectural Support for OS

COS 318: Operating Systems. Overview. Prof. Margaret Martonosi Computer Science Department Princeton University

Chapter 2 Computer-System Structure

Input/Output. Today. Next. ! Principles of I/O hardware & software! I/O software layers! Secondary storage. ! File systems

Computer System Overview

OS: An Overview. ICS332 Operating Systems

CPSC 341 OS & Networks. Introduction. Dr. Yingwu Zhu

Computer-System Architecture

Computer-System Architecture. Common Functions of Interrupts. Computer-System Operation. Interrupt Handling. Chapter 2: Computer-System Structures

for Operating Systems Computer Systems Laboratory Sungkyunkwan University

OPERATING SYSTEMS & Network OVERVIEW. 1: OS & Network Overview

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Computer-System Structures

CS 333 Introduction to Operating Systems. Class 1 - Introduction to OS-related Hardware and Software

Common Computer-System and OS Structures

Computer Science 61C Spring Friedland and Weaver. Input/Output

ECE232: Hardware Organization and Design

7/20/2008. What Operating Systems Do Computer-System Organization

Four Components of a Computer System. Operating System Concepts 7 th Edition, Jan 12, 2005

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

Introduction to Computer Systems and Operating Systems

Lecture 1 Introduction (Chapter 1 of Textbook)

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

Systems Architecture II

CS 333 Introduction to Operating Systems. Class 1 - Introduction to OS-related Hardware and Software

Jan 20, 2005 Lecture 2: Multiprogramming OS

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Secondary storage. File systems

ECE331: Hardware Organization and Design

Chapter Seven Morgan Kaufmann Publishers

Reading and References. Input / Output. Why Input and Output? A typical organization. CSE 410, Spring 2004 Computer Systems

Memory Management. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

Operating Systems. V. Input / Output

Memory Management. To do. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum)

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum)

Mon Sep 17, 2007 Lecture 3: Process Management

CS 4410 Operating Systems. Computer Architecture Review Oliver Kennedy

Transcription:

Architecture and OS To do q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure

Computer architecture and OS OS is intimately tied to the hardware it runs on OS design is impacted by it OS needs result on new architectural features Abstract model of a simple computer CPU Memory Video MMU controller Keyboard controller Hard Disk controller Bus 2

Processor The brain with a basic operation cycle Fetch next instruction Decode it to determine type & operands Execute it and a specific set of instructions Architecture specific x86!= ARM Plus registers, since memory is slow General registers and special ones (PC, SP) Clearly simplistic model Pipelining, superscalar, multicore 3

Memory Ideal fast, large, cheap, persistent Real storage hierarchy Registers Internal to the CPU & just as fast Cache If word needed is in cache, get it in ~2 cycles Main memory ~ 100x slower Hard disk from nsecs to msecs (moving the arm 5-10msec) Magnetic tape Cloud storage First core-based memory: IBM 405 Alphabetical Accounting Machine 4

Architectural trends impact OS design Processing power Doubling every 18 months (100x per decade) but power is a serious issue Disk capacity Double every 12 months (1000x per decade) 1961 ~ $4,440/MB 2014 ~ $0.00004/MB 1961 IBM 1301 ~26MB ~$115,500 (~890k in 2013) 5

Architectural trends impact OS design Memory Same and for the same reason 1980 64KB $405.00 ($6,480/MB) 2014 4GB $29.99 ($0.007/MB)* Optical bandwidth today 10x as fast as disk capacity 100x as fast as processor performance Doubling every 9 months (Butter s law) Latency is the limiting factor, but there s room Time to get the HTML index page from popular sites is, in the median, 34 * c-latency (light s shortest path rtt) *http://www.jcmit.com/memoryprice.htm 6

and OS needs shape the architecture Arch support can simplify/complicate OS tasks E.g., early PC OS (DOS) lacked support for virtual memory, partly because HW lacked key features Features built primarily to support OS s Protected modes of execution (kernel vs. user) System calls (and software interrupts) Memory protection I/O control operations Timer (clock) operation Interrupts and exceptions Synchronization instructions 7

Consider timesharing Multiprogramming & timesharing are useful Multiprogramming using different parts of the hardware at the same time for different tasks Timesharing several persons making use of the computer at the same time but How to protect programs from each other and the kernel from all? How to handle relocation? OS may need to run a given program at!= times from!= locations 8

For protection Restrict some instructions to the OS e.g. Directly access I/O devices How does the CPU know if a protected instructions should be executed? Architecture must support 2+ modes of operation Mode is set by status bit in a protected register User programs execute in user mode, OS in kernel mode Protected instructions can only execute in kernel mode 9

Crossing protection boundaries How can apps do something privileged? e.g. How do you save a file if you can't do I/O? User programs must call an OS procedure Ask the OS to do it OS defines a set of system calls User-mode program makes a system call How does the user to kernel-mode transition happen? 10

Crossing protection boundaries The system call Causes an exception which vector to a kernel handler Passes a parameter indicating which syscall is Saves caller's state so it can be restored What would happen if the kernel didn t save state? OS must verify caller's parameters Why should it do that? Must have a way to go back to user once done A special instruction sets PC to the return address and the execution mode to user 11

Crossing protection boundaries A system call User mode Kernel mode read(int fd, void *buffer, int numbytes) Save user PC PC = trap handler address Enter kernel mode trap handler Save application state Verify system call number Find sys_read handler sysread() kernel routine Restore PC Enter user mode Verify args Initiate read Choose next proc to run Setup return values Restore application state ERET instruction A bit like a regular subroutine call, right? 12

Exception handling and protection All entries to the OS use the same mechanism Acquiring privileged mode and branching to trap handler are inseparable Interrupts, exceptions and traps Interrupt: asynchronous, caused by an external HW event Exception: synchronous; unexpected, automatically generated (coerced, no requested); divide by zero Trap: synchronous; programmer initiated, expected transfer of control to a special handler 13

Next issue Memory relocation Simplest model base + limit Base (start) of program + limit registers Used by CDC 6600 (supercomputer) and Intel 8088 Changing program means changing base+limit Solves relocation and protection (on CDC 6600) Cost 2 registers + cycle time incr More sophisticated alternatives 2 base and 2 limit registers for text & data; allow sharing program text Paging, segmentation, virtual memory If base and < base + limit, OK else trap to OS with error Job 1 Job 2 Job 3 Base reg Limit reg 14

OS needs shape the architecture I/O I/O Device Device + Controller (simpler I/F to OS; think SCSI) Read sector x from disk y (disk, cylinder, sector, head), How does the kernel start an I/O? Special I/O instructions Memory-mapped I/O How does it notice when the I/O is done? Polling are we done yet? Interrupts let me know when you are done? How does it exchange data with I/O device? Programmed I/O Direct Memory Access (DMA) 15

OS control flow OSs are event driven Once booted, all entry to kernel happens as result of an event (e.g. signal by an interrupt), which Immediately stops current execution Changes to kernel mode, event handler is called Kernel defines handlers per event type Specific types are defined by the architecture e.g. timer event, I/O interrupt, system call trap 16

Timers How can the OS retains control when a? loop program gets stuck in an infinite HW timer that generates a periodic interrupt Before it transfers to a user program, OS loads timer with a time to interrupt When time's up, interrupt transfers control back to OS OS pick a program to schedule next (which one?) Should the timer be privileged? For reading or for writing? 17

Synchronization Issues with interrupts Executing code can interfere with interrupted code OS must be able to synchronize concurrent processes Synchronization Guarantee that short instruction sequences (e.g. read-modifywrite) execute atomically Two methods Turn off interrupts, execute sequence, re-enable interrupts Have special, complex atomic instructions test-and-set Management of concurrency & asynchronous events is the biggest difference between systems-level & traditional app programming 18

Summary & preview This is far from over new architectural features are still being introduced Support for virtual machine monitors Hardware transaction support Support for security Low latency persistent memory Transistors are free so Intel/AMD/ need to find applications that require new hardware that you would want to buy 19