Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.

Slides:



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

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chapter 6 Limited Direct Execution
CS 153 Design of Operating Systems Spring 2015 Lecture 3: Intro and Architectural Support for Operating Systems.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
1 CSE451 Operating Systems Winter 2009 Module 2 Architectural Support Mark Zbikowski Gary Kimura.
Operating System and Computer Organization Background CS 502 Spring 99 WPI MetroWest/Southboro Campus.
OS Spring’03 Introduction Operating Systems Spring 2003.
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.
Exceptions, Interrupts & Traps
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
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.
System Calls 1.
COMP201 Computer Systems Exceptions and Interrupts.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
2.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 2: Computer-System Structures Computer System Operation I/O Structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Chapter 2: Computer-System Structures
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.
Chapter 2: Computer-System Structures 2.1 Computer System Operation 2.5 Hardware Protection 2.6 Network Structure.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
Lecture Topics: 10/29 Architectural support for operating systems –timers –kernel mode –system calls –protected instructions.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
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.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
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.
Of Privilege, Traps, Interrupts & Exceptions Prof. Sirer CS 316 Cornell University.
Chapter 2: Computer-System Structures
Operating Systems CMPSC 473
CSE451 Operating Systems Winter 2012
Anton Burtsev February, 2017
Day 08 Processes.
Day 09 Processes.
CSE451 Operating Systems Winter 2011
CSE 120 Principles of Operating
CSE 451: Operating Systems Spring 2006 Module 2 Architectural Support for Operating Systems John Zahorjan 534 Allen Center.
Computer-System Architecture
Module 2: Computer-System Structures
CSE 451: Operating Systems Winter 2006 Module 2 Architectural Support for Operating Systems Ed Lazowska 570 Allen Center 1.
CSE 153 Design of Operating Systems Winter 18
Architectural Support for OS
CSE 451: Operating Systems Autumn 2004 Module 2 Architectural Support for Operating Systems Hank Levy 1.
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 Spring 2005 Module 2 Architectural Support for Operating Systems Ed Lazowska 570 Allen Center 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
CSE 451: Operating Systems Winter 2004 Module 2 Architectural Support for Operating Systems Ed Lazowska 570 Allen Center 1.
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Steve Gribble (for Hank Levy)
Module 2: Computer-System Structures
Operating Systems Structure
Presentation transcript:

Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy

26/13/2015 OS and Architectures What an OS can do is dictated, at least in part, by the architecture. Architecture support can greatly simplify (or complicate) OS tasks Example: PC operating systems have been primitive, in part because PCs lacked hardware support (e.g., for VM)

36/13/2015 Architectural Features for OS Features that directly support OS needs include: –1. timer (clock) operation –2. sychronization (atomic instructions) –3. memory protection –4. I/O control and operation –5. interrupts and exceptions –6. OS protection (kernel/user mode) –7. protected instructions –8. system calls

46/13/2015 Protected Instructions some instructions are typically restricted to the O.S. –users cannot be allowed direct access to I/O (disks, printers, etc) [can be done through either privileged instructions or through memory mapping] –must control instructions that manipulate memory management state (page table pointers, TLB load, etc) –setting of special mode bits (kernel mode) –halt instruction

56/13/2015 OS Protection How do we know if we can execute a protected instruction? –architecture must support (at least) two modes of operation: kernel mode and user mode –mode is indicated by a status bit in a protected processor register –user programs execute in user mode; the os executes in kernel mode Protected instructions can only be executed in kernel mode.

66/13/2015 Crossing Protection Boundaries For a user to do something “privileged” (e.g., I/O) it must call an OS procedure. How does a user-mode program call a kernel-mode service? There must be a system call instruction that: –causes an exception, which vectors to a kernel handler –passes a parameter, saying which system routine to call –saves caller’s state (PC, mode bit) so it can be restored –arch must permit os to verify caller’s parameters –must provide a way to return to user mode when done

Protection Modes and Crossing 7 OS Kernel User Programs system call trap to kernel mode trap handler system service routine return to user mode kernel mode user mode

Memory Protection must be able to protect user programs from each other must protect OS from user programs may or may not protect user programs from OS simplest scheme is base and limit registers: 8 base register limit register Prog A Prog B Prog C •base and limit registers are loaded by the OS before starting a program •virtual memory and segmentation are similar memory

96/13/2015 Exceptions hardware must detect special conditions: page fault, write to a read-only page, overflow, trace trap, odd address trap, privileged instruction trap, syscall... must transfer control to handler within the O.S. hardware must save state on fault (PC, etc) so that the faulting process can be restarted afterwards modern operating systems use VM traps for many functions: debugging, distributed VM, garbage collection, copy-on- write... exceptions are a performance optimization, i.e., conditions could be detected by inserting extra instructions in the code (at high cost)

106/13/2015 I/O Control I/O issues: –how to start an I/O (special instructions or memory- mapped I/O –I/O completion (interrupts) Interrupts are the basis for asynchronous I/O –device controller performs an operation asynch to CPU –device sends an interrupt signal on bus when done –in memory is a vector table containing a list of addresses of kernel routines to handle various events –CPU switches to address indicated by vector specified by the interrupt signal

I/O Control (cont) 11 device interrupts CPU stops current operation, switches to kernel mode, and saves current PC and other state on kernel stack CPU fetches proper vector from vector table and branches to that address (to routine to handle interrupt) interrupt routine examines device database and performs action required by interrupt handler completes operation, restores saved (interrupted state) and returns to user mode (or calls scheduler to switch to another program)

126/13/2015 Timer Operation how does the OS prevent against runaway user programs (infinite loops)? a timer can be set to generate an interrupt in a given time before it transfers to a user program, the OS loads the timer with a time to interrupt when the time arrives, the executing program is interrupted and the OS regains control this ensures that the OS can get the CPU back even if a user program erroneously or purposely continues to execute past some allotted time. the timer is privileged: only the OS can load it

136/13/2015 Synchronization Interrupts cause potential problems because an interrupt can occur at any time -- causing code to execute that interferes with code that was interrupted OS must be able to synchronize concurrent processes. This involves guaranteeing that short instruction sequences (read-modify-write) execute atomically. One way to guarantee this is to turn off interrupts before the sequence, execute it, and re-enable interrupts; CPU must have a way to disable interrupts. Another is to have special instructions that can perform a read/modify/write in a single cycle, or can atomically test and conditionally set a bit, based on its previous value.