CISC 3595 Operating Systems Introduction Tuesday / Friday 10:00-11:15am X. Zhang.

Slides:



Advertisements
Similar presentations
Chapter 1 Computer System Overview
Advertisements

Computer System Overview
Informationsteknologi Thursday, September 6, 2007Computer Systems/Operating Systems - Class 21 Today’s class Finish computer system overview Review of.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
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.
Computer System Overview
University College Cork IRELAND Hardware Concepts An understanding of computer hardware is a vital prerequisite for the study of operating systems.
Chapter 1 and 2 Computer System and Operating System Overview
Modified from Silberschatz, Galvin and Gagne ©2009 CS 446/646 Principles of Operating Systems Lecture 1 Chapter 1: Introduction.
Chapter 1 and 2 Computer System and Operating System Overview
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.
Computer Organization and Assembly language
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 1: Introduction.
Objectives To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 1: Introduction.
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Chapter 1. Introduction What is an Operating System? Mainframe Systems
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.
Chapter 1 Computer System Overview
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.
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.
Top Level View of Computer Function and Interconnection.
Operating Systems and Networks AE4B33OSS Introduction.
Operating Systems Lecture 02: Computer System Overview Anda Iamnitchi
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 1 Computer System Overview.
Chapter 1: Introduction. 1.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 1: Introduction What Operating Systems Do Computer-System.
COMPUTER SYSTEM OVERVIEW. Operating Systems: Internals and Design Principles “No artifact designed by man is so convenient for this kind of functional.
Operating systems, lecture 4 Team Viewer Tom Mikael Larsen, Thursdays in D A look at assignment 1 Brief rehearsal from lecture 3 More about.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
ECEG-3202 Computer Architecture and Organization Chapter 3 Top Level View of Computer Function and Interconnection.
COMPUTER SYSTEM OVERVIEW
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)
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Chapter 6: Computer Components Dr Mohamed Menacer Taibah University
Lecture 1: Review of Computer Organization
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.
Review of Computer System Organization. Computer Startup For a computer to start running when it is first powered up, it needs to execute an initial program.
1 Computer Architecture. 2 Basic Elements Processor Main Memory –volatile –referred to as real memory or primary memory I/O modules –secondary memory.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
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.
Chapter 1 Computer System Overview
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:

CISC 3595 Operating Systems Introduction Tuesday / Friday 10:00-11:15am X. Zhang

Four Components of a Computer System 2 People, machines, other computers CPU, memory, I/O devices

What is an Operating System? 3 A program that acts as an intermediary between a user of a computer and the computer hardware Operating system goals: – Execute user programs and make solving user problems easier – Make the computer system convenient to use – Use the computer hardware in an efficient manner

Computer System Organization 4  One or more CPUs, device controllers connected through common bus providing access to shared memory

A quick tour of computer hardware  Basic Elements  Processor  Instruction Execution  Interrupts  The Memory Hierarchy  Cache Memory  I/O Communication Techniques 5

Basic Hardware Elements  Processor or Central Processing Unit (CPU)  Controls operation, performs data processing  Memory (main/primary memory)  Volatile, i.e., data is typically lost when power is removed  Used to store data and instructions  I/O Modules: disk controller, USB controller,...  Moves data between computer and external device such as storage (e.g. hard drive), communication equipment, terminals  System Bus  Wires or backplane connecting CPUs, I/O modules and main memory 6

Top-Level Logic View 7 Main memory: a large array of words or bytes. Each words has its own address.

Roadmap  Basic Elements  Processor  Instruction Execution  Interrupts  The Memory Hierarchy  Cache Memory  I/O Communication Techniques 8

Processor (CPU)  CPU: the physical heart of entire computer system  ALU: Arithmetic Logic Unit  Registers 9

Singleprocessor & Multiprocessor 10  Most systems use a single general- purpose processor  Multiprocessors systems growing in use and importance  parallel systems, tightly-coupled systems  Advantages include 1. Increased throughput 2. Economy of scale 3. Increased reliability – graceful degradation or fault tolerance

Processor Registers  Storage in CPU; Faster and smaller than main memory  Data/Address registers  Storing data or memory address  Store frequently used variable in register: for (register int i = 0; i < bufsize; i++) * p++ = assigned_val;  Control and status registers  Used to control CPU operation  Ex: Program counter (PC), Instruction register (IR),  Ex: Program status word (PSW): contain bits set by processor hardware as a result of operations  e.g., to denote an exception (arithmetic operation overflow…) 11

Roadmap  Basic Elements  Processor Registers  Instruction Execution  Interrupts  The Memory Hierarchy  Cache Memory  I/O Communication Techniques 12

Instruction Execution  A program: a sequence of instructions stored in memory (main memory or disk)  To run a program, it needs to be loaded (from disk) into main memory  Basic Instruction Execution cycle:  Processor reads (fetches) instruction from main memory  Processor executes the instruction Stored program computer (due to John von Neumann ( )) 13

Instruction Fetch and Execute  Program counter (PC)  holds address of the instruction to be fetched next  Processor fetches the instruction from memory, & increments PC  Fetched instruction is loaded into instruction register (IR)  Decoded, and executed by ALU if it’s an arithmetic and logic operation 14

Machine Code  Instruction set: the set of machine instructions that a processor can execute  Main categories of machine instructions  Processor-memory: move data between memory and processor  processor-I/O: move data between peripheral device and CPU  Data processing: arithmetic or logic operation on data  Control: alter execution sequence (jump, if and loop structure) 15

Machine code and Assembly Language  Process only understands binarys => machine instructions are coded in binary strings  e.g., (Hexadecimal: B0 61)  Assembly language: mnemonic language (helping to remember)  MOV AL, #61h  Move the value 61h (or 97 decimal; the h-suffix means hexadecimal; the pound sign means move the immediate value, not location) into the processor register named "AL".  If a certain process supports 50 different instructions, how many bits are needed to represent the type of the instruction ? 16

Considering a Hypothetical Machine 17

18

So far so good  We learnt how a program is executed by CPU: follow the instructions (program)  Now think about the following simple program:  To read two integers from standard input, add them and print the result on the display  How to do I/O?  Wait ? Too wasteful of processor resource  Also not fair if multiple users are working on the computer (such as our storm server)  Need some way to interrupt current program execution to give CPU to other user program or to handle I/O response 19

Roadmap  Basic Elements  Processor Registers  Instruction Execution  Interrupts  The Memory Hierarchy  Cache Memory  I/O Communication Techniques 20

Interrupts  A mechanism to interrupt normal sequencing  One goal: to support interrupt-I/O that improve process utilization  Most I/O devices are slower than CPU => inefficient for processor to wait for I/O to complete  With Interrupt mechanism:  CPU can execute other process/job after issuing I/O command  I/O module generates an interrupt to notify CPU about completion of the I/O operation or failure. 21

Transfer of Control via Interrupts 22 Interrupt Handler: Predefined routines to be called when a certain interrupt occurs.

Simple Interrupt Processing 23

Different Types of Interrupts  Program: arithmetic overflow, division by zero, illegal machine instruction, reference outside of user’s allowed memory space, also called exception, trap or software interrupt  Timer: generated by a timer with CPU  I/O: generated by I/O controller to signal completion of operation or error condition  Hardware failure: triggered by power failure, memory parity error… 24 An operating system is interrupt driven.

Multiprogramming 25  Single program cannot keep CPU and I/O devices busy  Multiprogramming organizes programs so CPU always has one to execute  Multiple programs(jobs) is kept in memory  One program is selected and run via job scheduling  When it has to wait (for I/O for example), OS switches to another job  After an interrupt handler completes, control may not return to the program that was executing at the time of the interrupt

Roadmap  Basic Elements  Processor Registers  Instruction Execution  Interrupts  The Memory Hierarchy  Cache Memory  I/O Communication Techniques 26

Main (Primary) Memory 27  Main memory – the only large storage media that CPU can access directly  Capacity:  Bandwidth  Peak: one word per bus cycle  Local bus, i.e., system bus

Secondary Storage 28  Hard disk: extension of main memory that provides large nonvolatile storage capacity  disk controller: determines logical interaction between the device and the computer  Performance measure  Maximum transfer rate: 66Mb/s  Spindle Rotation Speed: decides the reading/writing rate  Seek time: avg time to locate the data

Why so many different memory/storage  Major constraints in memory  Amount  Speed  Expense  Generally:  Faster access time, greater cost per bit  Greater capacity, smaller cost per bit  Greater capacity, slower access speed 29

Memory Hierarchy  Major constraints in memory  Amount  Speed  Expense  Going down hierarchy  Decreasing cost per bit  Increasing capacity  Increasing access time  Decreasing frequency of access Auxiliary memory External and nonvolatile Used to store program and data files 30

Performance of Various Levels of Storage 31 ns: nanosecond (10 -9 seconds), 1 billionth second < 16 GB

Caching is everywhere 32  Caching: information in use is copied from slower and larger storage to faster and smaller storage (cache) temporarily  Faster storage (cache) checked first to determine if information is there  If it is, information used directly from the cache (fast)  If not, data copied to cache and used there  Caching is performed at many levels in a computer  Hardware: L1 cache  Operating system: disk cache  Software/application level caching

Primary Cache (L1 cache)  Processor must access memory at least once per instruction cycle  Processor speed faster than memory access speed  Storage on CPU for temporary storage of instructions and data.  fastest form of storage. (on-the-chip with a zero wait-state (delay) interface to the processor's execution unit,)  Exploit locality with a small fast memory  Data which is required soon is often close in memory to the current data  Temporal locality and spatial locality 33

Primary Cache and Main Memory Cache contains copy of a portion of main memory Processor first checks cache If not found, block of memory read into cache Because of locality of reference, likely future memory references are in that block 34

Roadmap  Basic Elements  Processor Registers  Instruction Execution  Interrupts  The Memory Hierarchy  Cache Memory  I/O Communication Techniques 35

Input/Output Device Controller 36 Each is in charge of a particular type of device Execute concurrently with CPU Responsible for I/O operation: moving data between the device and the controller’s local buffer

I/O Techniques  When CPU encounters an instruction relating to I/O,  it executes that instruction by issuing a command to the appropriate I/O module  Three techniques are possible for I/O operations:  Programmed I/O  Interrupt-driven I/O  Direct memory access (DMA) 37

Programmed I/O  The I/O module performs the requested action  then sets the appropriate bits in the I/O status register  but takes no further action to alert the processor.  As there are no interrupts, CPU must determine when I/O is complete  Wait instruction idles CPU until the next interrupt  At most one I/O request is outstanding at a time, no simultaneous I/O processing 38

Programmed I/O Example  Data read in a word at a time  Processor remains in status-checking loop while reading 39

Interrupt-driven I/O 40  When CPU encounters an I/O related instruction  it executes that instruction by issuing a command to appropriate I/O module  After I/O starts, control returns to user program without waiting for I/O completion  After I/O device controller finish I/O operation, it generate an interrupt to inform CPU  CPU, in the interrupt handler, read the data from device controller or write next block of data to device controller  Wake up processes waiting for the interrupt...

Direct Memory Access (DMA) I/O 41  DMA: allow device to access memory for reading and/or writing independently of CPU.  Used in high-speed I/O devices: disk controllers, graphics cards, network cards and sound cards  DMA module (DMA device controller)  Transfers blocks of data from buffer storage directly to main memory  Only one interrupt is generated per block  CPU only involved at beginning and ending transfer.  Less CPU intervention => much more efficient in terms of processing times

DMA I/O: How does it work?  When needing to read/write processor issues a command to DMA module with:  Whether a read or write is requested  Address of the I/O device involved  Starting location in memory to read/write  Number of words to be read/written 42

How a Modern Computer Works 43