+ All Categories
Home > Documents > Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more...

Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more...

Date post: 15-Dec-2015
Category:
Upload: amia-shine
View: 213 times
Download: 0 times
Share this document with a friend
Popular Tags:
29
Computer System Overview Chapter 1
Transcript
Page 1: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Computer System Overview

Chapter 1

Page 2: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Operating System

Exploits the hardware resources of one or more processors

Provides a set of services to system users

Manages secondary memory and I/O devices

Provides support for networking/communications

Page 3: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Basic Elements

Processor Main Memory (real memory/primary memory) I/O modules

secondary memory devices communications equipment terminals

System bus communication among processors, memory, and

I/O modules

Page 4: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Top-Level Components

Page 5: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

User-Visible Registers

May be referenced by machine language Available to all programs - application

programs and system programs Types of registers

Data Address

Index Segment pointer Stack pointer

Page 6: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Control and Status Registers

Program Counter (PC) has the address of the instruction to be fetched

Instruction Register (IR) Contains the instruction most recently fetched

Program Status Word (PSW) condition codes / flags

e.g. Interrupt enable/disable, supervisor/user mode Can be accessed by a program but not altered

Page 7: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Instruction CycleThe processor fetches the instruction from memory where the

Program Counter (PC) is pointing PC is incremented after each fetchFetched instruction is placed in the instruction register

and then decoded for executionTypes of instructions

Processor-memory - transfer data between processor and memory Processor-I/O - data transferred to or from a peripheral device Data processing - arithmetic or logic operation on data Control - alter sequence of execution (e.g. jump, branch etc.)

Page 8: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Interrupts

An interruption of the normal sequence of execution 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

Improves processing efficiency Allows the processor to execute other instructions

while an I/O operation is in progress

Page 9: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Interrupt Cycle At the end of each cycle, processor checks for interrupts If no interrupts fetch the next instruction If an interrupt is pending, suspend execution of the current

program, and execute the interrupt handler

Page 10: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Classes of Interrupts

Program interrupts arithmetic overflow division by zero execute illegal instruction reference outside user’s memory space

Timer I/O interrupt Hardware failure

Interrupt Handler (ISR – interrupt Service Routine)

• Whenever there is an interrupt, control is transferred to this program. It determines the nature of the interrupt and performs the necessary actions to handle it.

Page 11: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Transfer of Control via Interrupts

Page 12: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Simple Interrupt Processing

Page 13: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Changes in Memory and Registers for an Interrupt

Page 14: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Multiple Interrupts

Disable interrupts while an interrupt is being processed

Interrupts remain pending until the processor enables interrupts

After interrupt handler routine completes, the processor checks for additional interrupts

OR

Lower-priority interrupt handler can be interrupted (nested)

Page 15: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

I/O Techniques

When the processor 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)

Page 16: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Direct Memory Access

I/O exchanges occur directly with memory without processor involvement

Processor grants I/O module authority to read from or write to memory

Relieves the processor responsibility for the exchange. Processor is free to do other things

The processor is only involved at the beginning and end of the transfer. An interrupt is sent when the task is complete diskDiskdiskDisk

Memory-I/O busMemory-I/O bus

ProcessorProcessor

CacheCache

MemoryMemoryI/O

controller

I/Ocontroller

Reg

(2) DMA Transfer

(1) Initiate Block Read

(3) Read Done, interrupt!

Page 17: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Multiprogramming

Processor has more than one program to execute

The sequence that the programs are executed depends on their relative priority and whether they are waiting for I/O

After an interrupt handler completes, control may not return to the program that was executing at the time of the interrupt

Page 18: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Memory Hierarchy

Going Down

the Hierarchy

Cost per bit decreases

Capacity increases

Access time increases

Frequency of access by the processor decreases

Page 19: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Cache Memory

Processor speed is much faster than memory speed. Therefore, Increase the speed of memory by adding a small fast memory

Cache contains a portion of main memory

Processor first checks cache. If not found in cache, the block of memory containing the needed information is moved to the cache

Because of locality of reference, likely future memory references are in that block

Transfers are not visible to the OS (i.e. no OS involvement)

Page 20: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
Page 21: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
Page 22: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Mapping Function

∗ Determines which cache location the block will occupy

Page 23: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Cache DesignCache sizeBlock size

the unit of data exchanged between cache and main memory

hit means the information was found in the cache

Mapping function determines which cache location

the block will occupy

Replacement algorithm determines which word in the

block to replace Least-Recently-Used (LRU)

Page 24: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Initializing the Machine

Power up fetch-execute cycle begins Initial (or hardware) process begins to run Executes ROM diagnostic program Then bootstrap loads the OS OS initialization

Setup & initialize all system data structures Initialize all devices Start daemons – including idle process Branches to the scheduler

Page 25: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Bootstrapping

Bootstrap loader (“boot sector”)

Primary Memory

1

0x0001000

Fetch UnitFetch Unit

Decode UnitDecode Unit

Execute UnitExecute Unit

00001000000100

……

PC

IR

BIOS loader 0x0000100

Page 26: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Bootstrap loader (“boot sector”)

Primary Memory

Loader

1

2

Fetch UnitFetch Unit

Decode UnitDecode Unit

Execute UnitExecute Unit

00010000001000

……

PC

IR

BIOS loader 0x00001000x0001000

0x0008000

Bootstrapping

Page 27: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Bootstrap loader (“boot sector”)

Primary Memory

Loader

OS

12

3Fetch UnitFetch Unit

Decode UnitDecode Unit

Execute UnitExecute Unit

00080000008000

……

PC

IR

BIOS loader 0x00001000x0001000

0x0008000

0x000A000

Bootstrapping

4. Initialize hardware5. Create user environment6. …

Page 28: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Windows 7 Startup

http://www.techsupportalert.com/content/windows-7-startup.htm

http://www.techsupportalert.com/content/windows-7-components-startup.htm

Page 29: Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.

Kernel Process jProcess iISRsIdle Process

Hardware Process Starts

Program

Processrunning

Switch toAnotherprogram

BIOS

I/O


Recommended