1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.

Slides:



Advertisements
Similar presentations
WHAT IS AN OPERATING SYSTEM? An interface between users and hardware - an environment "architecture ” Allows convenient usage; hides the tedious stuff.
Advertisements

Chapter 6 Limited Direct Execution
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Input-output and Communication Prof. Sin-Min Lee Department of Computer Science.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
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.
1 CSE451 Operating Systems Winter 2009 Module 2 Architectural Support Mark Zbikowski Gary Kimura.
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.
Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the.
OS and the Computer System  Some OS programs exist permanently in the system area of the memory to monitor and control activities in the computer 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.
Chapter 2 The OS, the Computer, and User Programs Copyright © 2008.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Protection and the Kernel: Mode, Space, and Context.
LOGO OPERATING SYSTEM Dalia AL-Dabbagh
Chapter 1. Introduction What is an Operating System? Mainframe Systems
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
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.
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.
CS 153 Design of Operating Systems Spring 2015 Lecture 2: Intro and Architectural Support for Operating Systems.
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.
Chapter 1: Introduction and History  Where does the operating system fit in a computing system?  What does the operating system achieve?  What are the.
Operating Systems CSE 411 Introduction and Overview Sept Lecture 2 Instructor: Bhuvan Urgaonkar.
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.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Processes and Virtual Memory
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
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.
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.
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.
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
CSCE451/851 Introduction to Operating Systems
Introduction to Operating Systems Concepts
Operating Systems CMPSC 473
CSE451 Operating Systems Winter 2011
Computer-System Architecture
Architectural Support for OS
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
CSE 451: Operating Systems Autumn 2005 Memory Management
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.
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Winter 2007 Module 2 Architectural Support for Operating Systems Brian Bershad 562 Allen Center 1.
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
Steve Gribble (for Hank Levy)
Operating Systems Structure
Presentation transcript:

1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications Operating System Hardware virtual machine interface physical machine interface

2 Today: OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features

3 Modern OS Functionality CPU management Concurrency (multiple simultaneous activities) How to achieve it? How to schedule? How to avoid conflict? Memory management Disk management I/O Device Management Advanced: support for distributed systems & networks

4 Operating Systems = Governments Infinite RAM, CPU Protect users from each other: safety Fair allocation of resources To each according to his needs Manage resources efficiently

5 Canonical System Hardware CPU: Processor to perform actual computations I/O devices: terminal, disks, video, printer… Memory: data & programs System Bus: Communication channel between above

6 Services & Hardware Support OS ServiceHardware Support ProtectionKernel/User Mode Protected Instructions Base & Limit Registers InterruptsInterrupt Vectors System CallsTrap Instructions I/OInterrupts, Memory-Mapping SynchronizationAtomic Instructions Virtual MemoryTranslation Lookaside Buffers SchedulingTimer

7 Protection OS protects users from each other Users cannot read or write other user’s memory Protects self from users Safe from errant or malicious users Code & data protected

8 Kernel Mode: Privileged Instructions CPU provides “kernel” mode restricted to OS Inaccessible to ordinary users Kernel = core of operating system Privileged instructions & registers: Direct access to I/O Modify page table pointers, TLB Enable & disable interrupts Halt the machine, etc. Indicated by status bit in protected CPU register

9 Protecting Memory: 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

10 Hardware Support OS ServiceHardware Support ProtectionKernel/User Mode Protected Instructions Base & Limit Registers InterruptsInterrupt Vectors TrapsTrap Instructions I/OInterrupts, Memory-Mapping SynchronizationAtomic Instructions Virtual MemoryTranslation Lookaside Buffers SchedulingTimer

11 Interrupts Interrupt: Let CPU work while doing I/O I/O is s..l..o..w for CPU I/O device has own processor When finished, device sends interrupt on bus CPU “handles” interrupt

12 CPU Interrupt Handling Handling interrupts: relatively expensive CPU must: Save hardware state (why?) 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

13 Hardware Support OS ServiceHardware Support ProtectionKernel/User Mode Protected Instructions Base & Limit Registers InterruptsInterrupt Vectors TrapsTrap Instructions I/OInterrupt vectors, Memory- Mapping SynchronizationAtomic Instructions Virtual MemoryTranslation Lookaside Buffers SchedulingTimer

14 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

15 Hardware Support OS ServiceHardware Support ProtectionKernel/User Mode Protected Instructions Base & Limit Registers InterruptsInterrupt Vectors TrapsTrap Instructions I/OInterrupt vectors, Memory- Mapping SynchronizationAtomic Instructions Virtual MemoryTranslation Lookaside Buffers SchedulingTimer

16 Memory-Mapped I/O 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

17 Hardware Support OS ServiceHardware Support ProtectionKernel/User Mode Protected Instructions Base & Limit Registers InterruptsInterrupt Vectors System CallsTrap Instructions I/OInterrupt vectors, Memory- Mapping SynchronizationAtomic Instructions Virtual MemoryTranslation Lookaside Buffers SchedulingTimer

18 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

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

20 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

21 Hardware Support OS ServiceHardware Support ProtectionKernel/User Mode Protected Instructions Base & Limit Registers InterruptsInterrupt Vectors System CallsTrap Instructions I/OInterrupt vectors, Memory- Mapping SynchronizationAtomic Instructions Virtual MemoryTranslation Lookaside Buffers SchedulingTimer

22 Virtual Memory Provides illusion of complete access to RAM All addresses translated from physical addresses into virtual addresses OS loads pages from disk as needed Keeps track of which pages are in memory (“in core”) and which are on disk Many benefits, including: Allows users to run programs without loading entire program into RAM May not fit in entirety (think MS Office)

23 Translation Lookaside Buffer First virtual memory systems performed address translation in software On every memory access! (s..l..o..w..) Modern CPUs contain hardware to do this: the TLB Hash-based scheme Maps virtual addresses to physical addresses Fast, fully-associative cache

24 Hardware Support OS ServiceHardware Support ProtectionKernel/User Mode Protected Instructions Base & Limit Registers InterruptsInterrupt Vectors System CallsTrap Instructions I/OInterrupt vectors, Memory- Mapping SynchronizationAtomic Instructions Virtual MemoryTranslation Lookaside Buffers SchedulingTimer

25 Scheduling & Timers OS needs timers for: Time of day CPU scheduling Fairness: limited quantum (e.g., 100ms) for each task When quantum expires, switch processes Uses interrupt vector

26 Summary OS relies on hardware for many services Protection Interrupts Traps Synchronization Virtual memory Timers Otherwise impossible or impractically slow in software

27 From Architecture to OS to User Architectural resources, OS services, user abstractions