Click here to load reader

Ch01 -

  • View
    23

  • Download
    2

Embed Size (px)

Text of Ch01 -

  • Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition,!

    Introduction

    Modified by M.Rebaudengo - 2010

  • 1.2! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    What is an Operating System?

    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"

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.3! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Computer System Structure

    Computer system can be divided into four components" Hardware provides basic computing resources"

    CPU, memory, I/O devices" Operating system!

    Controls and coordinates use of hardware among various applications and users"

    Application programs define the ways in which the system resources are used to solve the computing problems of the users" Word processors, compilers, web browsers, database

    systems, video games" Users!

    People, machines, other computers"

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.4! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Four Components of a Computer System

  • 1.5! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Operating System Definition " From the computer's point of view, the operating system is the program

    most involved with the hardware" OS is a resource allocator!

    Manages all resources (CPU time, memory space, file-storage space, I/O devices, etc.)"

    resource allocation is important where many users access the same computer"

    Decides between conflicting requests for efficient and fair resource use" OS is a control program!

    Controls execution of programs to prevent errors and improper use of the computer"

    It is especially concerned with the operation and control of I/O devices."

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.6! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Operating System Definition (Cont.)

    No universally accepted definition of what is part of the operating system" The one program running at all times on the computer"

    usually called kernel! Everything else is either a system program (shipped with the operating

    system) or an application program.!

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.7! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Computer System Organization

    Computer-system operation" One or more CPUs, device controllers connect through common bus

    providing access to shared memory" Concurrent execution of CPUs and devices competing for memory

    cycles"

  • 1.8! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Basic anatomy on a CPU (1)

    Some key CPU Components" Program Counter (PC)"

    holds memory address of next instruction" Instruction Register (IR)"

    holds instruction currently being executed" Registers (Reg. 1..n)"

    hold variables and temporary results" Arithmetic and Logic Unit (ALU)"

    performs arithmetic functions and logic operations"

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.9! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Basic anatomy on a CPU (2)

    Some key CPU Components" Memory Address Register (MAR)"

    contains address of memory to be read/written" Memory Data Register (MDR)"

    contains memory data read or to be written" Stack Pointer (SP)"

    holds memory address of a stack with a frame for each procedures local variables & parameters"

    Processor Status Word (PSW)" contains the mode bit and various control bits"

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.10! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Program execution

    Instruction sets" different for different machines" all have load and store instructions for moving items between memory

    and registers" many instructions for comparing and combining values in registers and

    putting result in a register" Fetch/Decode/Execute cycle"

    fetch next instruction pointed to by PC" decode it to find its type and operands" execute it" repeat"

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.11! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Fetch/decode/execute cycle

    PC

    MDR

    IR

    MAR

    Reg. n

    Reg. 1

    ALU

    CPU Memory

  • 1.12! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Fetch/decode/execute cycle

    PC

    MDR

    IR

    MAR

    Reg. n

    Reg. 1

    ALU

    CPU Memory

    While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }

  • 1.13! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Fetch/decode/execute cycle

    PC

    MDR

    IR

    MAR

    Reg. n

    Reg. 1

    ALU

    CPU Memory

    While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }

  • 1.14! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Fetch/decode/execute cycle

    PC

    MDR

    IR

    MAR

    Reg. n

    Reg. 1

    ALU

    CPU Memory

    While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }

  • 1.15! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Fetch/decode/execute cycle

    PC

    MDR

    IR

    MAR

    Reg. n

    Reg. 1

    ALU

    CPU Memory

    While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }

  • 1.16! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Fetch/decode/execute cycle

    PC

    MDR

    IR

    MAR

    Reg. n

    Reg. 1

    ALU

    CPU Memory

    While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }

  • 1.17! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Fetch/decode/execute cycle

    PC

    MDR

    IR

    MAR

    Reg. n

    Reg. 1

    ALU

    CPU Memory

    While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }

  • 1.18! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Computer Startup

    Bootstrap program is loaded at power-up or reboot" Typically stored in ROM or EPROM, generally known as firmware" Initializes all aspects of system (CPU registers, device controllers,

    memory contents, etc.)" Loads operating system kernel and starts execution"

    The operating system then starts executing the first process (init) and waits for some event to occur."

    The occurrence of an event is signaled by an interrupt from either the hardware and the software:" hardware may trigger an interrupt by sending a signal to the CPU" software may trigger an interrupt by executing a special operation called

    system call (or monitor call)."

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.19! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Interrupts

    Interrupts is the way by which hardware informs OS of special conditions that require OSs attention"

    Interrupt causes the CPU not to execute the next instruction"

    Instead, the control is passed to OS"

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.20! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Computer-System Operation

    I/O devices and the CPU can execute concurrently" Each device controller is in charge of a particular device

    type" Each device controller has a local buffer" CPU moves data from/to main memory to/from local

    buffers" I/O moves from the device to local buffer of controller" Device controller informs CPU that it has finished its

    operation by causing an interrupt"

    PCsHighlight

    PCsHighlight

    PCsHighlight

  • 1.21! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Common Functions of Interrupts

    Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines"

    Interrupt architecture must save the address of the interrupted instruction"

    A trap is a software-generated interrupt caused either by an error or a user request"

    An operating system is interrupt driven!

    PCsHighlight

    PCsHighlight

  • 1.22! Silberschatz, Galvin and Gagne 2009!Operating System Concepts 8th Edition!

    Handling interrupts

    Interrupt handler is a piece of the OS code intended