Computer Organization (Review of Prerequisite Material)

Slides:



Advertisements
Similar presentations
1 (Review of Prerequisite Material). Processes are an abstraction of the operation of computers. So, to understand operating systems, one must have a.
Advertisements

Slide 4-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 4 Computer Organization.
Arithmetic Logic Unit (ALU)
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 3 Operating System Organization.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
Computer System Overview
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
© 2009, D. J. Foreman 1 Computer Organization. © 2009, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
Chapter 4 Computer Organization Vishal Shah Vishal Pinto.
Computer System Organization S H Srinivasan
Overview The von Neumann Machine - the programmable digital computer Introducing the LC-3 Computer - A “toy” computer for us to learn from Computer machine.
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
System Calls 1.
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Overview of Hardware.
Computer Science 210 Computer Organization The von Neumann Architecture.
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.
Chapter 4 The Von Neumann Model
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
CPU How It Works. 2 Generic Block Diagram CPU MemoryInputOutput Address Bus Data Bus.
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5 5 Device Management.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
Intro MIPS Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann – Wrote a.
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
Slide 4-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 4 4 Computer Organization.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
CS 1308 Computer Literacy and the Internet. Objectives In this chapter, you will learn about:  The components of a computer system  Putting all the.
Dale & Lewis Chapter 5 Computing components
Lecture 1: Review of Computer Organization
Von Neumann Model Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann –
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Overview von Neumann Architecture Computer component Computer function
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5 5 Device Management.
C HAPTER 4 OS: C OMPUTER O RGANIZATION TOPICS: The Von Neumann Architecture The CPU.
COEN 311 Computer Organization & Software Chapter 1 Introduction and Terminology (Prof. Sofiène Tahar) Concordia University Electrical & Computer Engineering.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
Slide 4-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 4 4 Computer Organization.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Slide 4-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 4.
Introduction to Operating Systems Concepts
Computer System Overview
The Stored Program Computer
Basic Processor Structure/design
Computer Science 210 Computer Organization
Chapter 9 a Instruction Level Parallelism and Superscalar Processors
Chapter 4 The Von Neumann Model
Five Execution Steps Instruction Fetch
Computer System Structures
Chapter 4 The Von Neumann Model
The fetch-execute cycle
Chapter 4 The Von Neumann Model
Operating Systems: A Modern Perspective, Chapter 4
Computer Organization
Computer Science 210 Computer Organization
Outline Computer Organization Devices Interrupts Computer architecture
MARIE: An Introduction to a Simple Computer
Multicycle Approach We will be reusing functional units
Computer Organization
The Von Neumann Architecture Odds and Ends
Multicycle Design.
Program Execution.
Outline Process Management Process manager Hardware process
A Top-Level View Of Computer Function And Interconnection
Function of Operating Systems
Chapter 4 The Von Neumann Model
Presentation transcript:

Computer Organization (Review of Prerequisite Material)

Program Specification int a, b, c, d;... a = b + c; d = a - 100; Source ; Code for a = b + c load R3,b load R4,c add R3,R4 store R3,a Assembly Language ; Code for d = a load R4,=100 subtract R3,R4 store R3,d

Machine Language ; Code for a = b + c load R3,b load R4,c add R3,R4 store R3,a ; Code for d = a load R4,=100 subtract R3,R4 store R3,d Assembly Language … … … … … … …1 Machine Language

von Neumann Computer Arithmetic-Logical Unit (ALU) Arithmetic-Logical Unit (ALU) Control Unit Primary Memory (Executable Memory) Primary Memory (Executable Memory) Address Data

Primary Memory Unit MAR MDR Command n Read Op: Load MAR with address read 2. Load Command with “read” Data will then appear in the MDR

Control Unit Primary Memory Fetch Unit Decode Unit Execute Unit PC IR Control Unit load R3,b load R4,c add R3,R4 store R3,a … … … …1 load R4, c 3050

Control Unit Operation PC = ; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; // fetch phase }; Fetch phase: Instruction retrieved from memory Execute phase: ALU op, memory data reference, I/O, etc.

The ALU R1 R2 Rn... Status Registers Functional Unit Left Operand Right Operand Result To/from Primary Memory load R3,b load R4,c add R3,R4 store R3,a

Bootstrapping Bootstrap loader (“boot sector”) Primary Memory 1 0x Fetch Unit Decode Unit Execute Unit … … PC IR BIOS loader 0x

Bootstrapping Bootstrap loader (“boot sector”) Primary Memory Loader 1 2 Fetch Unit Decode Unit Execute Unit … … PC IR BIOS loader 0x x x

Bootstrapping Bootstrap loader (“boot sector”) Primary Memory Loader OS Fetch Unit Decode Unit Execute Unit … … PC IR BIOS loader 0x x x x000A000

Bootstrapping Bootstrap loader (“boot sector”) Primary Memory Loader OS Initialize hardware 5. Create user environment 6. … Fetch Unit Decode Unit Execute Unit 000A000 … … PC IR BIOS loader 0x x x x000A000

Address Data Von Neumann Computer Arithmetic-Logical Unit (ALU) Arithmetic-Logical Unit (ALU) Control Unit Primary Memory (Executable Memory) Primary Memory (Executable Memory) Device

Device Organization Application Program Device Controller Device Software in the CPU Device manager Program to manage device controller Supervisor mode software Abstract I/O Machine

Device Controller Interface Command Status Data 0 Data 1 Data n-1 Logic busydoneError code... busy done 0 0 idle 0 1 finished 1 0 working 1 1 (undefined)

Performing a Write Operation while(deviceNo.busy || deviceNo.done) ; deviceNo.data[0] = deviceNo.command = WRITE; while(deviceNo.busy) ; deviceNo.done = TRUE; Devices much slower than CPU CPU waits while device operates Would like to multiplex CPU to a different process while I/O is in process

CPU-I/O Overlap CPU Device … Ready Processes CPU Device … Ready Processes I/O Operation CPU Device … Ready Processes Uses CPU

Determining When I/O is Complete CPU Device Interrupt Pending CPU incorporates an “interrupt pending” flag When device.busy  FALSE, interrupt pending flag is set Hardware “tells” OS that the interrupt occurred Interrupt handler part of the OS makes process ready to run

Control Unit with Interrupt (Hardware) PC = ; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; if(InterruptRequest) { memory[0] = PC; PC = memory[1] }; memory[1] contains the address of the interrupt handler

Interrupt Handler (Software) interruptHandler() { saveProcessorState(); for(i=0; i<NumberOfDevices; i++) if(device[i].done) goto deviceHandler(i); /* something wrong if we get to here … */ deviceHandler(int i) { finishOperation(); returnToScheduler(); }

A Race Condition saveProcessorState() { for(i=0; i<NumberOfRegisters; i++) memory[K+i] = R[i]; for(i=0; i<NumberOfStatusRegisters; i++) memory[K+NumberOfRegisters+i] = StatusRegister[i]; } PC = ; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; if(InterruptRequest && InterruptEnabled) { disableInterupts(); memory[0] = PC; PC = memory[1] };

Revisiting the trap Instruction (Hardware) executeTrap(argument) { setMode(supervisor); switch(argument) { case 1: PC = memory[1001]; // Trap handler 1 case 2: PC = memory[1002]; // Trap handler 2... case n: PC = memory[1000+n];// Trap handler n }; The trap instruction dispatches a trap handler routine atomically Trap handler performs desired processing “A trap is a software interrupt”