itec 502 컴퓨터 시스템 및 실습 chapter 8-1: i/o management mi-jung choi...

23
ITEC 502 컴컴컴 컴컴컴 컴 컴컴 Chapter 8-1: I/O Management Mi-Jung Choi [email protected] DPNM Lab. Dept. of CSE, POSTECH

Upload: angela-wilkinson

Post on 29-Dec-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC 502 컴퓨터 시스템 및 실습

Chapter 8-1:I/O Management

Mi-Jung [email protected]

DPNM Lab. Dept. of CSE, POSTECH

Page 2: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

2

Contents

Principles of I/O hardware Principles of I/O software I/O software layers

Page 3: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

3

Principles of I/O Hardware

Some typical device, network, and bus data rates

Page 4: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

4

Device Controllers

I/O devices have components:– mechanical component – electronic component

The electronic component is the device controller or adapter– may be able to handle multiple devices

Controller's tasks– convert serial bit stream to block of bytes– perform error correction as necessary– make available to main memory

Page 5: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

5

Memory-Mapped I/O (1)

Separate I/O and memory space Memory-mapped I/O Hybrid

Page 6: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

6

Memory-Mapped I/O (2)

(a) A single-bus architecture(b) A dual-bus memory architecture

Page 7: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

7

Direct Memory Access (DMA)

Operation of a DMA transfer

Page 8: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

8

Interrupts Revisited

How interrupts happens. Connections between devices and interrupt controller actually use interrupt lines on the bus rather than dedicated wires

Bus

Page 9: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

9

Principles of I/O SoftwareGoals of I/O Software (1)

Device independence– programs can access any I/O device – without specifying device in advance

· floppy, hard drive, or CD-ROM

Uniform naming– name of a file or device a string or an

integer– not depending on which machine

Error handling– handle as close to the hardware as possible

Page 10: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

10

Goals of I/O Software (2)

Synchronous vs. asynchronous transfers– blocked transfers vs. interrupt-driven

Buffering– data coming off a device cannot be directly

stored in final destination

Sharable vs. dedicated devices– disks are sharable– tape drives would not be

Page 11: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

11

Programmed I/O (1)

Steps in printing a string

Page 12: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

12

Programmed I/O (2)

Writing a string to the printer using programmed I/O

buffer */

Page 13: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

13

Interrupt-Driven I/O

Writing a string to the printer using interrupt-driven I/O– (a) Code executed when print system call is made– (b) Interrupt service procedure

Page 14: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

14

I/O Using DMA

Printing a string using DMA– (a) code executed when the print system call is

made– (b) interrupt service procedure

Page 15: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

15

I/O Software Layers

Layers of the I/O Software System

Page 16: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

16

Interrupt Handlers (1)

Interrupt handlers are best hidden– have driver starting an I/O operation block until

interrupt notifies of completion

Interrupt procedure does its task– then unblocks driver that started it

Page 17: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

17

Interrupt Handlers (2)

Steps must be performed in software after interrupt completed

1. Save regs not already saved by interrupt hardware2. Set up context for interrupt service procedure3. Set up stack for interrupt service procedure4. Ack interrupt controller, reenable interrupts5. Copy registers from where saved6. Run service procedure 7. Set up MMU context for process to run next8. Load new process' registers9. Start running the new process

Page 18: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

18

Device Drivers

Logical position of device drivers is shown here Communications between drivers and device controllers

go over the bus

Page 19: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

19

Device-Independent I/O Software (1)

Functions of the device-independent I/O software

Uniform interfacing for device drivers

Buffering

Error reporting

Allocating and releasing dedicate devices

Providing a device-independent block size

Page 20: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

20

Device-Independent I/O Software (2)

(a) Without a standard driver interface(b) With a standard driver interface

Page 21: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

21

Device-Independent I/O Software (3)

(a) Unbuffered input(b) Buffering in user space(c) Buffering in the kernel followed by copying to user space(d) Double buffering in the kernel

Page 22: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

22

Device-Independent I/O Software (4)

Networking may involve many copies

Page 23: ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi mjchoi@postech.ac.kr DPNM Lab. Dept. of CSE, POSTECH

ITEC502 컴퓨터 시스템 및 실습

23

User-Space I/O Software

Layers of the I/O system and the main functions of each layer