15-410, S’04 - 1 - Hardware Overview Jan. 19, 2004 Dave Eckhardt Bruce Maggs L04_Hardware 15-410 “Dude, what were you thinking?”

Slides:



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

CS 4284 Systems Capstone Godmar Back Processes and Threads.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 3 Operating System Organization.
Exceptional Control Flow Processes Today. Control Flow Processors do only one thing: From startup to shutdown, a CPU simply reads and executes (interprets)
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
The Kernel Abstraction. Challenge: Protection How do we execute code with restricted privileges? – Either because the code is buggy or if it might be.
Chapter 6 Limited Direct Execution
1 Operating Systems and Protection CS Goals of Today’s Lecture How multiple programs can run at once  Processes  Context switching  Process.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
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.
Computer System Organization S H Srinivasan
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
OS Spring’04 Introduction Operating Systems Spring 2004.
Midterm Wednesday 11/19 Overview: 25% First Midterm material - Number/character representation and conversion, number arithmetic - DeMorgan’s Law, Combinational.
Chapter 2: Computer-System Structures
Chapter 2 The OS, the Computer, and User Programs Copyright © 2008.
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
1 CSC 2405: Computer Systems II Spring 2012 Dr. Tom Way.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
System Calls 1.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
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.
Fall 2012 Chapter 2: x86 Processor Architecture. Irvine, Kip R. Assembly Language for x86 Processors 6/e, Chapter Overview General Concepts IA-32.
15-410, S’ Hardware Overview Jan. 19, 2004 Dave Eckhardt Bruce Maggs L04_Hardware “Computers make very fast, very accurate mistakes.” --Brandon.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
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.
1.4 Hardware Review. CPU  Fetch-decode-execute cycle 1. Fetch 2. Bump PC 3. Decode 4. Determine operand addr (if necessary) 5. Fetch operand from memory.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
15-410, S’ The Process Jan. 21, 2004 Dave Eckhardt Bruce Maggs L05_Process “System call abuse for fun & profit”
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.
Structure and Role of a Processor
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
1 Hardware Overview Dave Eckhardt
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
“Computers make very fast, very accurate mistakes.”
Introduction to Operating Systems Concepts
Chapter Overview General Concepts IA-32 Processor Architecture
Introduction to Operating Systems
Interrupts and signals
Operating Systems Engineering
CS 6560: Operating Systems Design
Protection of System Resources
Overview of today’s lecture
CS 3305 System Calls Lecture 7.
CS 301 Fall 2002 Computer Organization
Fundamentals of Computer Organisation & Architecture
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Architectural Support for OS
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 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
System Calls System calls are the user API to the OS
Chapter 13: I/O Systems.
Presentation transcript:

15-410, S’ Hardware Overview Jan. 19, 2004 Dave Eckhardt Bruce Maggs L04_Hardware “Dude, what were you thinking?”

15-410, S’ Synchronization Today's class Not exactly Chapter 2 or 13Wednesday Project 0 is due Lecture on “The Process”

15-410, S’ Outline Computer hardware CPU State Fairy tales about system calls CPU context switch (intro) Interrupt handlers Interrupt masking

15-410, S’ Inside The Box - Historical/Logical

15-410, S’ Inside The Box - Really

15-410, S’ CPU State User registers (on Planet Intel) General purpose - %eax, %ebx, %ecx, %edx Stack Pointer - %esp Frame Pointer - %ebp Mysterious String Registers - %esi, %edi

15-410, S’ CPU State Non-user registers, a.k.a.... Processor status register(s) User process / Kernel process Interrupts on / off Virtual memory on / off Memory model small, medium, large, purple, dinosaur

15-410, S’ CPU State Floating Point Number registers Logically part of “User registers” Sometimes special instead Some machines don't have floating point Some processes don't use floating point

15-410, S’ Story time! Time for some fairy tales The getpid() story (shortest legal fairy tale) The read() story (toddler version) The read() story (grade-school version)

15-410, S’ The Story of getpid() User process is computing User process calls getpid() library routine Library routine executes TRAP(314159) The world changes Some registers dumped into memory somewhere Some registers loaded from memory somewhere The processor has entered kernel mode

15-410, S’ User Mode

15-410, S’ Entering Kernel Mode

15-410, S’ Entering Kernel Mode

15-410, S’ The Kernel Runtime Environment Language runtimes differ ML: no stack, “nothing but heap” C: stack-based Processor is mostly agnostic Trap handler builds kernel runtime environment Switches to correct stack Turns on virtual memory Flushes caches

15-410, S’ The Story of getpid() Process in kernel mode running->u_reg[R_EAX] = running->u_pid; Return from interrupt Processor state restored to user mode (modulo %eax) User process returns to computing Library routine returns %eax as value of getpid()

15-410, S’ Returning to User Mode

15-410, S’ A Story About read() User process is computing count = read(0, buf, sizeof (buf)); User process “goes to sleep” Operating system issues disk read Time passes Operating system copies data User process wakes up

15-410, S’ Another Story About read() P1: read() Trap to kernel mode Kernel: issue disk read Kernel: switch to P2 Return from interrupt - but to P2, not P1! P2: compute 1/3 of Mandelbrot set

15-410, S’ Another Story About read() Disk: done! Interrupt to kernel mode Kernel: switch to P1 Return from interrupt - but to P1, not P2!

15-410, S’ Interrupt Vector Table How does CPU handle this interrupt? Disk interrupt -> disk driver Mouse interrupt -> mouse driver Need to know Where to dump registers often: property of current process, not of interrupt New register values to load into CPU key: new program counter, new status register

15-410, S’ IA32 Single-Task Mode Example Interrupt/Exception while in kernel mode (Project 1) Interrupt/Exception while in kernel mode (Project 1) Hardware pushes registers on current stack, NO STACK CHANGE Hardware pushes registers on current stack, NO STACK CHANGE 1. EFLAGS (processor state) 2. CS/EIP (return address) 3. Error code (if interrupted exception procedure wants to) From intel-sys.pdf

15-410, S’ Interrupt Vector Table Table lookup Interrupt controller says: this is interrupt source #3 CPU knows table base pointer, table entry size Spew, slurp, off we go

15-410, S’ Race Conditions if (device_idle) start_device(request); else enqueue(request);

15-410, S’ Race Conditions

15-410, S’ Interrupt masking Atomic actions Block device interrupt while checking and enqueueing Or use a lock-free data structure [left as an exercise for the reader] Avoid blocking all interrupts [not a big issue for ] Avoid blocking too long Part of Project 3 grading criteria

15-410, S’ Timer – Behavior Count something CPU cycles, bus cycles, microseconds When you hit a limit, generate an interrupt Reload counter (don't wait for software to do it)

15-410, S’ Timer – Why? Why interrupt a perfectly good execution? Avoid CPU hogs for (;;) ; Maintain accurate time of day Battery-backed calendar counts only seconds (poorly) Dual-purpose interrupt ++ticks_since_boot; force process switch (probably)