1 Hardware Overview Dave Eckhardt

Slides:



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

1/1/ / faculty of Electrical Engineering eindhoven university of technology Memory Management and Protection Part 3:Virtual memory, mode switching,
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.
CS 4284 Systems Capstone Godmar Back Processes and Threads.
1 Exceptions, Interrupts & Traps Operating System Hebrew University Spring 2007.
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.
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.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
OS Spring’03 Introduction Operating Systems Spring 2003.
Computer System Overview
Computer System Organization S H Srinivasan
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.
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.
System Calls 1.
Protection and the Kernel: Mode, Space, and Context.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
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,
Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
Practice Exercises Chapter one and three.
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.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
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.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
15-410, S’ Hardware Overview Jan. 19, 2004 Dave Eckhardt Bruce Maggs L04_Hardware “Dude, what were you thinking?”
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.
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.
1 The Process Dave Eckhardt 1 Synchronization ● Exam flavor? – Is 50 minutes enough? – Two mid-terms? Evening exam? ● Concurrency.
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
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.
“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
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
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
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Chapter 1: Introduction CSS503 Systems Programming
Chapter 13: I/O Systems.
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

1 Hardware Overview Dave Eckhardt

1 Synchronization ● Today's class – Not exactly Chapter 2 or 13 ● Friday's class – Project 1 talk (probably relevant to you) ● Being registered is good – Disk space, access control lists, etc.

1 Outline ● Computer parts ● CPU State ● Fairy tales about system calls ● CPU context switch (intro) ● Interrupt handlers ● Interrupt masking

1 Inside The Box - Historical/Logical

1 Inside The Box - Really

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

1 CPU State ● Non-user registers, aka... ● Processor status register(s) – User process / Kernel process – Interrupts on / off – Virtual memory on / off – Memory model ● small, medium, large, purple, dinosaur

1 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

1 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)

1 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 ● (else) ● The processor has entered kernel mode

1 User Mode

1 Entering Kernel Mode

1

1 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

1 The Story of getpid() ● Process in kernel mode – u.u_reg[R_EAX] = u.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()

1 Returning to User Mode

1 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

1 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

1 Another Story About read() ● Disk: done! – Interrupt to kernel mode ● Kernel: switch to P1 – Return from interrupt - but to P1, not P2!

1 What do you need for P1? ● Single-process “operating system” ● Only one C runtime environment – One memory address space, one stack ● Process based on polling ● while(1) ● if (time_to_move(paddle)) ● move_paddle(); ● if ((c = getchar()) != NONE) ● process_char(c);

1 What do you need for P1? ● Keyboard interrupt handler – Turns key up/down events into characters – Makes characters available to getchar() ● [not its real name] ● Timer interrupt handler – Updates “now” when countdown timer fires ● Console driver – Put/scroll characters/strings on screen

1 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

1 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

1 Race Conditions ● if (device_idle) ● start_device(request); ● else ● enqueue(request);

1 Race Conditions

1 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

1 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)

1 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)

1 Closing ● Welcome to the machine – For P1 ● Keyboard ● Clock ● Screen ● Memory (a little) ● Browse Intel document introductions? ● Start choosing a partner for P2