137
Operating Systems I/0 devices Nipun Batra

Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Operating Systems I/0 devices

Nipun Batra

Page 2: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Motivation

What good is a computer without any I/O devices? - keyboard, display, disks

We want: - H/W that will let us plug in different devices - OS that can interact with different combinations

Largely a communication problem…

2

Page 3: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

3

CPU RAM

Memory Bus

System Architecture

Page 4: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

4

CPU RAM

Graphics

Memory BusGeneral I/O Bus (e.g., PCI)

System Architecture

Page 5: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

5

CPU RAM

Graphics

Memory BusGeneral I/O Bus (e.g., PCI)

Peripheral I/O Bus (e.g., SCSI, SATA, USB)

Why use hierarchical buses?

System Architecture

Page 6: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Canonical Device

6

Status COMMAND DATADevice Registers:

Page 7: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Canonical Device

7

Status COMMAND DATA

OS reads/writes to these

Device Registers:

Page 8: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Canonical Device

8

Status COMMAND DATA

OS reads/writes to these

Hidden Internals: ???

Device Registers:

Page 9: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Canonical Device

9

Status COMMAND DATADevice Registers:

OS reads/writes to these

Hidden Internals:Microcontroller (CPU+RAM) Extra RAM Other special-purpose chips

Page 10: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Example Protocol

while (STATUS == BUSY) ; // spin Write data to DATA register Write command to COMMAND register while (STATUS == BUSY) ; // spin

10

Page 11: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

11

CPU:

Disk:

Example

Page 12: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

12

A

C

CPU:

Disk:

Example

Page 13: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

13

A

C

A wants to do I/OCPU:

Disk:

Example

Page 14: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

14

A

C

CPU:

Disk:

Example

Page 15: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

15

2

A

AC

CPU:

Disk:

Example

Page 16: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

16

2

A

AC

3

CPU:

Disk:

Example

Page 17: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

17

2 43

A

C A

CPU:

Disk:

Example

Page 18: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

18

2 43

A

C A

CPU:

Disk:

Example

Page 19: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

19

2 43

A B

C A

CPU:

Disk:

Example

Page 20: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

20

2 43

A B

C A

CPU:

Disk:

Example

How to avoid spinning?

Page 21: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1

while (STATUS == BUSY) // 1 ; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 ;

21

2 43

A B

C A

CPU:

Disk:

Example

How to avoid spinning? Interrupts!

Page 22: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

1 2 43

A B

C A

how to avoid spinning? interrupts!

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

22

CPU:

Disk:

Example

Page 23: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

23

23,4

A B

C A

how to avoid spinning? interrupts!

B B AA

1

CPU:

Disk:

Example

Page 24: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

Discuss: are interrupts ever worse?

24

Page 25: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

Discuss: are interrupts ever worse?

Interrupts can sometimes lead to livelock - e.g., flood of network packets

25

Page 26: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

26

Page 27: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

• Discuss: are interrupts ever worse?

26

Page 28: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

• Discuss: are interrupts ever worse?• Interrupts can sometimes lead to livelock

26

Page 29: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

• Discuss: are interrupts ever worse?• Interrupts can sometimes lead to livelock

• e.g., flood of network packets

26

Page 30: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

• Discuss: are interrupts ever worse?• Interrupts can sometimes lead to livelock

• e.g., flood of network packets• Techniques:

26

Page 31: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

• Discuss: are interrupts ever worse?• Interrupts can sometimes lead to livelock

• e.g., flood of network packets• Techniques:

• hybrid approach

26

Page 32: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

• Discuss: are interrupts ever worse?• Interrupts can sometimes lead to livelock

• e.g., flood of network packets• Techniques:

• hybrid approach• Poll for a while, then wait for interrupts

26

Page 33: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

• Discuss: are interrupts ever worse?• Interrupts can sometimes lead to livelock

• e.g., flood of network packets• Techniques:

• hybrid approach• Poll for a while, then wait for interrupts

• interrupt coalescing

26

Page 34: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Interrupts vs. Polling

• Discuss: are interrupts ever worse?• Interrupts can sometimes lead to livelock

• e.g., flood of network packets• Techniques:

• hybrid approach• Poll for a while, then wait for interrupts

• interrupt coalescing• Coalesce or combine the delivery of multiple

interrupts

26

Page 35: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Protocol Variants

Status checks: polling vs. interrupts

Data: PIO vs. DMA

Control: special instructions vs. memory-mapped I/O

27

Page 36: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

28

23,4

A BCPU:

Disk: C A

B B AA

1

Page 37: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

29

23,4

A BCPU:

Disk: C A

B B AA

1

Page 38: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

29

23,4

A BCPU:

Disk: C A

B B AA

1

What else can we optimize?

Page 39: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

29

23,4

A BCPU:

Disk: C A

B B AA

1

What else can we optimize? Data transfer!

Page 40: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Programmed I/O vs. Direct Memory Access

PIO (Programmed I/O): - CPU directly tells device what data is

DMA (Direct Memory Access): - CPU leaves data in memory - DMA device does copy

30

Page 41: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

PIO Flow

31

CPU RAM

Disk

Page 42: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

DMA Flow

32

CPU RAM

Disk

Page 43: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

33

23,4

A BCPU:

Disk: C A

B B AA

1

Page 44: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

while (STATUS == BUSY) // 1 wait for interrupt; initiate DMA transfer // 2a wait for interrupt // 2b Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

34

2b,3,4

A BCPU: B B A

1

DMA:

Disk: C A

A

2a

B

Page 45: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Protocol Variants

Status checks: polling vs. interrupts

Data: PIO vs. DMA

Control: special instructions vs. memory-mapped I/O

35

Page 46: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

ACPU:

Disk: C A

B B A

1 3,4

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

36

Page 47: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

ACPU:

Disk: C A

B B A

1 3,4

while (STATUS == BUSY) // 1 wait for interrupt; Write data to DATA register // 2 Write command to COMMAND register // 3 while (STATUS == BUSY) // 4 wait for interrupt;

37

How does OS read and write registers?

Page 48: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Special Instructions vs. Mem-Mapped I/OSpecial instructions - each device has a port - in/out instructions (x86) communicate with device

Memory-Mapped I/O - H/W maps registers into address space - loads/stores sent to device

Doesn’t matter much (both are used).

38

Page 49: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Variety is a ChallengeProblem: - many, many devices - each has its own protocol

How can we avoid writing a slightly different OS for each H/W combination?

39

Page 50: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Solution

Encapsulation!

Write driver for each device.

Drivers are 70% of Linux source code.

40

Page 51: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Solution

Encapsulation!

Write driver for each device.

Drivers are 70% of Linux source code.

Encapsulation also enables us to mix-and-match devices, schedulers, and file systems.

41

Page 52: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Storage Stack

42

applicationfile systemscheduler

driverhard drive

Page 53: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Storage Stack

43

applicationfile systemscheduler

driverhard drive

build common interface on top of all HDDs

Page 54: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Storage Stack

44

applicationfile systemscheduler

driverhard drive

build common interface on top of all HDDs

what about special capabilities?

Page 55: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Hard-disk Basic Interface

45

Page 56: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Hard-disk Basic Interface

Disk has a sector-addressable address space

45

Page 57: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Hard-disk Basic Interface

Disk has a sector-addressable address space(so a disk is like an array of sectors).

45

Page 58: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Hard-disk Basic Interface

Disk has a sector-addressable address space(so a disk is like an array of sectors).

45

Page 59: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Hard-disk Basic Interface

Disk has a sector-addressable address space(so a disk is like an array of sectors).

Sectors are typically 512 bytes or 4096 bytes.

45

Page 60: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Hard-disk Basic Interface

Disk has a sector-addressable address space(so a disk is like an array of sectors).

Sectors are typically 512 bytes or 4096 bytes.

45

Page 61: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Hard-disk Basic Interface

Disk has a sector-addressable address space(so a disk is like an array of sectors).

Sectors are typically 512 bytes or 4096 bytes.

Main operations: reads + writes to sectors (blocks).

45

Page 62: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

46

Platter

Hard-disk Basic Interface

Page 63: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

46

Platter

Hard-disk Basic Interface

Platter is covered with a magnetic film.

Page 64: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

47

Spindle

Hard-disk Basic Interface

Page 65: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

48

Surface

Surface

Hard-disk Basic Interface

Page 66: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

49

Many platters may be bound to the spindle.

Hard-disk Basic Interface

Page 67: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

50

Hard-disk Basic Interface

Page 68: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

51

Each surface is divided into rings called tracks. A stack of tracks (across platters) is called a cylinder.

Hard-disk Basic Interface

Page 69: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

52

The tracks are divided into numbered sectors.

123

065 4

78

9

1011

1514

1312

16

17

18

19

23

22

21

20

Hard-disk Basic Interface

Page 70: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

53

Heads on a moving arm can read from each surface.

123

065 4

78

9

1011

1514

1312

16

17

18

19

23

22

21

20

Hard-disk Basic Interface

Page 71: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

54

123

065 4

78

9

1011

1514

1312

16

17

18

19

23

22

21

20

spin

Spindle/platters rapidly spin.

Hard-disk Basic Interface

Page 72: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Don’t try this at home!

http://youtu.be/9eMWG3fwiEU?t=30s

55

Page 73: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Let’s Read 12!

56

123

065 4

78

9

1011

1514

1312

16

17

18

19

23

22

21

20

Page 74: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek to right track.

57

12

3

065 4

78

9

10

11

1514

1312

16

17

18

19

23

22

21

20

Page 75: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek to right track.

58

12

3

065 4

78 9

10

11

15

14

1312

1617

18

19

23

22

2120

Page 76: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek to right track.

59

12

3

06

5 4

7

8 910

11

15

1413 12

16 17

18

19

23

22

21 20

Page 77: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Wait for rotation.

60

1 23

06 5 4

78 9

1011

1514

13 12

16

17

1819

2322

21

20

Page 78: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Wait for rotation.

61

1 230

6 547

89 10

11

1514 13

12

16

17 18

19

23

22 21

20

Page 79: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Wait for rotation.

62

12 3

0 654

78

910 11

15 1413

12

16

17

18 19

23 22

21

20

Page 80: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Wait for rotation.

63

12

3

0654

78

9

10

11

1514

1312

16

17

18

19

23

22

21

20

Page 81: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Wait for rotation.

64

12

30

654

789

1011

1514

1312

1617

1819

2322

2120

Page 82: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Wait for rotation.

65

123 0

654 7

8910

11

151413

12

16

1718

19

23

2221

20

Page 83: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Transfer data.

66

123

065

4

7 89

10

11

15

141312

1617

18

19

23

22

2120

Page 84: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Transfer data.

67

123

0654

7 8

91011

151413

12

16

17

1819

2322

21

20

Page 85: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Transfer data.

68

123

0654

7 8

91011

151413

12

16

17

1819

2322

21

20

Page 86: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Yay!

69

123

065

4

78

910

11

1514

13

12

16

17

1819

23

22

21

20

Page 87: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

70

Page 88: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Must accelerate, coast, decelerate, settle

70

Page 89: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Must accelerate, coast, decelerate, settle

70

Page 90: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Must accelerate, coast, decelerate, settle

Seeks often take several milliseconds!

70

Page 91: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Must accelerate, coast, decelerate, settle

Seeks often take several milliseconds!

70

Page 92: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Must accelerate, coast, decelerate, settle

Seeks often take several milliseconds!

Settling alone can take 0.5 - 2 ms.

70

Page 93: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Must accelerate, coast, decelerate, settle

Seeks often take several milliseconds!

Settling alone can take 0.5 - 2 ms.

70

Page 94: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Must accelerate, coast, decelerate, settle

Seeks often take several milliseconds!

Settling alone can take 0.5 - 2 ms.

Entire seek often takes 4 - 10 ms.

70

Page 95: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

71

Page 96: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Depends on rotations per minute (RPM).

71

Page 97: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Depends on rotations per minute (RPM). - 7200 RPM is common, 15000 RPM is high end.

71

Page 98: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Depends on rotations per minute (RPM). - 7200 RPM is common, 15000 RPM is high end.

71

Page 99: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Depends on rotations per minute (RPM). - 7200 RPM is common, 15000 RPM is high end.

1 / 7200 RPM =

71

Page 100: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Depends on rotations per minute (RPM). - 7200 RPM is common, 15000 RPM is high end.

1 / 7200 RPM =1 minute / 7200 rotations =

71

Page 101: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Depends on rotations per minute (RPM). - 7200 RPM is common, 15000 RPM is high end.

1 / 7200 RPM =1 minute / 7200 rotations = 1 second / 120 rotations =

71

Page 102: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Depends on rotations per minute (RPM). - 7200 RPM is common, 15000 RPM is high end.

1 / 7200 RPM =1 minute / 7200 rotations = 1 second / 120 rotations =12 ms / rotation

71

Page 103: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Depends on rotations per minute (RPM). - 7200 RPM is common, 15000 RPM is high end.

1 / 7200 RPM = 1 minute / 7200 rotations = 1 second / 120 rotations = 12 ms / rotation

72

so it may take 6 ms on avg to rotate to target (0.5 * 12 ms)

Page 104: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

73

Page 105: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Pretty fast — depends on RPM and sector density.

73

Page 106: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Pretty fast — depends on RPM and sector density.

73

Page 107: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Pretty fast — depends on RPM and sector density.

100+ MB/s is typical.

73

Page 108: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Pretty fast — depends on RPM and sector density.

100+ MB/s is typical.

73

Page 109: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Pretty fast — depends on RPM and sector density.

100+ MB/s is typical.

1s / 100 MB = 10 ms / MB = 4.9 us / sector

73

Page 110: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Seek, Rotate, Transfer

Pretty fast — depends on RPM and sector density.

100+ MB/s is typical.

1s / 100 MB = 10 ms / MB = 4.9 us / sector(assuming 512-byte sector)

73

Page 111: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Workload

74

Page 112: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

WorkloadSo…

74

Page 113: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

WorkloadSo… - seeks are slow

74

Page 114: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

WorkloadSo… - seeks are slow - rotations are slow

74

Page 115: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

WorkloadSo… - seeks are slow - rotations are slow - transfers are fast

74

Page 116: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

WorkloadSo… - seeks are slow - rotations are slow - transfers are fast

74

Page 117: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

WorkloadSo… - seeks are slow - rotations are slow - transfers are fast

What kind of workload is fastest for disks?

74

Page 118: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

WorkloadSo… - seeks are slow - rotations are slow - transfers are fast

What kind of workload is fastest for disks?

74

Page 119: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

WorkloadSo… - seeks are slow - rotations are slow - transfers are fast

What kind of workload is fastest for disks? Sequential: access sectors in order (transfer dominated) Random: access sectors arbitrarily (seek+rotation dominated)

75

Demos: example-rand.csh and example-seq.csh

Page 120: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Disk Spec

76

Cheetah BarracudaCapacity 300 GB 1 TB

RPM 15,000 7,200Avg Seek 4 ms 9 ms

Max Transfer 125 MB/s 105 MB/sPlatters 4 4Cache 16 MB 32 MB

Page 121: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Disk Spec

77

Cheetah BarracudaCapacity 300 GB 1 TB

RPM 15,000 7,200Avg Seek 4 ms 9 ms

Max Transfer 125 MB/s 105 MB/sPlatters 4 4Cache 16 MB 32 MB

Sequential workload: what is throughput for each?

Page 122: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Disk Spec

78

Cheetah BarracudaCapacity 300 GB 1 TB

RPM 15,000 7,200Avg Seek 4 ms 9 ms

Max Transfer 125 MB/s 105 MB/sPlatters 4 4Cache 16 MB 32 MB

Cheeta: 125 MB/s. Barracuda: 105 MB/s.

Page 123: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Disk Spec

79

Cheetah BarracudaCapacity 300 GB 1 TB

RPM 15,000 7,200Avg Seek 4 ms 9 ms

Max Transfer 125 MB/s 105 MB/sPlatters 4 4Cache 16 MB 32 MB

Random workload: what is throughput for each? (what else do you need to know?)

Page 124: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Disk Spec

80

Cheetah BarracudaCapacity 300 GB 1 TB

RPM 15,000 7,200Avg Seek 4 ms 9 ms

Max Transfer 125 MB/s 105 MB/sPlatters 4 4Cache 16 MB 32 MB

Random workload: what is throughput for each? Assume 16-KB reads.

Page 125: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

Disk Spec

81

Cheetah BarracudaCapacity 300 GB 1 TB

RPM 15,000 7,200Avg Seek 4 ms 9 ms

Max Transfer 125 MB/s 105 MB/sPlatters 4 4Cache 16 MB 32 MB

Random workload: what is throughput for each? Assume 16-KB reads.

Page 126: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

82

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Cheetah?

Page 127: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

83

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Cheetah?

avg rotation = 12

1 min15000

Page 128: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

84

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Cheetah?

avg rotation = 12

1 min15000

60 sec1 min

1000 ms1 sec

= 2 ms

Page 129: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

85

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Cheetah?

transfer = 1 sec

125 MB16 KB

1,000,000 us1 sec

= 125 us

Page 130: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

86

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Cheetah?

Cheetah time = 4ms + 2ms + 125us = 6.1ms

Page 131: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

87

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Cheetah?

Cheetah time = 4ms + 2ms + 125us = 6.1ms

throughput = 16 KB6.1ms

Page 132: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

88

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Cheetah?

Cheetah time = 4ms + 2ms + 125us = 6.1ms

throughput = 16 KB6.1ms

1 MB1024 KB

100 ms1 sec

= 2.5 MB/s

Page 133: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

89

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Barracuda?

Page 134: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

90

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Barracuda?

avg rotation = 12

1 min7200

60 sec1 min

1000 ms1 sec

= 4.1 ms

Page 135: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

91

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Barracuda?

transfer = 1 sec

105 MB16 KB

1,000,000 us1 sec

= 149 us

Page 136: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

92

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Barracuda?

throughput = 16 KB13.2ms

Barracuda time = 9ms + 4.1ms + 149us = 13.2ms

1 MB1024 KB

1000 ms1 sec

Page 137: Operating Systems...Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O 27 while (STATUS == BUSY) // 1 wait

93

Cheetah BarracudaRPM 15,000 7,200

Avg Seek 4 ms 9 msMax Transfer 125 MB/s 105 MB/s

How long does an average 16-KB read take w/ Barracuda?

throughput = 16 KB13.2ms

Barracuda time = 9ms + 4.1ms + 149us = 13.2ms

1 MB1024 KB

1000 ms1 sec

= 1.2 MB/s