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

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

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Introduction to Operating Systems. Chapter Chapter

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Introduction to Operating Systems. Chapter Chapter

Introduction to Operating. Chapter Chapter

CS370 Operating Systems

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

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

Architectural Support for Operating Systems

Common Computer-System and OS Structures

CS399 New Beginnings. Jonathan Walpole

CPS104 Computer Organization and Programming Lecture 17: Interrupts and Exceptions. Interrupts Exceptions and Traps. Visualizing an Interrupt

Hardware OS & OS- Application interface

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

CS370 Operating Systems

Introduction to Computer Systems and Operating Systems

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

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

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Lecture 2: September 9

Part I Overview Chapter 1: Introduction

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

CSC 2405: Computer Systems II

Basic Computer Hardware

Unit 2 : Computer and Operating System Structure

Architectural Support for Operating Systems

OPERATING SYSTEMS CS136

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

Chapter 13: I/O Systems

Chapter Seven Morgan Kaufmann Publishers

Review: Hardware user/kernel boundary

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

HY225 Lecture 12: DRAM and Virtual Memory

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

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

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

Chapter 1 Computer System Overview

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

Computer Organization

Today: I/O Systems. Architecture of I/O Systems

I/O Management Intro. Chapter 5

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

EE108B Lecture 17 I/O Buses and Interfacing to CPU. Christos Kozyrakis Stanford University

Even coarse architectural trends impact tremendously the design of systems

Chapter 13: I/O Systems

I/O Devices. I/O Management Intro. Sample Data Rates. I/O Device Handling. Categories of I/O Devices (by usage)

Computer Organization ECE514. Chapter 5 Input/Output (9hrs)

Lecture 15: I/O Devices & Drivers

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

Concurrent programming: Introduction I

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

5 Computer Organization

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

Input Output (IO) Management

Module 11: I/O Systems

Computer Organization and Microprocessors SYLLABUS CHAPTER - 1 : BASIC STRUCTURE OF COMPUTERS CHAPTER - 3 : THE MEMORY SYSTEM

Lecture 1 Introduction (Chapter 1 of Textbook)

操作系统概念 13. I/O Systems

Brief tour of hardware

Computer Architecture CS 355 Busses & I/O System

INPUT/OUTPUT ORGANIZATION

CSE 120 Principles of Operating Systems

Advanced Operating Systems (CS 202)

CSE 120 Principles of Operating Systems

Chapter 13: I/O Systems

Anne Bracy CS 3410 Computer Science Cornell University

I/O Devices. Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau)

CS 201 The Memory Hierarchy. Gerson Robboy Portland State University

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Chapter 13: I/O Systems

Operating Systems. V. Input / Output

INPUT/OUTPUT ORGANIZATION

CMSC 313 Lecture 26 DigSim Assignment 3 Cache Memory Virtual Memory + Cache Memory I/O Architecture

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

CS 5460/6460 Operating Systems

CSCI-GA Operating Systems I/O. Hubertus Franke

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy

Today: Computer System Overview (Stallings, chapter ) Next: Operating System Overview (Stallings, chapter ,

Generic Model of I/O Module Interface to CPU and Memory Interface to one or more peripherals

Computer System Overview

Computer Architecture and OS. EECS678 Lecture 2

CSC 553 Operating Systems

ELEC 377 Operating Systems. Week 1 Class 2

Chapter 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

Lecture 13 Input/Output (I/O) Systems (chapter 13)

Sistemi in Tempo Reale

CS510 Operating System Foundations. Jonathan Walpole

Input/Output Systems

John Wawrzynek & Nick Weaver

Computer System Architecture. CMPT 300 Operating Systems I. Summer Segment 3: Computer System Architecture. Melissa O Neill

Chapter 5 B. Large and Fast: Exploiting Memory Hierarchy

Operating Systemss and Multicore Programming (1DT089)

CS5460: Operating Systems

Transcription:

1

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

Canonical System Hardware CPU: Processor to perform computations Memory: Programs and data I/O Devices: Disk, monitor, printer, System Bus: Communication channel between the above 3

4

CPU CPU Semiconductor device, digital logic (combinational and sequential) Can be viewed as a combination of many circuits Clock Synchronizes constituent circuits Registers CPU s scratchpads; very fast; loads/stores Most CPUs designed so that a register can store a memory address n-bit architecture Cache Fast memory close to CPU Faster than main memory, more expensive Not seen by the OS 5

CPU Instruction Execution Arithmetic Logic Unit (ALU) Program counter Instruction address Instruction from the control unit (F) CPU data registers Input A and B and Output R 6

Memory/RAM Semiconductor device DIMMs mounted on PCBs Random access: RAM DRAM: Volatile, need to refresh Capacitors lose contents within few tens of msecs CPU accesses RAM to fill registers OS sees and manages memory Programs/data need to be brought to RAM Memory controller: Chip that implements the logic for Reading/Writing to RAM (Mux/Demux) Refreshing DRAM contents 7

Instructions Memory Access Program counter is used to fetch into control unit Fetched into instruction register Data Load/store instructions Move data between memory locations 8

I/O Devices Large variety, varying speeds Disk, tape, monitor, mouse, keyboard, NIC Serial vs parallel Each has a controller Hides low-level details from OS Manages data flow between device and CPU/memory 9

Hard Disk Secondary storage Mechanically operated Sequential access Cheap => Abundant Very slow Orders of magnitude 10

Interconnects A bus is an interconnect for flow of data and information Wires, protocol Data arbitration System Bus PCI Bus Connects CPU-memory subsystem to Fast devices Expansion bus that connects slow devices SCSI, IDE, USB, Will return to these later 11

12

Architectural Support Expected by Modern OSes 13

Services & Hardware Support Protection: Kernel/User mode, Protected Instructions, Base & Limit Registers Scheduling: Timer System Calls: Trap Instructions Efficient I/O: Interrupts, Memory-mapping Synchronization: Atomic Instructions Virtual Memory: Translation Lookaside Buffer (TLB) 14

Kernel/User Mode A modern CPU has at least two modes Indicated by status bit in protected CPU register OS runs in privileged mode Also called kernel or supervisor mode Applications run in normal mode Pentium processor has 4 modes Events that need the OS to run switch the processor to priv. mode E.g., division by zero OS can switch the processor to user mode OS definition: Software that runs in priv. mode 15

Protected Instructions Instructions that require privilege Direct access to I/O Modify page table pointers, TLB Enable & disable interrupts Halt the machine, etc. Access sensitive registers or perform sensitive operations 16

Base and Limit Registers Hardware support to protect memory regions Loaded by OS before starting program CPU checks each reference Instruction & data addresses Ensures reference in range 17

Interrupts Polling = are we there yet? no! (repeat ) Inefficient use of resources Annoys the CPU Interrupt = silence, then: we re there I/O device has own processor When finished, device sends interrupt on bus CPU handles interrupt 18

Interrupts Asynchronous signal indicating need for attention Replaces polling for events Represent Normal events to be noticed and acted upon Device notification Software system call Abnormal conditions to be corrected Abnormal conditions that cannot be corrected 19

Hardware Interrupts Signal from a device Implemented by a controller (e.g., memory) Examples Timer Keyboard, mouse End of DMA transfer Response to processor request Unsolicited response 20

Timer OS needs timers for Time of day CPU scheduling Interrupt vector for timer 21

Software Interrupts Software interrupts (Traps) Special interrupt instructions int 0x80 -- System call Exceptions Some can be fixed (e.g., page fault) Some cannot (e.g., divide by zero) All invoke OS, just like a hardware interrupt 22

Interrupt Handling Each interrupts has a corresponding Interrupt Handler When an interrupt request (IRQ) is received If interrupt mask allows interrupt Save state of current processing At time of interrupt something else may be running State: Registers (stack ptr), program counter, etc. Execute handler Return to current processing 23

Interrupt Handling 24

Multiple Interrupts 25

Device Access Port I/O Uses special I/O instructions Port number, device address Separate from process address space Memory-mapped I/O Uses memory instructions (load/store) To access memory-mapped device registers Does not require special instructions But consumes some memory for I/O 26

Device Access 27

Direct Memory Access Direct access to I/O controller through memory Reserve area of memory for communication with device ( DMA ) Video RAM: CPU writes frame buffer Video card displays it Fast and convenient 28

Synchronization How can OS synchronize concurrent processes? E.g., multiple threads, processes & interrupts, DMA CPU must provide mechanism for atomicity Series of instructions that execute as one or not at all 29

Synchronization: How-To One approach: Disable interrupts Perform action Enable interrupts Advantages: Requires no hardware support Conceptually simple Disadvantages: Could cause starvation 30

Synchronization: How-To, II Modern approach: atomic instructions Small set of instructions that cannot be interrupted Examples: Test-and-set ( TST ) if word contains given value, set to new value Compare-and-swap ( CAS ) if word equals value, swap old value with new Intel: LOCK prefix (XCHG, ADD, DEC, etc.) Used to implement locks 31

Process Address Space All locations addressable by the process Virtual address space Can restrict use of addresses (RW) Restrictions enforced by OS 32

Virtual Memory Provide the illusion of infinite memory OS loads pages from disk as needed Page: Fixed sized block of data Many benefits Allows the execution of programs that may not fit entirely in memory (think MS Office) OS needs to maintain mapping between physical and virtual memory Page tables stored in memory 33

Translation Lookaside Buffer (TLB) Initial virtual memory systems used to do translation in software Meaning the OS did it An additional memory access for each memory access! S.l.o.w.!!! Modern CPUs contain hardware to do this: the TLB Fast cache Modern workloads are TLB-miss dominated Good things often come in small sizes We have see other instances of this 34

Summary Modern architectures provide lots of features to help the OS do its job Protection mechanisms (modes) Interrupts Device I/O Synchronization Virtual Memory (TLB) Otherwise impossible or impractically slow in software Which of these are essential? Which are useful but not essential? 35

Next time: Operating system intro 36