CSC 452 I/O Block Devices A device that stores data in fixed-sized - - PDF document

csc 452 i o
SMART_READER_LITE
LIVE PREVIEW

CSC 452 I/O Block Devices A device that stores data in fixed-sized - - PDF document

8/4/2020 CSC 452 I/O Block Devices A device that stores data in fixed-sized blocks, each uniquely addressed, and can Jonathan Misurda be randomly accessed jmisurda@cs.arizona.edu 1 2 Character Devices Device Controllers Device that


slide-1
SLIDE 1

8/4/2020 1

CSC 452 – I/O

Jonathan Misurda jmisurda@cs.arizona.edu

Block Devices

A device that stores data in fixed-sized blocks, each uniquely addressed, and can be randomly accessed

Character Devices

Device that delivers or accepts a stream

  • f characters

Device Controllers

The electronic component of an I/O unit, in contrast with the physical component.

Memory-Mapped I/O

Separate I/O & memory space 0xFFF… Memory I/O ports Memory-mapped I/O Hybrid: both memory-mapped & separate spaces

Interrupts

Bus

1 2 3 4 5 6

slide-2
SLIDE 2

8/4/2020 2

Programmed I/O

Printed page ABCD EFGH Kernel User A Printed page ABCD EFGH ABCD EFGH AB Printed page ABCD EFGH ABCD EFGH

Polling

copy_from_user (buffer, p, count); // copy into kernel buffer for (j = 0; j < count; j++) { // loop for each char while (*printer_status_reg != READY) ; // wait for printer to be ready *printer_data_reg = p[j]; // output a single character } return_to_user();

Interrupt-Driven I/O

copy_from_user (buffer, p, count); j = 0; enable_interrupts(); while (*printer_status_reg != READY) ; *printer_data_reg = p[0]; scheduler(); // and block user if (count == 0) { unblock_user(); } else { *printer_data_reg = p[j]; count--; j++; } acknowledge_interrupt(); return_from_interrupt();

System Call Interrupt Handler

DMA DMA

copy_from_user (buffer, p, count); set_up_DMA_controller(); scheduler(); // and block user acknowledge_interrupt(); unblock_user(); return_from_interrupt();

System Call Interrupt Handler

I/O Request

7 8 9 10 11 12

slide-3
SLIDE 3

8/4/2020 3 Soft Timers

Do we really need hardware timer interrupts for preemption?

Disks

sector cylinder platter spindle track head actuator surfaces

RAID

strip strip RAID 0 (Redundant Array of Inexpensive Disks RAID 1 (Mirrored copies) RAID 4 (Striped with parity) RAID 5 (Parity rotates through disks)

CD-ROMs Disk Requests

  • Seek time
  • Rotational delay
  • Actual transfer time

Disk Request Scheduling

100 175 51 133 8 140 73 77 read/write head position disk requests (cylinder in which block resides) Outside edge Inside edge Disk seek algorithm examples assume a request queue & head position (disk has 200 cylinders) Queue = 100, 175, 51, 133, 8, 140, 73, 77 Head position = 63

13 14 15 16 17 18

slide-4
SLIDE 4

8/4/2020 4 Seek Distance

Total distance travelled to service a set of disk requests

First-Come, First-Served (FCFS)

100 175 51 133 8 140 73 77 Read/write head start Seek distance = (100-63) + (175-100) + (175-51) + (133-51) + (133-8) + (140-8) + (140-73) + (77-73) = 646 cylinders

Shortest Seek Time First

100 175 51 133 8 140 73 77 Read/write head start Seek distance = 10 + 4 + 23 + 33 + 7 + 35 + 126 + 43 = 281 cylinders

SCAN (Elevator Algorithm)

Seek distance = 12 + 43 + 8 + 73 + 4 + 23 + 33 + 7 + 35 = 238 cylinders 100 175 51 133 8 140 73 77 Read/write head start

LOOK

Seek distance = 12 + 43 + 65 + 4 + 23 + 33 + 7 + 35 = 222 cylinders 100 175 51 133 8 140 73 77 Read/write head start

C-SCAN

Seek distance = 10 + 4 + 23 + 33 + 7 + 35 + 24 + 199 + 8 + 43 = 386 cylinders 100 175 51 133 8 140 73 77 Read/write head start

19 20 21 22 23 24

slide-5
SLIDE 5

8/4/2020 5

C-LOOK

Seek distance = 10 + 4 + 23 + 33 + 7 + 35 + 167 + 43 = 322 cylinders 100 175 51 133 8 140 73 77 Read/write head start

25