1 Computer System Overview Let’s figure out what’s inside this thing...

Slides:



Advertisements
Similar presentations
Computer System Overview
Advertisements

Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer System Overview
1 Computer System Overview OS-1 Course AA
1 CSIT431 Introduction to Operating Systems Welcome to CSIT431 Introduction to Operating Systems In this course we learn about the design and structure.
Abhinav Kamra Computer Science, Columbia University 2.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 2: Computer-System Structures.
Computer System Overview
Chapter 7 Interupts DMA Channels Context Switching.
Chapter 1 and 2 Computer System and Operating System Overview
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.
Computer System Overview Chapter 1. Basic computer structure CPU Memory memory bus I/O bus diskNet interface.
A. Frank - P. Weisberg Operating Systems Functional View of Operating System.
CS 345 Stalling’s Chapter # Project 1: Computer System Overview
Chapter 2: Computer-System Structures
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
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.
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Computer Systems Overview. Page 2 W. Stallings: Operating Systems: Internals and Design, ©2001 Operating System Exploits the hardware resources of one.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
Chapter 1 Computer System Overview Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
2.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 2: Computer-System Structures Computer System Operation I/O Structure.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
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
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
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 and Networks AE4B33OSS Introduction.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 1 Computer System Overview.
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.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
Fall 2000M.B. Ibáñez Lecture 25 I/O Systems. Fall 2000M.B. Ibáñez Categories of I/O Devices Human readable –used to communicate with the user –video display.
Operating System Isfahan University of Technology Note: most of the slides used in this course are derived from those of the textbook (see slide 4)
Operating System 1 COMPUTER SYSTEM OVERVIEW Achmad Arwan, S.Kom.
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.
Lecture 1: Review of Computer Organization
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Chapter 2: Computer-System Structures(Hardware) or Architecture or Organization Computer System Operation I/O Structure Storage Structure Storage Hierarchy.
1 Computer Architecture. 2 Basic Elements Processor Main Memory –volatile –referred to as real memory or primary memory I/O modules –secondary memory.
Chapter 2. Computer-System Structure Device controllers: synchronize and manage access to devices.
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Computer Systems Overview. Lecture 1/Page 2AE4B33OSS W. Stallings: Operating Systems: Internals and Design, ©2001 Operating System Exploits the hardware.
1 Computer System Overview Chapter 1. 2 Operating System Exploits the hardware resources of one or more processors Provides a set of services to system.
Computer System Overview
Chapter 1 Computer System Overview
Computer System Overview
Computer-System Architecture
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 1 Computer System Overview
Computer System Overview
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

1 Computer System Overview Let’s figure out what’s inside this thing...

2 Computer Systems  Registers  Interrupts  Caching  Input/Output  Protection  Summary

3 CPU Registers

4 Processor Registers  User-visible registers  May be referenced by machine language  Available to all programs - application programs and system programs  Data Registers – can be changed by user  Address Registers – could be separate from data register  Stack Registers – user / supervisor stacks  Condition Codes – results of operations  Control and status registers  May or may not be visible  Program Counter (PC) – address of next instruction  Instruction Register (IR) – most recently fetched instruction  MAR/MBR – memory reference registers  Program Status Word (PSW) – condition codes, interrupts, mode Registers

5 Instruction Execution  Processor executes instructions in a program  Instructions are fetched from memory on at a time START HALT Fetch Next Instruction Fetch Next Instruction Execute Instruction Execute Instruction Fetch CycleExecute Cycle Registers

6 Lots of Registers …

7 Computer Systems  Registers  Interrupts  Caching  Input/Output  Protection  Summary

8 Interrupts  The interrupt was the principle tool available to system programmers in developing multi- tasking systems!  Improves processing efficiency by allowing the processor to execute other instructions while an I/O operation is in progress  A suspension of a process caused by an event external to that process and performed in such a way that the process can be resumed Interrupts

9 Processing of Interrupts  Classes of Interrupts  Program  arithmetic overflow  division by zero  execute illegal instruction  reference outside user ’ s memory space  Timer  I/O  Hardware failure  An interrupt handler determines nature of the interrupt and performs whatever actions are needed  Control is transferred to this program  Generally part of the operating system Interrupts

10 Interrupt Cycle  Processor checks for interrupts  If no interrupts fetch the next instruction for the current program  If an interrupt is pending, suspend execution of the current program, and execute the interrupt handler Interrupts HALT Fetch Next Instruction Fetch Next Instruction Execute Instruction Execute Instruction Check for Interrupt: Process Interrupt Check for Interrupt: Process Interrupt Fetch CycleExecute CycleInterrupt Cycle Interrupts Disabled Interrupts Enabled START

11 Simple Interrupt Processing Device controller or other system hardware issues an interrupt Processor finishes execution of current instruction Processor signals acknowledgment of interrupt Processor pushes PSW and PC onto control stack Processor loads new PC value based on interrupt Save remainder of process state information Process interrupt Restore process state information Restore old PSW and PC Interrupts

12 Multiple Interrupts  2 Choices  Disable Interrupts  Disable upon entering an interrupt handler  Enable upon exiting  Allow Interrupts  Allow an interrupt handler to be interrupted  Priorities? Interrupts

13 Multiple Interrupts - Sequential Order  Disable interrupts so processor can complete task  Interrupts remain pending until the processor enables interrupts  After interrupt handler routine completes, the processor checks for additional interrupts  What happens to the interrupts that occur when disabled? Interrupts

14 Multiple Interrupts - Priorities  Higher priority interrupts cause lower-priority interrupts to wait  Causes a lower-priority interrupt handler to be interrupted  Example when input arrives from communication line, it needs to be absorbed quickly to make room for more input  How does this change interrupt handlers? Interrupts

15 Computer Systems  Registers  Interrupts  Caching  Input/Output  Protection  Summary

16 Storage-Device Hierarchy

17 Memory Hierarchy Registers Cache Main Memory Disk Cache Magnetic Disk Magnetic TapeOptical Disk More Expensive Faster & Smaller Bigger Slower Caching

18 Comparative access timings  Processor registers: 5 nanoseconds  SRAM memory: 15 nanoseconds  DRAM memory: 60 nanoseconds  Magnetic disk: 10 milliseconds  Optical disk: (even slower)

19 System design decisions  How much memory?  How fast?  How expensive?  Tradeoffs and compromises  Modern systems employ a ‘hybrid’ design in which small, fast, expensive SRAM is supplemented by larger, slower, cheaper DRAM

20 Memory hierarchy CPU CACHE MEMORY MAIN MEMORY ‘word’ transfers ‘burst’ transfers

21 Memory Cache  Given:  Processor speed is faster than memory speed  Execution/data localizes  Cache:  Contains a portion of main memory  Invisible to operating system  Used similar to virtual memory  Increases the speed of memory  Processor first checks cache  If not found in cache, the block of memory containing the needed information is moved to the cache Caching

22 Cache Design  Cache size  small caches have a significant impact on performance  Block size  the unit of data exchanged between cache and main memory  hit means the information was found in the cache  larger block size more hits until probability of using newly fetched data becomes less than the probability of reusing data that has been moved out of cache Caching

23 Cache Design  Mapping function  Determines which cache location the block will occupy  Replacement algorithm  Determines which block to replace  Least-Recently-Used (LRU) algorithm  Write policy  write a block of cache back to main memory  main memory must be current for direct memory access by I/O modules and multiple processors Caching

24 Disk Cache  A portion of main memory used as a buffer to temporarily to hold data for the disk  Disk writes are clustered  Some data written out may be referenced again. The data are retrieved rapidly from the software cache instead of slowly from disk Caching

25 Computer Systems  Registers  Interrupts  Caching  Input/Output  Protection  Summary

26 Programmed I/O  I/O module performs the action, not the processor  Sets appropriate bits in the I/O status register  No interrupts occur  Processor is kept busy checking status Input/Output

27 Interrupt-Driven I/O  Processor is interrupted when I/O module ready to exchange data  Processor is free to do other work  No needless waiting  Consumes a lot of processor time because every word read or written passes through the processor Input/Output

28 Direct Memory Access  Transfers a block of data directly to or from memory  An interrupt is sent when the task is complete  The processor is only involved at the beginning and end of the transfer  What does this mean with respect to a paged system? Input/Output

29 Important example: Hard Disks  Our classrooms and labs have PCs that use IDE fixed-disks for storage of files  IDE means ‘Intelligent Drive Electronics’  The programming interface for IDE drives conforms to an official documented ANSI standard (American National Standards Institute)  We present enough details for an example

30 ‘IDENTIFY DRIVE’  There exist about 40 different commands (e.e., read, write, seek, format, sleep, etc)  Some are ‘mandatory’, others ‘optional’  An example: the ‘Identify Drive’ command  It provides information on disk’s geometry and some other operational characteristics  It identifies the disk’s manufacturer and it provides a unique disk serial-number

31 IDE Command Protocol  IDE Commands typically have 3 phases:  COMMAND PHASE: CPU issues a command  DATA PHASE: data moves to/from IDE buffer  RESULT PHASE: CPU reads status/errors

32 The IDE Controller IDE Controller CPU system bus Slave Drive (Drive 1) Master Drive (Drive 0) optional Memory

33 COMMAND PHASE  Wait until the IDE controller is ‘not busy’  Disable interrupts (to prevent preemption)  Confirm ‘drive ready’ status  Issue the ‘IDENTIFY DRIVE’ command

34 DATA-TRANSFER PHASE  Continuously poll the Status Register until the DRQ (Data-Transfer Requested) bit is set, indicating that the data has been transferred into the controller’s internal ‘sector-buffer’ (size is 256 words)  Read the IDE Data-Register 256-times, saving the values into a memory area

35 RESULT PHASE  Verify that the DRQ status-bit is now clear, indicating Data-Transfer Phase is finished  Check the ERR status-bit, to see if errors occurred, and if so, read the Error Register to obtain details about what went wrong  Re-enable interrupts (so multitasking can resume)

36 Computer Systems  Registers  Interrupts  Caching  Input/Output  Protection  Summary

37 Hardware Protection  Why protect hardware?  From what?  Shared hardware resources – memory, disk, …  Errant programs  How?  CPU provides 2 modes of operation  User Mode (non-privileged)  Supervisor mode (privileged)  Privileged instructions can only be executed in monitor mode  All I/O instructions are privileged Protection

38 Dual-Mode Operation (Cont.)  Mode bit added to computer hardware to indicate the current mode: monitor (0) or user (1).  When an interrupt or fault occurs hardware switches to monitor mode. Privileged instructions can be issued only in monitor mode. monitoruser Interrupt/fault set user mode

39 Memory Protection  We must not allow a program access to memory outside of its space.  How? Add two registers  Base  Limit  Use the registers to check every reference Protection OS Job 1 Job 2 Job 4 Job Base Limit

40 Hardware Address Protection

41 CPU Protection  What is there to protect?  Configuration  CPU as a resource  Timer  Task Switching uses the timer  When process is loaded timer is set  Timer is decremented each cycle  When time is zero, an interrupt is generated  Process is switched  Load-timer is a privileged instruction Protection

42 I/O Protection  All I/O instructions are privileged instructions.  Must ensure that a user program could never gain control of the computer in monitor mode (I.e., a user program that, as part of its execution, stores a new address in the interrupt vector).

43 Protect at all cost?  If all I/O instructions are protected, how do you perform input or output?  System calls  Often the call is a trap to a ISR (Interrupt Service Routine)  Control is passed to the ISR which sets the mode bit to monitor mode  ISR verifies that parameters are correct  ISR executes request, resets mode  Control is returned to user program Protection