Operating Systems CSE 411 Introduction and Overview Sept. 8 2006 - Lecture 2 Instructor: Bhuvan Urgaonkar.

Slides:



Advertisements
Similar presentations
Computer-System Structures Er.Harsimran Singh
Advertisements

1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
OS Spring’03 Introduction Operating Systems Spring 2003.
Hardware Support for Operating Systems Sunny Gleason Vivek Uppal COM S 414
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
A. Frank - P. Weisberg Operating Systems Functional View of Operating System.
OS Spring’04 Introduction Operating Systems Spring 2004.
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
What do operating systems do? manage processes manage memory and computer resources provide security features execute user programs make solving user.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Thanks to Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2 Computer-System Structures n Computer System Operation n I/O Structure.
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
Operating Systems CSE 411 Multi-processor Operating Systems Multi-processor Operating Systems Dec Lecture 30 Instructor: Bhuvan Urgaonkar.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Lecture 1: Review of Computer Organization
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Lecture on Central Process Unit (CPU)
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
بسم الله الرحمن الرحيم MEMORY AND I/O.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
CSCE451/851 Introduction to Operating Systems
Introduction to Operating Systems Concepts
Chapter 2: Computer-System Structures
Processes and threads.
Operating Systems CMPSC 473
Computer-System Architecture
Module 2: Computer-System Structures
Architectural Support for OS
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Module 2: Computer-System Structures
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
CSE 451: Operating Systems Winter 2007 Module 2 Architectural Support for Operating Systems Brian Bershad 562 Allen Center 1.
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Operating Systems Structure
Chapter 13: I/O Systems.
Presentation transcript:

Operating Systems CSE 411 Introduction and Overview Sept Lecture 2 Instructor: Bhuvan Urgaonkar

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

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

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

Memory/RAM Semiconductor device –DIMMs mounted on PCBs –Random access: RAM –DRAM: Volatile, need to refresh Capacitors lose contents within few tens of msecs 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

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

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

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

Interlude Recap of OS goals –Resource management –Services to programs/applications

Functionality Expected from a Modern OS

Libertarian View Everyone should get to do whatever they want –As long as they let others live Processes should feel they have the entire computer –Infinite CPU, RAM, … –No threat of someone harming them

Socialistic View To each acc. to his needs –Co-operative existence enforced by govt/OS –Fair allocation of resources

OS as a Communist Govt. Centralized control and monitoring Allocate resources efficiently Misbehavior => Termination

Theory vs. Practice Performance –Efficient and fair resource allocation, illusion of unlimited resources Isolation –Protect everyone from each other and from the OS Secure communication How to do this efficiently? –Hardware support

Architectural Support Expected by Modern OSes

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

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 than runs in priv. mode

Protected Instructions Privileged instructions & registers: –Direct access to I/O –Modify page table pointers, TLB –Enable & disable interrupts –Halt the machine, etc.

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

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

CPU Interrupt Handling Handling interrupts: relatively expensive CPU must: –Save hardware state Registers, program counter –Disable interrupts (why?) –Invoke via in-memory interrupt vector (like trap vector, soon) –Enable interrupts –Restore hardware state –Continue execution of interrupted process

Traps Special conditions detected by architecture –E.g.: page fault, write to read-only page, overflow, system call On detecting trap, hardware must: –Save process state (PC, stack, etc.) –Transfer control to trap handler (in OS) CPU indexes trap vector by trap number Jumps to address –Restore process state and resume

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

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

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

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

Memory-mapping 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

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

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

Summary Modern architectures provide lots of features to help the OS do its job –TLB –Base and Limit registers –Multiple modes –Interrupts –Timers –Atomic instructions Otherwise impossible or impractically slow in software Which of these are essential? Which are useful but not essential?

Next time: CPU Management