Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors...

21
1 Chapter 2: Computer-System Structures Last lecture: why study operating systems? Purpose of this lecture: general knowledge of the structure of a computer system and understanding technology trends Key issues in a computer system General System Architecture (CPU, $s, MM, disk, bus, IO devices and controllers), Uni vs. Multi Processors I/O Structure (IO interrupts, IO methods, HW support, e.g., DMA) Storage Structure (CPU regs, $, MM, disk) Storage Hierarchy (why? expensive cheap; small large) Hardware Protection (user/system, IO protection, Mem protection) Algorithms Programming Languages Hardware Technology, Architecture Compiler Runtime, Operating System The System Hmm … this looks like a Computer System? Figure by courtesy of Anant Agarwal, MIT

Transcript of Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors...

Page 1: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

1

Chapter 2: Computer-System Structures

■ Last lecture: why study operating systems?■ Purpose of this lecture: general knowledge of the

structure of a computer system and understanding technology trends

■ Key issues in a computer system✦ General System Architecture (CPU, $s, MM, disk, bus, IO

devices and controllers), Uni vs. Multi Processors ✦ I/O Structure (IO interrupts, IO methods, HW support, e.g.,

DMA)✦ Storage Structure (CPU regs, $, MM, disk)✦ Storage Hierarchy (why? expensive

�cheap; small

�large)

✦ Hardware Protection (user/system, IO protection, Mem protection)

Algorithms ProgrammingLanguages

Hardware Technology,Architecture

Compiler

Runtime, Operating System

The System

Hmm … this looks like a Computer System?

✦ Figure by courtesy of Anant Agarwal, MIT

Page 2: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

2

Uniprocessor Computer Architecture

MP Example: Intel Pentium Pro Quad

✦ Multiprocessor

✦ All coherence and multiprocessing glue in processor module

✦ Highly integrated, targeted at high volume

P-Pro bus (64-bit data, 36-bit address, 66 MHz)

CPU

Bus interface

MIU

P-Promodule

P-Promodule

P-Promodule256-KB

L2 $Interruptcontroller

PCIbridge

PCIbridge

Memorycontroller

1-, 2-, or 4-wayinterleaved

DRAM

PC

I bus

PC

I busPCI

I/Ocards

Page 3: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

3

Example: SUN Enterprise

Gigaplane bus (256 data, 41 address, 83 MHz)

SB

US

SB

US

SB

US

2 F

iber

Cha

nnel

100b

T, S

CS

I

Bus interface

CPU/memcardsP

$2

$

P

$2

$

Mem ctrl

Bus interface/switch

I/O cards

✦ 16 cards of either type: processors + memory, or I/O

✦ All memory accessed over bus, so symmetric multiproc. (SMP)

✦ Higher bandwidth, higher latency bus

Example: Cray T3E

Switch

P

$

XY

Z

External I/O

Memctrl

and NI

Mem

•Multiprocessor system •Scale up to 1024 processors, 480MB/s links

Page 4: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

4

Let’s look at t rends, 1st Technology Trends

The natural building block for multiprocessors is now also about the fastest!

Per

form

ance

0.1

1

10

100

1965 1970 1975 1980 1985 1990 1995

Supercomputers

Minicomputers

Mainframes

Microprocessors

General Technology Trends

• Microprocessor performance increases 50% - 100% per year• Transistor count doubles every 3 years• DRAM size quadruples every 3 years• Huge investment per generation is carried by huge commodity market

• Not that single-processor performance is plateauing, but that paralleli sm is a natural way to improve it.

0

20

40

60

80

100

120

140

160

180

1987 1988 1989 1990 1991 1992

Integer FP

Sun 4260

MIPSM/120

IBMRS6000

540MIPS

M2000

HP 9000750

DECalpha

Page 5: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

5

Clock Frequency Growth Rate

• 30% per year

◆◆◆◆◆◆◆

◆◆

◆◆

◆◆◆

◆◆◆

◆◆

◆◆

◆◆◆

◆◆

◆◆

◆◆◆

◆◆

◆◆◆◆

◆◆◆

◆◆

◆◆

◆◆

◆◆◆◆

◆◆◆

◆◆◆

◆◆◆◆

◆◆◆

◆◆

0.1

1

10

100

1,000

19701975

19801985

19901995

20002005

Clo

ck r

ate

(MH

z)

i4004i8008

i8080

i8086 i80286i80386

Pentium100

R10000

Transistor Count Growth Rate

• 100 milli on transistors on chip by early 2000’s A.D.• Transistor count grows much faster than clock rate

- 40% per year, order of magnitude more contribution in 2 decades

Tran

sist

ors

◆◆◆◆◆◆◆◆◆

◆◆

◆◆◆◆◆

◆◆

◆◆

◆◆◆◆

◆◆

◆ ◆

◆◆

◆◆◆

◆◆◆◆◆

◆◆◆◆

◆◆◆◆◆

◆◆◆◆

◆◆◆

◆◆◆◆◆

1,000

10,000

100,000

1,000,000

10,000,000

100,000,000

19701975

19801985

19901995

20002005

i4004i8008

i8080

i8086

i80286i80386

R2000

Pentium R10000

R3000

Page 6: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

6

Architectural Trends: Bus-based MPs

•Micro on a chip makes it natural to connect many to shared memory–dominates server and enterprise market, moving down to desktop

•Faster processors began to saturate bus, then bus technology advanced–today, range of sizes for bus-based systems, desktop to large servers

●●

● ●

● ●

● ●

●●

0

10

20

30

40

CRAY CS6400

SGI Challenge

Sequent B2100

Sequent B8000

Symmetry81

Symmetry21

Power

SS690MP 140 SS690MP 120

AS8400

HP K400AS2100SS20

SE30SS1000E

SS10

SE10

SS1000

P-ProSGI PowerSeries

SE60

SE70

Sun E6000

SC2000ESun SC2000SGI PowerChallenge/XL

SunıE10000

50

60

70

1984 1986 1988 1990 1992 1994 1996 1998

Num

ber

of p

roce

ssor

s

Bus Bandwidth

Sha

red

bus

band

wid

th (

MB

/s)

● ●

●●

●● ●●●● ●●●●

●●

● ●

10

100

1,000

10,000

100,000

1984 1986 1988 1990 1992 1994 1996 1998

SequentıB8000

SGIıPowerChı

XL

Sequent B2100

Symmetry81/21

SS690MP 120ıSS690MP 140

SS10/ıSE10/ıSE60

SE70/SE30SS1000 SS20

SS1000EAS2100SC2000EHPK400

SGI Challenge

Sun E6000AS8400

P-Pro

Sun E10000

SGI PowerSeries

SC2000

Power

CS6400

Page 7: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

7

Phases in VLSI Generation

■ How good is instruction-level parallelism? ■ Thread-level needed in microprocessors?

Tran

sist

ors

◆◆◆◆◆◆◆

◆◆

◆◆

◆ ◆◆

◆◆

◆◆◆ ◆

◆◆

◆ ◆

◆◆

◆ ◆

◆◆◆

◆◆◆ ◆

◆◆ ◆◆ ◆

◆◆◆ ◆

◆◆◆

◆ ◆◆◆

1,000

10,000

100,000

1,000,000

10,000,000

100,000,000

1970 1975 1980 1985 1990 1995 2000 2005

Bit-level parallelism Instruction-level Thread-level (?)

i4004

i8008i8080

i8086

i80286

i80386

R2000

Pentium

R10000

R3000

Economics

■ Commodity microprocessors not only fast but CHEAP• Development cost is tens of millions of dollars (5-100 typical)

• BUT, many more are sold compared to supercomputers✦ Crucial to take advantage of the investment, and use the commodity

building block✦ Exotic parallel architectures no more than special-purpose

■ Multiprocessors being pushed by software vendors (e.g. database) as well as hardware vendors

■ Standardization by Intel makes small, bus-based SMPs commodity

■ Desktop: few smaller processors versus one larger one? Multiprocessor on a chip is here.

Page 8: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

8

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 is from the device to local buffer of controller.■ Device controller informs CPU that it has finished its

operation by causing an interrupt.

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.

■ Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt.

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

■ An operating system is interrupt driven.

Page 9: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

9

Interrupt Handling

■ The operating system preserves the state of the CPU by storing registers and the program counter.

■ Determines which type of interrupt has occurred:✦ polling

✦ vectored interrupt system

■ Separate segments of code determine what action should be taken for each type of interrupt

Interrupt Time Line For a Single Process Doing Output

Page 10: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

10

I/O Structure

■ After I/O starts, control returns to user program only upon I/O completion.

✦ Wait instruction idles the CPU until the next interrupt✦ Wait loop (contention for memory access).✦ At most one I/O request is outstanding at a time, no

simultaneous I/O processing.■ After I/O starts, control returns to user program without

waiting for I/O completion.✦ System call – request to the operating system to allow user

to wait for I/O completion.✦ Device-status table contains entry for each I/O device

indicating its type, address, and state.✦ Operating system indexes into I/O device table to determine

device status and to modify table entry to include interrupt.

Two I/O Methods

Synchronous Asynchronous

Page 11: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

11

Device-Status Table

Direct Memory Access Structure

■ Used for high-speed I/O devices able to transmit information at close to memory speeds.

■ Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention.

■ Only on interrupt is generated per block, rather than the one interrupt per byte.

Page 12: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

12

Storage Structure

■ Main memory – only large storage media that the CPU can access directly.

■ Secondary storage – extension of main memory that provides large nonvolatile storage capacity.

■ Magnetic disks – rigid metal or glass platters covered with magnetic recording material

✦ Disk surface is logically divided into tracks, which are subdivided into sectors.

✦ The disk controller determines the logical interaction between the device and the computer.

Moving-Head Disk Mechanism

Page 13: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

13

Storage Hierarchy

■ Storage systems organized in hierarchy.✦ Speed✦ Cost✦ Volatility

■ Caching – copying information into faster storage system; main memory can be viewed as a last cache for secondary storage.

Storage-Device Hierarchy

Page 14: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

14

Caching

■ Use of high-speed memory to hold recently-accessed data.

■ Requires a cache management policy.■ Caching introduces another level in storage hierarchy.

This requires data that is simultaneously stored in more than one level to be consistent.

■ Caching is typically transparent to the OS

Migration of A From Disk to Register

Page 15: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

15

Hardware Protection

■ Dual-Mode Operation■ I/O Protection■ Memory Protection■ CPU Protection

Dual-Mode Operation

■ Sharing system resources requires operating system to ensure that an incorrect program cannot cause other programs to execute incorrectly.

■ Provide hardware support to differentiate between at least two modes of operations.1. User mode – execution done on behalf of a user.

2. Monitor mode (also kernel mode or system mode) –execution done on behalf of operating system.

Page 16: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

16

Dual-Mode Operation (Cont.)

■ Mode bit added to computer hardware to indicate the current mode: monitor (0) or user (1).

■ When an interrupt or fault occurs hardware switches to monitor mode.

Privileged instructions can be issued only in monitor mode.

monitor user

Interrupt/fault

set user mode

I/O Protection

■ All I/O instructions are privileged instructions.■ Must ensure that a user program could never gain control

of the computer in monitor mode (I.e., a user program that, as part of its execution, stores a new address in the interrupt vector).

Page 17: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

17

Use of A System Call to Perform I/O

Memory Protection

■ Must provide memory protection at least for the interrupt vector and the interrupt service routines.

■ In order to have memory protection, add two registers that determine the range of legal addresses a program may access:

✦ Base register – holds the smallest legal physical memory address.

✦ Limit register – contains the size of the range

■ Memory outside the defined range is protected.

Page 18: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

18

Use of A Base and Limit Register

Hardware Address Protection

Page 19: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

19

Hardware Protection

■ When executing in monitor mode, the operating system has unrestricted access to both monitor and user’s memory.

■ The load instructions for the base and limit registers are privileged instructions.

CPU Protection

■ Timer – interrupts computer after specified period to ensure operating system maintains control.

✦ Timer is decremented every clock tick.✦ When timer reaches the value 0, an interrupt occurs.

■ Timer commonly used to implement time sharing.■ Time also used to compute the current time.■ Load-timer is a privileged instruction.

Page 20: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

20

Network Structure

■ Local Area Networks (LAN)■ Wide Area Networks (WAN)

Local Area Network Structure

Page 21: Chapter 2: Computer-System Structures · Chapter 2: Computer-System Structures ... Microprocessors General Technology Trends • Microprocessor performance increases 50% -100% per

21

Wide Area Network Structure