2_Computers.ppt

48
1 Assignment 1

Transcript of 2_Computers.ppt

Page 1: 2_Computers.ppt

1

Assignment 1

Page 2: 2_Computers.ppt

2

Heart Murmurs

Page 3: 2_Computers.ppt

3

Heart Operation

Page 4: 2_Computers.ppt

4

Heart Cycle

Page 5: 2_Computers.ppt

5

Phonogram

http://www.wilkes.med.ucla.edu/intro.html

Page 6: 2_Computers.ppt

6

UNIX

Page 7: 2_Computers.ppt

7

UNIX Concept?

User

Users

Hardware

UNIX kernel

Shell

She

ll

Shell

Shell

Page 8: 2_Computers.ppt

8

UNIX Concept

System Calls

vi

UNIX kernel

Hardware

open() close()

read()

write()

Chm

od()

ksh

csh

a.out cpp

Page 9: 2_Computers.ppt

9

UNIX Structure

I/O Manager

I/O Manager

Central KernelCentral Kernel

File Manager

File Manager

System Calls

Network ManagerNetwork Manager

Buffer CacheBuffer Cache

HardwareHardware

Page 10: 2_Computers.ppt

10

UNIX Services

I/O Manager

I/O Manager

Central KernelCentral Kernel

File Manager

File Manager

System Calls

Network ManagerNetwork Manager

Buffer CacheBuffer Cache

HardwareHardware

Process Management

Virtual Memory Machine

Communications

Programmatic InterfaceMemory

Management

File System Management

System Initialization

Fault, trap, interruption,

exception handling

I/O Device Drivers

Page 11: 2_Computers.ppt

11

Kernel Source Code

• usr/src/uts/machine (eg. MIPS)

../boot boot

../os process management code

../sys C-language include files

../fs file management systems

../io I/O management subsystem

Page 12: 2_Computers.ppt

12

Kernel Source Code

• usr/src/uts/machine

../disp low level process switching

../exec reading and starting executables

.. /vm memory, virtual memory

../debug kernel debugging system

../ml machine-dependent code

../master.d describe system configuration

Page 13: 2_Computers.ppt

13

UNIX Look-alikes

• AIX IBM

• HP-UX Hewlett-Packard

• OSF/1 Open Software Foundation

• Ultrix DEC

• IRIX SGI

• UTS Amdahl

• Solaris Sun

Page 14: 2_Computers.ppt

14

Computer System Structures

Chapter 2

Page 15: 2_Computers.ppt

15

Computer System

Disk Controller

Disk Controller

System Bus

Display

CPU

VideoVideo Printer Controller

Printer Controller

Memory ControllerMemory

Controller

Keypad

ExpansionExpansion

RAM

Page 16: 2_Computers.ppt

16

PC Computer

Page 17: 2_Computers.ppt

17

Bootstrap• Stored in ROM (read-only memory)

• Initializes CPU registers, memory, controllers

• Loads operating system

Page 18: 2_Computers.ppt

18

System Operation• I/O devices, CPU execute concurrently

• CPU generally controls data on bus

• Device controller for each device type

• Local buffer for each device controller

• I/O is from device to local controller

• Device controller informs CPU that it has finished its operation, by an Interrupt

Page 19: 2_Computers.ppt

19

Computer System

Disk Controller

Disk Controller

System Bus

Display

CPU

VideoVideo Printer Controller

Printer Controller

Memory ControllerMemory

Controller

Keypad

ExpansionExpansion

CPU-contro

lled

One per

device

type

Concurrent execution Local b

ufferI/O

Flow

Interrupt

Page 20: 2_Computers.ppt

20

Interrupts

Operating System

Operating System

ISRISR

Device Controller

Device Controller

• Hardware interrupt

Page 21: 2_Computers.ppt

21

Interrupts

Operating System

Operating System

ISRISR

• Software interrupt

User Code

• System call

• Error traps

Page 22: 2_Computers.ppt

22

Interrupts

Operating System

Operating System

User CodeUser Code

Interrupt HandlerInterrupt Handler

Interrupt Vector

Interrupt Vector

Pr 1Pr 1

… …

Pr nPr n

Pr n+1Pr n+1

Pr 0Pr 0

System Stack

User Code

• Return address stored on system stack

Page 23: 2_Computers.ppt

23

“Data In” Interrupt Sequence

1. Save address of interrupted instruction

2. Transfer control to Interrupt Service Routine

3. ISR saves contents of required registers

4. ISR checks for error conditions on data input

5. ISR takes input, store in buffer

6. ISR sets flag to indicate new data

7. ISR restores contents of saved registers

8. Control back to interrupted instruction

Page 24: 2_Computers.ppt

24

Read Request

Disk Controller

Disk ControllerCPU

Memory ControllerMemory

Controller

Synchronous I/O:

• CPU requests read, waits

• Disk controller sends interrupt when done

Loop: jmp Loop

Page 25: 2_Computers.ppt

25

Read Request

Disk Controller

Disk ControllerCPU

Memory ControllerMemory

Controller

Asynchronous I/O:

• CPU requests read, does something else

• Disk controller sends interrupt when done

Page 26: 2_Computers.ppt

26

Task 1Task 1

File: zzz File: zzz

Op: Write Op: Write

Device Status Queued

Keyboard Idle 0

Mouse Idle 0

Disk Busy 2

Printer Busy 1

Device Status Table

Task 1Task 1

File: xxx File: xxx

Op: Read Op: Read

Add: 43026 Add: 43026

Len: 20000 Len: 20000

Task 2Task 2

File: yyy File: yyy

Op: Write Op: Write

Add: 03458 Add: 03458

Len: 500 Len: 500

Page 27: 2_Computers.ppt

27

Direct Memory Access (DMA)

Disk Controller

Disk ControllerCPU

Memory ControllerMemory

Controller

• CPU initiates, does something else

• One interrupt per block of data

Page 28: 2_Computers.ppt

28

Data Storage

Disk Controller

Disk ControllerCPU

Memory ControllerMemory

Controller

RegistersRegisters

CacheCache

DRAMDRAM Magnetic DiskMagnetic Disk

Magnetic TapeMagnetic Tape

Page 29: 2_Computers.ppt

29

Operand 1Operand 1

… …

Operand nOperand n

Operand n+1Operand n+1

von Neuman Architecture

Instruction Register

AccumulatorAccumulator

MQ RegisterMQ Register

Register nRegister n

Register n+1Register n+1

Processor

InstructionInstruction

Random Access Memory

… …

… …

… …

… …

Other Registers

Page 30: 2_Computers.ppt

30

I/O Architecture

Printer Controller

Printer Controller

CPU MemoryMemoryMemory-mapped I/O

Mapped to device controller registers

Page 31: 2_Computers.ppt

31

I/O Architecture

Printer Controller

Printer ControllerCPU

Data Register

Data Register

Control RegisterControl Register

1

2

1. Load data byte

2. Set ready bit

3

4

I/O Port

3. Data byte to device

4. Clear ready bit

Page 32: 2_Computers.ppt

32

I/O Architecture

Printer Controller

Printer ControllerCPU

Data Register

Data Register

Control RegisterControl Register

6

5

5. Poll for cleared bit

6. Send next byte

I/O Port

Programmed I/O

Page 33: 2_Computers.ppt

33

I/O Architecture

Printer Controller

Printer ControllerCPU

Data Register

Data Register

Control RegisterControl Register

6

5

5. Interrupt CPU

6. Send next byte

I/O Port

Interrupt-driven I/O

Page 34: 2_Computers.ppt

34

Magnetic Disks

Page 35: 2_Computers.ppt

35

Storage Hierarchy

RegistersRegisters

CacheCache

Main MemoryMain Memory

Electronic DiskElectronic Disk

Magnetic DiskMagnetic Disk

Optical DiskOptical Disk

Magnetic TapesMagnetic Tapes

volatile

nonvolatile

$

Page 36: 2_Computers.ppt

36

Instruction Cache

Instruction Register

Instruct 1Instruct 1

… …

Instruct nInstruct n

Instruct n+1Instruct n+1

… …

… …

… …

… …

Main Memory

InstructionInstruction

Instruction Cache

Page 37: 2_Computers.ppt

37

Memory as Disk Cache

Instruct 1Instruct 1

… …

Instruct nInstruct n

Instruct n+1Instruct n+1

… …

… …

… …

… …

Main Memory

Instruction Cache Hard Drive

Page 38: 2_Computers.ppt

38

Disk Backup System

OO OO

OO OO

OO OO

OO OO

Tape Jukebox

Hard Drive

Weekly rotation

Off-site

Page 39: 2_Computers.ppt

39

Cache Coherency

CPU2CPU2

CacheCache

CPU3CPU3

CacheCache

CPU1CPU1

CacheCache

CPU4CPU4

CacheCache

… …

… …

… …

Main Memory

A’

A

A

A

A

Page 40: 2_Computers.ppt

40

Hardware Protection

Operating System

Operating System

Job 1Job 1

Job 2Job 2

Job 3Job 3

Job 4Job 4

• Illegal instructions

• Address out of range

Trap and terminate job

Page 41: 2_Computers.ppt

41

Operating Modes

Operating System

Operating System

Job 1Job 1

Job 2Job 2

Job 3Job 3

Job 4Job 4

• Monitor Mode– System mode– Supervisor mode– Privileged mode– Privileged instructions

• User mode

Mode bit

Hardware

Page 42: 2_Computers.ppt

42

I/O Protection

User CodeUser Code Operating System

Operating System

I/O DeviceI/O Device

Page 43: 2_Computers.ppt

43

Memory Protection

User CodeUser Code Operating System

Operating System

Interrupt Service

Routines

Interrupt Service

Routines

Interrupt Vector

Interrupt Vector

Page 44: 2_Computers.ppt

44

Memory Protection

User CodeUser Code

Base Register

Base Register

LimitRegister

LimitRegister

Page 45: 2_Computers.ppt

45

CPU Protection

User CodeUser Code

CPUCPU

Countdown Timer

Countdown Timer

Time• Interrupt long jobs

Page 46: 2_Computers.ppt

46

CPU Protection

User CodeUser Code

CPUCPU

Countdown Timer

Countdown Timer

Time• Time slices for time sharing

Page 47: 2_Computers.ppt

47

Local Area Networks

• Bluetooth 1 Mb/s

• Ethernet– 10BaseT– 100BaseT– 100 Gb/s

• Twisted pair

• Fiber optic

Page 48: 2_Computers.ppt

48

Wide Area Networks

RR

RR

RR

CPCP

RR

CPCP

CPCP

RR

• Routers

• Communication Processors