Lecture 9: Input/Output Computer Systems & Architecture ...

17
ICT 1110 (2020/21) Computer Systems & Architecture Lecture 9: Input/Output Subsystem Lighton Phiri < [email protected]> Department of Library & Information Science University of Zambia https://bit.ly/3uJBZRc ICT 1110 (2020/21) L09 - 2 May 13, 2021 Announcements—May 13, 2021 Scheduled Assessments [Online] Quiz #06: May 14, 2021 at 17H00 GMT+2 Von Neumann Model Open from 17H00 to 17H30 GMT+2 [Online] Quiz #07: May 21, 2021 at 17H00 GMT+2 CPU Instruction Cycle Open from 17H00 to 17H30 GMT+2 ICT 1110 (2020/21) L09 - 3 May 13, 2021 Lecture Outline Introduction Peripherals Characteristics Input/Output Subsystem Input/Output Controllers Programmed I/O Interrupt-driven I/O Direct Memory Access ICT 1110 (2020/21) L09 - 4 May 13, 2021 Computers Take in Input, Process it and Produce Output (1/2) A Computer is an electronic device that accepts input, processes the input, and presents the change input (processed input) as output Mwabu Tablet: Lenovo TB-7304I https://www.gsmarena.com/lenovo_tab_7-8941.php

Transcript of Lecture 9: Input/Output Computer Systems & Architecture ...

Page 1: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21)Computer Systems & Architecture

Lecture 9: Input/Output Subsystem

Lighton Phiri <[email protected]>Department of Library & Information Science

University of Zambiahttps://bit.ly/3uJBZRc

ICT 1110 (2020/21) L09 - 2May 13, 2021

Announcements—May 13, 2021

● Scheduled Assessments○ [Online] Quiz #06: May 14, 2021 at 17H00 GMT+2

○ Von Neumann Model○ Open from 17H00 to 17H30 GMT+2

○ [Online] Quiz #07: May 21, 2021 at 17H00 GMT+2○ CPU Instruction Cycle○ Open from 17H00 to 17H30 GMT+2

ICT 1110 (2020/21) L09 - 3May 13, 2021

Lecture Outline

● Introduction● Peripherals Characteristics● Input/Output Subsystem● Input/Output Controllers● Programmed I/O● Interrupt-driven I/O● Direct Memory Access

ICT 1110 (2020/21) L09 - 4May 13, 2021

Computers Take in Input, Process it and Produce Output (1/2)

● A Computer is an electronic device that accepts input, processes the input, and presents the change input (processed input) as output

Mwabu Tablet: Lenovo TB-7304I

https://www.gsmarena.com/lenovo_tab_7-8941.php

Page 2: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 5May 13, 2021

Computers Take in Input, Process it and Produce Output (2/2)● A Computer is an electronic device that accepts input,

processes the input, and presents the changed input (processed input) as output.○ Input initialises interactivity with computer system.○ Output provides mechanisms to access computer system output.○ The CPU performs computations.○ Memory provides a means for storing processed data.

CentralProcessing Unit

Input/Output Memory

ICT 1110 (2020/21) L09 - 6May 13, 2021

Von Neumann Model Functional Units (1/3)

● Components of Von Neumann Architecture.○ Input/Output○ Central processing Unit

○ Arithmetic Logic Unit○ Control Unit○ Registers

○ Memory Unit○ Buses

Central Processing Unit

Registers

Control Unit

ALU

Inpu

t/O

utpu

t

Memory Unit[Instructions]

[Data]

ICT 1110 (2020/21) L09 - 7May 13, 2021

Von Neumann Model Functional Units (2/3)

● Components of Von Neumann Architecture.○ Input/Output○ Central processing Unit

○ Arithmetic Logic Unit○ Control Unit○ Registers

○ Memory Unit○ Buses

Central Processing Unit

Registers

Control Unit

ALU

Inpu

t/O

utpu

t

Memory Unit[Instructions]

[Data]

ICT 1110 (2020/21) L09 - 8May 13, 2021

Von Neumann Model Functional Units (3/3)

Central Processing Unit

Registers

Control Unit

ALU

Inpu

t/O

utpu

t

Memory Unit[Instructions]

[Data]

● Input/Output○ Input interfaces allow the computer to

receive data for processing.○ Output interfaces allow the computer to

send data to output devices.○ I/O interfaces also enable communication

between the computer and end users, and secondary storage devices.

Page 3: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 9May 13, 2021

Peripheral Characteristics

The Architecture of Computer Hardware and System Software

ICT 1110 (2020/21) L09 - 10May 13, 2021

Peripheral Characteristics: Devices (1/2)

The Architecture of Computer Hardware and System Software

ICT 1110 (2020/21) L09 - 11May 13, 2021

Peripheral Characteristics: Devices (2/2)

● I/O devices vary based on the type of end-user that initiates interaction.○ Human-to-machine interaction involves

human input or output is presented to a human. e.g. Clicking a mouse.

○ Machine-to-machine interaction involves interaction between machines. e.g. Output being stored to disk.

● Data rates are significantly lower for human-to-machine interaction.

ICT 1110 (2020/21) L09 - 12May 13, 2021

Peripheral Characteristics: Input/Output (1/2)

The Architecture of Computer Hardware and System Software

Page 4: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 13May 13, 2021

Peripheral Characteristics: Input/Output (2/2)● I/O devices can classified based on

the origin or destination of data and/or information.○ Input devices send data to the CPU.○ Output devices receive data from the

CPU.○ Storage devices receive and store data

from the CPU.○ Communications devices send and/or

receive data from remote hosts (networking devices).

ICT 1110 (2020/21) L09 - 14May 13, 2021

Peripheral Characteristics: Data Rates (1/5)

The Architecture of Computer Hardware and System Software

ICT 1110 (2020/21) L09 - 15May 13, 2021

Peripheral Characteristics: Data Rates (2/5)

● I/O data rates represent the throughput—an I/O performance measure—of the device.○ Data that can be input (output) and

communicated to the processor/ memory (I/O device) per unit time.

● I/O response time (latency)—an I/O measure—is the total elapsed time to accomplish an input or output operation.

ICT 1110 (2020/21) L09 - 16May 13, 2021

Peripheral Characteristics: Data Rates (3/5)

● Throughput = Measurable / Time○ Throughput (File transfer) = Size / T○ Given either one of the variable, the

others can be derived

Page 5: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 17May 13, 2021

Peripheral Characteristics: Data Rates (4/5)

0/1 1 bit

8 bits 1 Byte

1024 Bytes 1KB

1024 KB 1MB

1024 MB 1 GB

1024 GB 1 TB

● File size measure how big the file or how much space it occupies○ Measured in terms of KiloBytes (KBps

that is uppercase “K” and uppercase “B”).

○ In computing the upper case “K” stands for 1024.

ICT 1110 (2020/21) L09 - 18May 13, 2021

Peripheral Characteristics: Data Rates (5/5)

1000 bits/sec 1 kbs

1000 kbps 1 Mbps

1000 Mbps 1 Gbps

● Data transfer rate are typically calculated in terms of bits per second usually kbps (lower case "k" and lower case "b"). ○ The higher the kbps means more the

bits transferred per second, more the speed, faster the network/connection. Here, k stands for 1000 that is 103 and b stands for bits.

ICT 1110 (2020/21) L09 - 19May 13, 2021

Peripheral Characteristics: Data Rates Illustration #1 (1/3)● 19.2 GB of high-resolution

video footage is being transferred from an SD Card to a LENOVO ideapad 320 at a rate of 7.3 MB/s○ How long will it take to

complete the transfer

ICT 1110 (2020/21) L09 - 20May 13, 2021

Peripheral Characteristics: Data Rates Illustration #1 (2/3)● 19.2 GB of high-resolution video

footage is being transferred from an SD Card to a LENOVO ideapad 320 at a rate of 7.3 MB/s○ T = S/t○ t = S/T○ S = 19.2 GB○ T = 7.3 MB/s○ 19.2 GB = 19.2*1024 MB

0/1 1 bit

8 bits 1 Byte

1024 Bytes 1KB

1024 KB 1MB

1024 MB 1 GB

1024 GB 1 TB

Page 6: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 21May 13, 2021

Peripheral Characteristics: Data Rates Illustration #1 (2/3)● 19.2 GB of high-resolution video

footage is being transferred from an SD Card to a LENOVO ideapad 320 at a rate of 7.3 MB/s○ t = S/T○ S = 19.2*1024 MB○ T = 7.3 MB/s○ [...]○ t = (19.2*1024 MB) / 7.3 MB/s○ t = 2693.26027397 secs

0/1 1 bit

8 bits 1 Byte

1024 Bytes 1KB

1024 KB 1MB

1024 MB 1 GB

1024 GB 1 TB

ICT 1110 (2020/21) L09 - 22May 13, 2021

Peripheral Characteristics: Data Rates Illustration #1 (2/3)● 19.2 GB of high-resolution video

footage is being transferred from an SD Card to a LENOVO ideapad 320 at a rate of 7.3 MB/s○ t = 2693.26027397 secs○ t = 44.8876712329 minutes○ t = ~45 minutes

0/1 1 bit

8 bits 1 Byte

1024 Bytes 1KB

1024 KB 1MB

1024 MB 1 GB

1024 GB 1 TB

ICT 1110 (2020/21) L09 - 23May 13, 2021

Peripheral Characteristics: Data Rates Illustration #1 (3/3)● 19.2 GB of high-resolution

video footage is being transferred from an SD Card to a LENOVO ideapad 320 at a rate of 7.3 MB/s○ How long will it take to

complete the transfer○ ~45 minutes

ICT 1110 (2020/21) L09 - 24May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (1/4)● To avoid mixing up kbps and Kbps

a conversion would have to be done○ Given the transfer rate in kbps, file

transfer rate can be computed○ Download KBps speed = ((kbps

value * 1000)/8)/1024

Page 7: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 25May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (2/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ How long would it take to download

a 10 MB PDF file?

ICT 1110 (2020/21) L09 - 26May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ T = S/t○ t = S/T○ S = 10MB○ T = 5.27mbps○ 10MB = 10*1024*1024 bytes

ICT 1110 (2020/21) L09 - 27May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ T = S/t○ t = S/T○ S = 10MB○ T = 5.27mbps○ 10MB = 10*1024*1024 bytes

ICT 1110 (2020/21) L09 - 28May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ T = S/t○ t = S/T○ S = 10MB○ T = 5.27mbps○ 10MB = 10*1024*1024 bytes

Page 8: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 29May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ T = S/t○ t = S/T○ S = 10MB○ T = 5.27mbps○ 10MB = 10*1024*1024 bytes

ICT 1110 (2020/21) L09 - 30May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ T = S/t○ t = S/T○ S = 10MB○ T = 5.27mbps○ 10MB = 10*1024*1024 bytes

ICT 1110 (2020/21) L09 - 31May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ 10MB = 10*1024*1024 bytes○ [...]○ 1 bit = 1/8byte○ = (5270000)(1/8) bytes/s

ICT 1110 (2020/21) L09 - 32May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ 10MB = 10*1024*1024 bytes○ [...]○ 1 bit = 1/8byte○ = (5270000)(1/8) bytes/s

Page 9: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 33May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ 10MB = 10*1024*1024 bytes○ [...]○ 1 bit = 1/8byte○ = (5270000)(1/8) bytes/s

ICT 1110 (2020/21) L09 - 34May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ 10MB = 10*1024*1024 bytes○ [...]○ 5.27 = 5270 bits/s○ = (5270)(1/8 bits/byte) bits/s

ICT 1110 (2020/21) L09 - 35May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ S = 10*1024*1024 bytes○ [...]○ T = (5270)(1/8) bytes/s○ t = (10*1024*1024)/(658750)○ t = 15.92 s

ICT 1110 (2020/21) L09 - 36May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ S = 10*1024*1024 bytes○ [...]○ T = (5270)(1/8) bytes/s○ t = (10*1024*1024)/(658750)○ t = 15.92 s

Page 10: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 37May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ S = 10*1024*1024 bytes○ [...]○ T = (5270)(1/8) bytes/s○ t = (10*1024*1024)/(658750)○ t = 15.92 s

ICT 1110 (2020/21) L09 - 38May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ S = 10*1024*1024 bytes○ [...]○ T = (5270)(1/8) bytes/s○ t = (10*1024*1024)/(658750)○ t = 15.92 s

ICT 1110 (2020/21) L09 - 39May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (3/4)● To avoid mixing up kbps and Kbps

a conversion could potentially have to be done○ 1kbps○ 1 byte = 8 bits○ 1 bit = 1/8 byte○ 1KB = 1024 bytes○ 1 byte = 1/1024KB

ICT 1110 (2020/21) L09 - 40May 13, 2021

Peripheral Characteristics: Data Rates Illustration #2 (4/4)● ZAMTEL’s download speed on the

fifth floor of the School of Education Building at The UNZA is 5.27mbps○ How long would it take to download

a 10 MB PDF file?○ ~16 seconds

Page 11: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 41May 13, 2021

Peripheral Data Rates Have Wide Applications

ICT 1110 (2020/21) L09 - 42May 13, 2021

Peripheral Data Rates Have Wide Applications

ICT 1110 (2020/21) L09 - 43May 13, 2021

Peripheral Data Rates Have Wide Applications

ICT 1110 (2020/21) L09 - 44May 13, 2021

Peripheral Data Rates Have Wide Applications

Page 12: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 45May 13, 2021

Peripheral Characteristics: Data Type (1/2)

The Architecture of Computer Hardware and System Software

ICT 1110 (2020/21) L09 - 46May 13, 2021

Peripheral Characteristics: Data Type (2/2)

● I/O devices can also be classified in terms of the type of data that they send and/or receive.○ Block devices

○ Appear as bytes of data that is organized into blocks of a fixed size.

○ Character/stream devices○ Appear as a stream of bytes with no

particular structure imposed by the device.

ICT 1110 (2020/21) L09 - 47May 13, 2021

I/O Module Characteristics

Central Processing Unit

Registers

Control Unit

ALU

Inpu

t/O

utpu

t

Memory Unit[Instructions]

[Data]

● Fundamentally, the I/O subsystem handles different types of devices for handling different types of data

● The design and implementation needs to take this into account○ Designed to scale effectively○ Designed to handle multiple devices at

any given point in time○ Design to order operations coming

through from multiple devices

ICT 1110 (2020/21) L09 - 48May 13, 2021

I/O Module Functions (1/3)

Central Processing Unit

Registers

Control Unit

ALU

Inpu

t/O

utpu

t

Memory Unit[Instructions]

[Data]

● The Input/Output module facilitates communication between peripherals and the system bus.○ Numerous peripherals, with different

characteristics exist.○ Data transfer rates are different for

various peripheral devices.

Page 13: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 49May 13, 2021

I/O Module Functions (2/3)

Central Processing Unit

Registers

Control Unit

ALU

Inpu

t/O

utpu

t

Memory Unit[Instructions]

[Data]

● The Input/Output module provides core functionalities aimed at:○ Controlling and timing.

○ Coordination of data and instructions between CPU and external devices.

○ Processor communication.○ Send signals to/from CPU.

ICT 1110 (2020/21) L09 - 50May 13, 2021

I/O Module Functions (3/3)

Central Processing Unit

Registers

Control Unit

ALU

Inpu

t/O

utpu

t

Memory Unit[Instructions]

[Data]

● The Input/Output module provides core functionalities aimed at:○ Device communication.

○ Send data and instruction to/from external devices.

○ Data buffering.○ Synchronise data exchange when data

rates are different.○ Error detection.

○ Reporting errors to CPU

ICT 1110 (2020/21) L09 - 51May 13, 2021

I/O Controllers (1/4)

I/OController

I/OController

I/OController

I/O Bus

● I/O subsystem is composed of I/O controllers, for each peripheral, which connect to an I/O bus.○ I/O bus connects to CPU via the memory that, using an I/O bus

adapter.

ICT 1110 (2020/21) L09 - 52May 13, 2021

I/O Controllers (2/4)

Device Controllers on Lenovo ThinkPad T540p

Page 14: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 53May 13, 2021

I/O Controllers (3/4)

I/OController

I/OController

● Receive I/O signals from the CPU and send corresponding device control signals to the peripherals

● Manage the flow of data to/from the device, giving the CPU more time to perform other tasks

ICT 1110 (2020/21) L09 - 54May 13, 2021

I/O Controllers (4/4)

I/OController

I/OController

● New device requires its own controller which must be plugged into a connector (an expansion slot) on the motherboard○ When a new peripheral (hardware) is

integrated (plugged into expansion slots) with a computer system, a corresponding device driver (software) must be installed

ICT 1110 (2020/21) L09 - 55May 13, 2021

I/O Handling Methods

I/OController

I/OController

● I/O operations are handled using three main techniques.○ Programmed I/O○ Interrupt driven I/O○ Direct memory access

● All techniques are aligned with the amount of work done by the CPU to perform I/O operations○ Operations performed by I/O devices

need to be processed

ICT 1110 (2020/21) L09 - 56May 13, 2021

Programmed I/O (1/2)

● Programmed I/O approach.○ CPU routinely checks if there are any I/O requests available. ○ If none exist, it keeps executing its normal workflow. ○ If there is, it handles the IO request instead.

● Polling process heuristic○ CPU probes devices to check if operations are pending○ If operation is pending

○ Initiate processing○ Data is transmitted

○ If no operation is pending○ CPU continues with instruction execution

Page 15: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 57May 13, 2021

Programmed I/O (2/2)

● Pros○ [...]○ [...]

● Cons○ Highly inefficient for systems with a number of I/O devices○ [...]

ICT 1110 (2020/21) L09 - 58May 13, 2021

Interrupt-Driven I/O (1/2)

● Interrupt-driven I/O approach.○ I/O device requiring attention notifies the CPU○ CPU temporarily stops execution of instruction by issuing an

interruption service routine○ CPU execution state is saved to memory to reserve resources for the

interruption service routine (ISR)○ Interruption lookup vector table has address in memory with ISR of

I/O devices connected to the computer system○ After execution of I/O operations, CPU is returned to its saved

state

ICT 1110 (2020/21) L09 - 59May 13, 2021

Interrupt-Driven I/O (2/2)

● Pros○ [...]○ [...]

● Cons○ [...]○ [...]

ICT 1110 (2020/21) L09 - 60May 13, 2021

Direct Memory Access (1/2)

● Direct Memory Access approach.○ Remember that some I/O operations work with data blocks○ I/O device sends or receives data directly to/from main memory,

bypassing the CPU to speed up memory operations. ○ The process is managed by a chip known as a DMA controller (DMAC).

○ DMA allows the device to transfer data at a much faster rate○ DMA operations perform to initiated to release system bus

○ Peripheral send DMA request (DRQ) to DMA controller○ DMA sends hold request (HLQ)to CPU○ CPU sends hold acknowledgement signal (HLDA)

○ DMA controller because master, CPU slave

Page 16: Lecture 9: Input/Output Computer Systems & Architecture ...

ICT 1110 (2020/21) L09 - 61May 13, 2021

Direct Memory Access (2/2)

● Pros○ [...]○ [...]

● Cons○ [...]○ [...]

ICT 1110 (2020/21) L09 - 62May 13, 2021

On I/O Handling Techniques Homework

● Consider [...]● CPU Time Usage—Efficiency ● Circuit Complexity—Cost ● Complexity of design and implementation

ICT 1110 (2020/21) L09 - 63May 13, 2021

Summary

● I/O Functionalities● Peripheral Characteristics● I/O Controllers● Programmed I/O● Interrupt-driven I/O● Direct Memory Access

ICT 1110 (2020/21) L09 - 64May 13, 2021

Q & A Session

● Comments, concerns and complaints?

Page 17: Lecture 9: Input/Output Computer Systems & Architecture ...

[1] Stallings, W. (2013) Chapter 3. Input/Output. Computer Organization and Architecture (9th Edition)

[2] Arpaci-Dusseau, R.H. and Arpaci-Dusseau, A. C. (2018) Chapter 2. I/O Devices. Operating Systems: Three Easy Pieceshttp://pages.cs.wisc.edu/~remzi/OSTEP/file-devices.pdf

Bibliography

[email protected] https://bit.ly/3uJBZRc http://bit.ly/2kK2ZkA

ICT 1110 (2020/21)Computer Systems & Architecture

Lecture 9: Input/Output Subsystem

Lighton Phiri <[email protected]>Department of Library & Information Science

University of Zambiahttps://bit.ly/3uJBZRc