Even coarse architectural trends impact tremendously the design of systems

Similar documents
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

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

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

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

Architectural Support for Operating Systems

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

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

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Architectural Support for Operating Systems

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems

CSE 451: Operating Systems Spring Module 12 Secondary Storage

Lecture 2: Architectural Support for OSes

for Operating Systems Computer Systems Laboratory Sungkyunkwan University

Architectural Support for OS

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

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

Hardware OS & OS- Application interface

Lecture 2: September 9

Topic 18: Virtual Memory

CSE 153 Design of Operating Systems Fall 18

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

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

CSE 153 Design of Operating Systems

CSE 451: Operating Systems Spring Module 12 Secondary Storage. Steve Gribble

Common Computer-System and OS Structures

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs

Computer Architecture. Lecture 8: Virtual Memory

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation

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

CS 5460/6460 Operating Systems

virtual memory Page 1 CSE 361S Disk Disk

CSC 2405: Computer Systems II

Computer Architecture and OS. EECS678 Lecture 2

CSE 451: Operating Systems Winter Secondary Storage. Steve Gribble. Secondary storage

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

Uniprocessor Computer Architecture Example: Cray T3E

CS162 Operating Systems and Systems Programming Lecture 14. Caching (Finished), Demand Paging

How What When Why CSC3501 FALL07 CSC3501 FALL07. Louisiana State University 1- Introduction - 1. Louisiana State University 1- Introduction - 2

Operating Systems ECE344

CS162 Operating Systems and Systems Programming Lecture 13. Caches and TLBs. Page 1

OS: An Overview. ICS332 Operating Systems

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

I/O Systems. Jo, Heeseung

Lec 22: Interrupts. Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University. Announcements

Virtual Memory Oct. 29, 2002

ECE331: Hardware Organization and Design

ELEC 377 Operating Systems. Week 1 Class 2

CS370 Operating Systems

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

Anne Bracy CS 3410 Computer Science Cornell University

Machines and Virtualization. Systems and Networks Jeff Chase Spring 2006

Basic Computer Hardware

Topic 18 (updated): Virtual Memory

What s in a process?

Motivations for Virtual Memory Virtual Memory Oct. 29, Why VM Works? Motivation #1: DRAM a Cache for Disk

CISC 360. Virtual Memory Dec. 4, 2008

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

Computer System Overview

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

Goals of memory management

Unit 2 : Computer and Operating System Structure

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013

CS5460: Operating Systems

Memory Protection. Machines and Virtualization. Architectural Foundations of OS Kernels. Memory and the CPU. Introduction to Virtual Addressing

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

CSE 451: Operating Systems Winter Page Table Management, TLBs and Other Pragmatics. Gary Kimura

Translation Buffers (TLB s)

Virtual Memory Review. Page faults. Paging system summary (so far)

Virtual Memory: From Address Translation to Demand Paging

CS370 Operating Systems

C02: Interrupts and I/O

An Overview of the BLITZ System

virtual memory. March 23, Levels in Memory Hierarchy. DRAM vs. SRAM as a Cache. Page 1. Motivation #1: DRAM a Cache for Disk

CS162 Operating Systems and Systems Programming Lecture 14. Caching and Demand Paging

CSE 560 Computer Systems Architecture

CSE 120 Principles of Operating Systems

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

CSE 120 Principles of Operating Systems Spring 2017

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

Principles of Data Management. Lecture #2 (Storing Data: Disks and Files)

Virtual Memory. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

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

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

Systems Architecture II

Chap.6 Limited Direct Execution. Dongkun Shin, SKKU

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

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

Memory Management. To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time.

Chapter 5 B. Large and Fast: Exploiting Memory Hierarchy

CSE 120 Principles of Operating Systems

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

ECE232: Hardware Organization and Design

CS510 Operating System Foundations. Jonathan Walpole

Virtual memory Paging

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

Random-Access Memory (RAM) Systemprogrammering 2007 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics

Introduction to Operating Systems. Chapter Chapter

Transcription:

CSE 451: Operating Systems Spring 2006 Module 2 Architectural Support for Operating Systems John Zahorjan zahorjan@cs.washington.edu 534 Allen Center Even coarse architectural trends impact tremendously the design of systems Processing power doubling every 18 months 60% improvement each year factor of 100 every decade 1980: 1 MHz Apple II+ == $2,000 1980 also 1 MIPS VAX-11/780 == $120,000 2006: 3.0GHz Pentium D == $800 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 2 Primary memory capacity same story, same reason (Moore s Law) 1972 (core memory): 1MB = $1,000,000 today: Aside: Where does it all go? Facetiously: What Gordon giveth, Bill taketh away Realistically: our expectations for what the system will do increase relentlessly e.g., GUI Software is like a gas it expands to fill the available space Nathan Myhrvold (1960-) Microsoft Stock Price 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 3 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 4 Disk capacity, 1975-1989 doubled every 3+ years 25% improvement each year factor of 10 every decade Still exponential, but far less rapid than processor performance Disk capacity since 1990 doubling every 12 months 100% improvement each year factor of 1000 every decade 10x as fast as processor performance! [But, access time improves 10% / year ] Only a few years ago, we purchased disks by the megabyte (and it hurt!) Today, 1 GB (a billion bytes) costs $1 $0.50 from Dell (except you have to buy in increments of 40 80 GB) => 1 TB costs $1K $500, 1 PB costs $1M $500K In 3 2 years, 1 GB will cost $.10 => 1 TB for $100, 1 PB for $100K 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 5 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 6 1

Optical bandwidth today Doubling every 9 months 150% improvement each year Factor of 10,000 every decade 10x as fast as disk capacity! 100x as fast as processor performance!! What are some of the implications of these trends? Just one example: We have always designed systems so that they spend processing power in order to save scarce storage and bandwidth! 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 7 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 8 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 9 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 10 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 11 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 12 2

Storage Latency: How Far Away is the Data? 10 9 10 6 100 10 2 1 Tape /Optical Robot Disk Memory On Board Cache On Chip Cache Registers Andromeda Pluto Olympia This Building This Room My Head 2,000 Years 2 Years 1.5 hr 10 min 1 min Lower-level architecture affects the OS even more dramatically Operating system functionality is dictated, at least in part, by the underlying hardware architecture includes instruction set (synchronization, I/O, ) also hardware components like MMU or DMA controllers Architectural support can vastly simplify (or complicate!) OS tasks e.g.: early PC operating systems (DOS, MacOS) lacked support for virtual memory, in part because at that time PCs lacked necessary hardware support Apollo workstation used two CPUs as a bandaid for nonrestartable instructions! Most current Intel-based PCs still lack support for 64-bit addressing (which has been available for a decade on other platforms: MIPS, Alpha, IBM, etc ) changing rapidly due to AMD s 64-bit architecture 3/28/2006 2006 2004 Gribble, Jim Gray, Lazowska, Microsoft Levy, Corporation Zahorjan 132 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 14 Architectural features affecting OS s These features were built primarily to support OS s: timer (clock) operation synchronization instructions (e.g., atomic test-and-set) memory protection I/O control operations interrupts and exceptions protected modes of execution (kernel vs. user) protected instructions system calls (and software interrupts) [2006] virtualization architectures Intel: http://download.intel.com/technology/computing/vptech/c97063-002.pdf AMD: http://enterprise.amd.com/downloads/pacifica_en.pdf Protected instructions some instructions are restricted to the OS known as protected or privileged instructions e.g., only the OS can: directly access I/O devices (disks, network cards) manipulate memory state management page table pointers, TLB loads, etc. manipulate special mode bits interrupt priority level halt instruction 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 15 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 16 OS protection So how does the processor know if a protected instruction should be executed? the architecture must support at least two modes of operation: kernel mode and user mode VAX, x86 support 4 protection modes mode is set by status bit in a protected processor register user programs execute in user mode OS executes in kernel mode (OS == kernel) Protected instructions can only be executed in kernel mode what happens if user mode executes a protected instruction? 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 17 Crossing protection boundaries So how do user programs do something privileged? e.g., how can you write to a disk if you can t execute I/O instructions? User programs must call an OS procedure OS defines a sequence of system calls how does the user-mode to kernel-mode transition happen? There must be a system call instruction, which: causes an exception (throws a software interrupt), which vectors to a kernel handler passes a parameter indicating which system call to invoke saves caller s state (regs, mode bit) so they can be restored OS must verify caller s parameters (e.g., pointers) must be a way to return to user mode once done 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 18 3

A kernel crossing illustrated System call issues user mode kernel mode Firefox: read( ) trap to kernel mode; save app state trap handler find read( ) handler in vector table read( ) kernel routine restore app state, return to user mode, resume What would happen if kernel didn t save state? Why must the kernel verify arguments? How can you reference kernel objects as arguments to or results from system calls? 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 19 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 20 Memory protection OS must protect user programs from each other maliciousness, ineptitude OS must also protect itself from user programs integrity and security what about protecting user programs from OS? Simplest scheme: base and limit registers are these protected? More sophisticated memory protection coming later in the course paging, segmentation, virtual memory page tables, page table pointers translation lookaside buffers (TLBs) page fault handling Prog A Prog B Prog C base reg limit reg base and limit registers are loaded by OS before starting program 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 21 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 22 OS control flow after the OS has booted, all entry to the kernel happens as the result of an event event immediately stops current execution changes mode to kernel mode, event handler is called kernel defines handlers for each event type specific types are defined by the architecture e.g.: timer event, I/O interrupt, system call trap when the processor receives an event of a given type, it transfers control to handler within the OS handler saves program state (PC, regs, etc.) handler functionality is invoked handler restores program state, returns to program Interrupts and exceptions Two main types of events: interrupts and exceptions exceptions are caused by software executing instructions e.g., the x86 int instruction e.g., a page fault, or an attempted write to a read-only page an expected exception is a trap, unexpected is a fault interrupts are caused by hardware devices e.g., device finishes I/O e.g., timer fires 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 23 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 24 4

I/O control Issues: how does the kernel start an I/O? special I/O instructions memory-mapped I/O how does the kernel notice an I/O has finished? polling interrupts Interrupts are basis for asynchronous I/O device performs an operation asynchronously to CPU device sends an interrupt signal on bus when done in memory, a vector table contains list of addresses of kernel routines to handle various interrupt types who populates the vector table, and when? CPU switches to address indicated by vector index specified by interrupt signal 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 25 Timers How can the OS prevent runaway user programs from hogging the CPU (infinite loops?) use a hardware timer that generates a periodic interrupt before it transfers to a user program, the OS loads the timer with a time to interrupt quantum how big should it be set? when timer fires, an interrupt transfers control back to OS at which point OS must decide which program to schedule next very interesting policy question: we ll dedicate a class to it Should the timer be privileged? for reading or for writing? 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 26 Synchronization Interrupts cause a wrinkle: may occur any time, causing code to execute that interferes with code that was interrupted OS must be able to synchronize concurrent processes Synchronization: guarantee that short instruction sequences (e.g., readmodify-write) execute atomically one method: turn off interrupts before the sequence, execute it, then re-enable interrupts architecture must support disabling interrupts another method: have special complex atomic instructions read-modify-write test-and-set load-linked store-conditional Concurrent programming Management of concurrency and asynchronous events is biggest difference between systems programming and traditional application programming modern event-oriented application programming is a middle ground Arises from the architecture Can be sugar-coated, but cannot be totally abstracted away Huge intellectual challenge Unlike vulnerabilities due to buffer overruns, which are just sloppy programming 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 27 3/28/2006 2006 Gribble, Lazowska, Levy, Zahorjan 28 5