Today: Computer System Overview (Stallings, chapter ) Next: Operating System Overview (Stallings, chapter ,

Similar documents
CSE 410. Operating Systems

Chapter 1 Computer System Overview

Chapter 1 Computer System Overview

CSC 553 Operating Systems

Computer Systems Overview

Computer System Overview. Chapter 1

Computer System Overview

Computer System Overview

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

Computer-System Architecture (cont.) Symmetrically Constructed Clusters (cont.) Advantages: 1. Greater computational power by running applications

5.b Principles of I/O Hardware CPU-I/O communication

Input / Output. School of Computer Science G51CSA

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION

Operating Systems: Internals and Design Principles, 7/E William Stallings. Chapter 1 Computer System Overview

CSCI-375 Operating Systems

Chapter 1 Computer System Overview

Basic Computer Hardware

Q.1 Explain Computer s Basic Elements

Misc. Third Generation Batch Multiprogramming. Fourth Generation Time Sharing. Last Time Evolution of OSs

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

CSC 2405: Computer Systems II

What Operating Systems Do An operating system is a program hardware that manages the computer provides a basis for application programs acts as an int

Module 2: Computer-System Structures. Computer-System Architecture

Announcement. Exercise #2 will be out today. Due date is next Monday

Process Scheduling Queues

Operating System Control Structures

Chapter 5 B. Large and Fast: Exploiting Memory Hierarchy

GUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III

Computer-System Structures

Common Computer-System and OS Structures

Part I Overview Chapter 1: Introduction

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture

CIS Operating Systems Memory Management Cache and Demand Paging. Professor Qiang Zeng Spring 2018

CIS Operating Systems Memory Management Cache. Professor Qiang Zeng Fall 2015

Major Requirements of an OS

CIS Operating Systems Memory Management Cache. Professor Qiang Zeng Fall 2017

CS370 Operating Systems

Virtual Memory. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Overview of Syllabus and Class Policies. Chapter 0

Instruction Cycle. Computer-System Architecture. Computer-System Operation. Common Functions of Interrupts. Chapter 2: Computer-System Structures

Lecture 2 - Fundamental Concepts

Lecture 4: Mechanism of process execution. Mythili Vutukuru IIT Bombay

Part I Introduction Hardware and OS Review

Unit 1. Chapter 3 Top Level View of Computer Function and Interconnection

Computer Architecture and OS. EECS678 Lecture 2

Part One provides a background and context for the remainder of this book.

Memory Hierarchy. Goal: Fast, unlimited storage at a reasonable cost per bit.

Operating Systems. Introduction & Overview. Outline for today s lecture. Administrivia. ITS 225: Operating Systems. Lecture 1

HY225 Lecture 12: DRAM and Virtual Memory

Inf2C - Computer Systems Lecture 16 Exceptions and Processor Management

Computer-System Architecture

Computer-System Architecture. Common Functions of Interrupts. Computer-System Operation. Interrupt Handling. Chapter 2: Computer-System Structures

John Wawrzynek & Nick Weaver

198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14

OS And Hardware. Computer Hardware Review PROCESSORS. CPU Registers. CPU Registers 02/04/2013

Chapter 1: Introduction. Operating System Concepts 8th Edition,

CPE300: Digital System Architecture and Design

Introduction. CS3026 Operating Systems Lecture 01

Subject Name:Operating system. Subject Code:10EC35. Prepared By:Remya Ramesan and Kala H.S. Department:ECE. Date:

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

Memory Organization MEMORY ORGANIZATION. Memory Hierarchy. Main Memory. Auxiliary Memory. Associative Memory. Cache Memory.

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013

Operating System Review

Chapter 3. Top Level View of Computer Function and Interconnection. Yonsei University

CS Operating Systems

Chapter 2 Computer-System Structure

CS3600 SYSTEMS AND NETWORKS

I/O - input/output. system components: CPU, memory, and bus -- now add I/O controllers and peripheral devices. CPU Cache

Overview IN this chapter we will study. William Stallings Computer Organization and Architecture 6th Edition

CSE 120 Principles of Operating Systems

Computer Architecture

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Module 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1

Lecture 2: September 9

Hardware OS & OS- Application interface

ECE 485/585 Microprocessor System Design

ECE331: Hardware Organization and Design

Computer Organization ECE514. Chapter 5 Input/Output (9hrs)

Eastern Mediterranean University School of Computing and Technology CACHE MEMORY. Computer memory is organized into a hierarchy.

Operating Systems: Internals and Design Principles. Chapter 2 Operating System Overview Seventh Edition By William Stallings

Computer System Overview

Lecture 12: Memory hierarchy & caches

Principles of Operating Systems CS 446/646

Review: Hardware user/kernel boundary

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

F28HS Hardware-Software Interface: Systems Programming

EE458 - Embedded Systems Exceptions and Interrupts

Operating Systems: Internals and Design Principles. Chapter 1 Computer System Overview Seventh Edition By William Stallings

CPSC 341 OS & Networks. Introduction. Dr. Yingwu Zhu

CS 333 Introduction to Operating Systems. Class 1 - Introduction to OS-related Hardware and Software

Recall: Paging. Recall: Paging. Recall: Paging. CS162 Operating Systems and Systems Programming Lecture 13. Address Translation, Caching

Module 11: I/O Systems

VIRTUAL MEMORY READING: CHAPTER 9

Overview of Operating Systems

Introduction to Process in Computing Systems SEEM

Process Time. Steven M. Bellovin January 25,

Random-Access Memory (RAM) Systemprogrammering 2007 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Chapter 3 Process Description and Control

Transcription:

Lecture Topics Today: Computer System Overview (Stallings, chapter 1.1-1.8) Next: Operating System Overview (Stallings, chapter 2.1-2.4, 2.8-2.10) 1 Announcements Syllabus and calendar available Consulting hours posted Self-Study Exercise #1 posted Self-Study Exercise #2 posted 2

Operating Systems Overview Operating system: software that serves as the interface between application programs and computer hardware Manages resources (hardware): Processor (CPU) Primary storage (RAM) Secondary storage (disk) 3 Example: Linux Overview 4

Example: Linux Overview 5 Hardware Support for OS Desired capabilities of operating system influence hardware OS and architecture evolve in tandem. Examples: Privileged instructions Interrupts DMA (direct memory access) 6

Privileged Instructions Can only be executed by the OS (user code cannot execute privileged instructions) ex: initialize PC ex: place value in PSW Dual-mode operation: status bit for user mode or kernel (supervisor) mode Some processors support more than two modes (additional status bits) 7 Interrupts Fundamental to operation of modern computers and integral part of OS design Mechanism to allow hardware modules to get the attention of the OS ex: I/O device signals that operation is complete ex: Timer signals that quantum is over Interrupts can occur at any time 8

Modified Instruction Cycle CPU checks for interrupts after each instruction, invokes interrupt handler 9 Examples of Interrupts I/O (ex: operation completed) Timer (ex: time slice completed) Hardware failure (ex: memory parity error) Program Exception (ex: divide by zero) Program Trap (control transfer instruction to request interrupt) 10

Interrupt Processing OS determines the nature of the interrupt and performs the necessary actions State of the interrupted process must be saved so that process can be resumed later as if nothing had happened Note that some interrupts are completely unrelated to the current process 11 Interrupt Processing Current process:.. 00010808 E3500006 0001080c CA000005 00010810 E59F2018 00010814 E5921000 00010818 E0811000 0001081c E5821000.. ISR: 00000420 E2700012 00000424 E6610007 00000428 E3034000 0000042C E732001F 00000430 E83122FF 00000434 E5610000 00000438 E6400007 0000043C E0340005 12

Interrupt Processing The stateof a process is all of the bit patterns related to that process: machine language instructions in RAM data objects in RAM contents of CPU registers OS must preserve the state of the process which was interrupted: leave RAM alone, save contents of registers 13 Interrupt Processing What process state has to be preserved? PC address where interrupt occurred PSW status bits (including user/kernel mode) Any general-purpose registers which are used by the OS to handle the interrupt Hardware automatically saves PC and PSW; software (interrupt service routine) saves any general-purpose registers that it uses 14

Interrupt Processing When an interrupt occurs, the hardware does the following simultaneously: acknowledges the interrupt turns on kernel mode saves the PC and the PSW places the address of the ISR into the PC Since the PC now contains the entry point of an interrupt service routine, that function is executed (next instruction fetched) 15 Interrupt Processing Note: the details for each architecture are different (example is an abstraction) Address of ISR P C P S W P C X P S W X 16

Interrupt Processing The address of the appropriate interrupt service routine is in a table; the hardware uses the interrupt number as the index 0 00000080 1 00000140 2 00000020 3 00000238 4. 5. Address of ISR for IR #0 Address of ISR for IR #3 17 Interrupt Service Routines (ISR) Each ISR does the following: Finish saving state of interrupted process Process interrupt Restore state of interrupted process Restore old PC and old PSW Note: back in interrupted process (old PC) Note: back in user mode (old PSW) 18

Example: SPARC microprocessor Each entry in the ISR table contains 16 bytes; since each machine language instruction is 4 bytes in size, one table entry contains the first 4 instructions for the ISR (usually a jump to the rest of that ISR). The ISR table is loaded into a particular area of memory when the machine is booted; that address is the start of the ISR table. 19 Example: SPARC microprocessor The TBR (trap base register) contains three fields: TBA: upper bits of ISR table address tt: trap (interrupt number) Last 4 bits are always zero (since each entry is 16 bytes). 20

Example: SPARC microprocessor Assume ISR table is at 0x00004000 in memory. Table entry addresses: trap 0 trap 1 trap 2.. trap ff 0x00004000 0x00004010 0x00004020 0x00004ff0 21 Interrupt Categories Hardware interrupt signal from device Software interrupt signal from program which is currently executing Exception error caused by current instruction Trap specific machine language instruction to cause interrupt in a controlled way 22

Summary: Interrupt Handing An interrupt can occur at any instant An interrupt may be related to the current process (software interrupt) or it may be completely unrelated (hardware interrupt) OS handles interrupts through a combination of hardware (initial steps) and software (ISRs) ISRs should be small and fast 23 Multiple Interrupts More than one interrupt can occur at the same time or while an ISR is executing. Two main strategies: Sequential interrupt processing Nested interrupt processing Nested processing allows processing in priority order (each type of interrupt is assigned a relative priority). 24

Sequential Interrupt Processing 25 Nested Interrupt Processing 26

Example 27 DMA (Direct Memory Access) Allow I/O modules to transfer blocks of bytes into (or out of) RAM without using the CPU to copy the bytes. CPU initiates I/O operation I/O module starts processing; CPU used for other purposes I/O uses interrupt to signal completion 28

Evolution of I/O Function 1. CPU directly controls a peripheral device 2. Controller or I/O module is added CPU uses programmed I/O without interrupts CPU does not need to handle details of external devices 29 Evolution of I/O Function 3. Controller or I/O module with interrupts CPU does not spend time waiting for an I/O operation to be performed 4. Direct Memory Access blocks of data are moved into memory without involving the CPU CPU involved at beginning and end only 30

Techniques for Performing I/O Programmed I/O I/O command is issued CPU uses "busy waiting" until operation is completed Interrupt-driven I/O I/O command is issued CPU continues executing instructions I/O module sends an interrupt when completed 31 Programmed I/O I/O module performs action on behalf of processor I/O module sets status bit when done (does not issue interrupt) Processor cycles wasted checking status of I/O module 32

Interrupt-Driven I/O Processor interrupted when I/O module ready to exchange data Processor is free to do other work -- no needless waiting Still consumes a lot of processor cycles because every word read or written passes through the processor 33 Techniques for Performing I/O Direct Memory Access (DMA) DMA module controls exchange of data between main memory and I/O device Processor interrupted only after entire block has been transferred Processor is only involved at the beginning and end of the transfer --free to perform other tasks during data transfer 34

Direct Memory Access CPU issues request to DMA module (separate module or incorporated into I/O module) DMA module transfers a block of data directly to or from memory (without going through CPU) An interrupt is issued when the task is complete 35 Direct Memory Access CPU to DMA: read/write request address of I/O device address in memory number of bytes to transfer DMA transfers bytes from I/O device to RAM DMA issues interrupt 36

Memory Hierarchy 37 Cache Memory Small cache of expensive but very fast memory interacting with slower but much larger memory Processor first checks if word referenced to is in cache If not found in cache, a block of memory containing the word is moved to the cache 38

The Hit Ratio Hit ratio = fraction of access where data is in cache T1 = access time for fast memory T2 = access time for slow memory T2 >> T1 When hit ratio is close to 1, the average access time is close to T1 39 Locality of Reference Memory references for both instructions and data values tend to cluster over a long period of time. Example: once a loop is entered, there is frequent access to a small set of instructions. Hence: once a byte gets referenced, it is likely that nearby bytes will get referenced often in the near future. 40