I/O Management and Disk Scheduling - PowerPoint PPT Presentation

1 / 63
About This Presentation
Title:

I/O Management and Disk Scheduling

Description:

Lecture #10 I/O Management and Disk Scheduling – PowerPoint PPT presentation

Number of Views:136
Avg rating:3.0/5.0
Slides: 64
Provided by: Patty162
Category:

less

Transcript and Presenter's Notes

Title: I/O Management and Disk Scheduling


1
Lecture 10
  • I/O Management and Disk Scheduling

2
I/O ?? ?? (1)
  • Human readable
  • ??? ???? ???? ?? ???? ??
  • ???
  • ??? ????? ???
  • ????? ??
  • ???
  • ???

3
I/O ?? ?? (2)
  • Machine readable
  • ?? ?? ??? ???? ?? ???? ??? ??
  • ??? ? ??? ????
  • I/O Controllers
  • Sensors
  • Actuators

4
I/O ?? ?? (3)
  • Communication
  • ?? ??? ???? ?? ???? ??
  • Digital line drivers
  • Modems

5
I/O ??? ??? (1)
  • Data rate
  • ??? ?? ?? I/O ???? ???? ?? ?? ??
  • I/O ???? ??? ?? ??? ? ??? ?? ? ??? ? ? ??

6
(No Transcript)
7
I/O ??? ??? (2)
  • Application(??)
  • ??? ???? ???? ????? ???? ?? ?? ?????? ??
  • ?? ??? ???? ???? ????? ???? ??? ????? ?????? ??
  • ??? ???? ???? ???(??)? ?? ????? ? ?? ?? ??? ???

8
I/O ??? ??? (3)
  • Complexity of control
  • Unit of transfer
  • Data may be transferred as a stream of bytes for
    a terminal or in larger blocks for a disk
  • Data representation
  • Encoding schemes
  • Error conditions
  • Devices respond to errors differently

9
I/O ?? ?? (1)
  • Programmed I/O
  • Process is busy-waiting for the operation to
    complete
  • Interrupt-driven I/O
  • I/O command is issued
  • Processor continues executing instructions
  • I/O module sends an interrupt when done
  • Direct Memory Access (DMA)
  • DMA module controls exchange of data between main
    memory and the I/O device
  • Processor interrupted only after entire block has
    been transferred

10
I/O ?? ?? (2)
  • I/O ??? ??

???? ?? ???? ??
????? ?? I/O? ???? ?? Programmed-I/O Interrupt-driven I/O
I/O? ???? ?? ?? DMA
11
I/O ??? ?? ?? (1)
  • Processor directly controls a peripheral device
  • Controller or I/O module is added
  • Processor uses programmed I/O without interrupts
  • Processor does not need to handle details of
    external devices
  • Controller or I/O module with interrupts
  • Processor does not spend time waiting for an I/O
    operation to be performed
  • Direct Memory Access
  • Blocks of data are moved into memory without
    involving the processor
  • Processor involved at beginning and end only

12
I/O ??? ?? ?? (2)
  • I/O module is a separate processor
  • I/O Channel
  • I/O processor
  • I/O module has its own local memory
  • Its a computer in its own right

13
DMA(Direct Memory Access) (1)
  • DMA(Direct Memory Access)
  • ?????? I/O ?? ??? ?? ???? ??
  • DMA ??? I/O? ???? ?? ??? ??? ????
  • ??? ??? ?? ???? ???? ???? ?? CPU??? ??? ??? ????
  • Cycle Stealing(??? ???)
  • ????? ??? ???? ?? ?? ??? ??
  • ????? ????? ??? ?? ????? ?? ??? ?? ???? ???
  • No interrupts occur
  • ???? ??? ?? ????? ??

14
DMA(Direct Memory Access) (2)
15
DMA(Direct Memory Access) (3)
  • Cycle stealing? CPU? ?? ??? ?????

16
DMA(Direct Memory Access) (4)
  • DMA ?? ??
  • DMA ??? I/O ??? ??? ??? ???? ??
  • ??-DMA ??(a)
  • ??? ?? ??? ???? ? ??? ??? ???? ?? ? ?? ??? ?? ???
    ??
  • DMA? I/O ??? ???? ??
  • ??-DMA ??(b)
  • DMA ??? I/O ????? ??? ??? ?? ? ???? ?? ??? ?? ??
    ??
  • DMA ??? I/O ????? ?? ??
  • ??? I/O ??? ???? DMA ??? ???? ??
  • ??-DMA ??(c)
  • DMA ??? I/O ????? ??? ??? ??? ??? ???? ??

17
DMA(Direct Memory Access) (5)
18
DMA(Direct Memory Access) (6)
19
DMA(Direct Memory Access) (7)
20
I/O ?? ?? ?? (1)
  • ???(Efficiency)
  • ???? I/O ??? ????? ? CPU? ???? ??? ?? ???
  • ?? ??? ?? ????? ??????? ??? ??
  • ?? ?????? I/O ??? ???? ??? ?? ????? ????? ??
  • ??? I/O ??? ??? CPU ??? ???? ?? ????? ?? ???
    ????? ???? ???(swapping)? ???? ??? ??
  • Swapping? I/O? ??
  • ??? ?? ??? ???? ???? I/O? ??

21
I/O ?? ?? ?? (2)
  • ???(Generality)
  • ???? ??? ?? ??? ?? ??? ???? ?? I/O ??? ??? ??
    ?????
  • ??? ??? ???? ?? ??? ???? ???? ???? ????? ???
  • ??? ?? ???
  • ????? ?? ????? ???? ???? ??? ??
  • ????? ?? ????? I/O ??? ??? ???? ??? ?????? ?? ???
    I/O ??? ??? ??? ?? ? ??? ??

22
I/O ?? ?? ?? (3)
  • I/O ??? ??? ??
  • ??? ?? ??? ??? I/O ??? ??
  • ?? ??? I/O ??? ?? ???? ??? ??
  • ?? ??? ???? I/O ?? ?? ??? ?? ?? ??? ???? ??
  • ??? ?????? ?????? ?? ??? ??? ?? ?? ??? ??? ???
    ??? ??
  • I/O ??? ??? ?? ?

23
(No Transcript)
24
I/O Buffering (1)
  • I/O ???? ???
  • ????? ????? ?? I/O? ??? ??? ?? ??? ??
  • ??? ???? ?? ???? ????? I/O ?? ??? ??? ? ??
  • I/O? ???? ?? ????? ???? ?? ????? ???? ? ??
  • ?? ???? ????? ??

25
I/O Buffering (2)
  • I/O ???? ??? ??? ?? ??? ??
  • ?? ??(Block-oriented) I/O ??
  • ?? ??? ??? ?? ??? ??? ??
  • ??? ??? ??? ??
  • ??? ??, ??? ?? ?
  • ??? ??(Stream-oriented) I/O ??
  • ??? ??? ??? ???? ??
  • ???, ???, ?? ??, ??? ?

26
I/O Buffering (3)
27
I/O Buffering (4)
28
Single Buffer (1)
  • ????? I/O ??? ?? ?????? ??? ??? ??? ??? ????
  • ?? ?? ??
  • ?? ??? ??? ??? ?????
  • ????? ??? ?? ???? ??? ???? ????? ????? ?? ??? ??
  • Read ahead or Anticipated input
  • ????? ?? ??? ???? ?? ??? ??? ??
  • ??? ?????? ??? ???? ????? ??? ???? ??? ????? ????
    ? ??
  • ????? ????? ??? ??? ???? ?? ??? ?????? ?? ??? ????

29
Single Buffer (2)
  • ??? ?? ??
  • ??? ??? ???? ? ???? ??
  • ???? ?? ??? ??? ??? ????? ? ??? ??
  • ??? ??? ?? ??? ??
  • ????? ? ??? ???? ??? ??? ?? ??

30
Double Buffer
  • ? ?? ??? ??? ??
  • ????? ??? ??? ???? ??? ??? ????? ?? ??? ???? ????
    ??
  • ?? ????? ?? ??

31
Circular Buffer
  • ??? ??? ???? ? ? ??? ??? ???? ??
  • I/O ??? ?? ?? ????? ???? ?? ?? ???? ??
  • ?? ??? ? ??? ??? ?? ??? ??
  • I/O ??? ????? ??? ??? ??? ??

32
??? ??
  • ??? ??
  • ???? ?? ?? ??
  • ??? ????? ??? I/O ???? ??? ?? ??? ?? ? ??
  • CPU ?? ?????? ???? ??? ??? ?? ??
  • ?? ??? ?? ??? ?? ??? ?? ??? ???

33
Disk Data Layout
Sectors
Tracks
Inter-sector gap
Inter-track gap
34
Disk Layout Using Constant Angular Velocity
Track 0, Sector 0
Track 2, Sector 7
35
??? ?? ?? (1)
  • ??? ??? ??
  • ??? ???? ???? ??? ??? ??? ???? ???? ??? ??? ??
    ??? ????
  • ?? ??? ?? ??? ??? ?? ???? ?? ????

36
??? ?? ?? (2)
  • ?? ??(Seek time)
  • ??? ??? ??? ????? ??? ??
  • ??? ?????? ????? ???? ??
  • ?? ?? ??(Rotational delay or rotational latency)
  • ??? ??? ??? ???? ??? ????? ??? ??
  • ??? ?? ??(Access time)
  • ?? ??? ?? ?? ??? ?
  • ??? ???? ?? ??? ??? ????? ??? ??

37
Timing of a Disk I/O Transfer
38
??? ???? ?? (1)
  • ?? ??(Seek time)? ??? ??? ?? ??? ??
  • ??? ???? ?? ??? ??? ??? ??
  • ??? ??? ?? ??? ??? ?? ?? ??? ????? ??? ??? ??? ??
  • ??? ??? ????? ???? ????? (random scheduling) ???
    ??? ??? ?? ??? ?? ??
  • ??? ??? ???? ?? ??? ????? ??

39
??? ???? ?? (2)
  • ????(First-in, first-out FIFO)
  • ????? ??? ??? ??? ???? ??
  • ?? ????? ?? ????
  • ??? ??? ??? ?? ???? ?? ?? ???? ??? ?????

40
??? ???? ?? (3)
  • ?? ??(Priority)
  • ???? ??? ??? ??? ????? ?? ??? ????? ?? ??? ????
    ??
  • ?? ??? ?? ???? ???? ??? ??? ?? ?? ??? ??
  • ? ?? ?? ??? ??

41
??? ???? ?? (4)
  • ?? ??(Last-in, first-out LIFO)
  • ?? ??? ??? ??? ?? ??
  • ???? ?? ????? ?? ??? ??
  • ????? ???? ?????? ??? ?? ??? ??? ??
  • ???? ????? ?? ??? ?? ??
  • ? ??? ??? ??? ?? ??? ?? ?? ??? ??? ??? ?? ??? ???
    ???? ??

42
??? ???? ?? (5)
  • Shortest Service Time First(SSTF)
  • ??? ??? ?? ????? ??? ?? ???? ????? ??? ??? ??? ??
    ??
  • ?? ??? ?? ??? ???? ??? ??? ??

43
??? ???? ?? (6)
  • SCAN
  • ????, LIFO, SSTF ?? ???? ????? ??? ???? ??
  • ?? ???? ??? ??? ??? ???? ?? ?????? ?? ???? ?? ???
    ??? ? ??
  • ??? ??? ?? ? ???? ????? ?? ??? ???? ??? ??? ???
    ????? ???? ??? ??? ?? ??? ? ??? ???? ?? ??? ????
    ???? ??
  • ? ???? ???? ??? ?? ???? ????? ?????
  • ?? ???? ??? ??? ???? ??? ?? ?? ??? ??? ??

44
??? ???? ?? (7)
  • C-SCAN
  • SCAN ???? ??? ??? ?? ?? ????? ????? ?????? ??
  • ? ???? ????? ??? ??? ??? ??? ???? ?? ??? ???? ??
    ?? ???? ????
  • SCAN ??? ?? ? ??? ???? ??? ?? ???? ???? ??? ????
    ??

45
??? ???? ?? (8)
  • SSTF, SCAN, C-SCAN ????? ? ??(Arm stickness)
    ??? ??? ? ??
  • ??? ???? ? ??? ?? ?? ???? ????? ??? ?? ?? ?? ????
    ?? ? ??
  • N-step-SCAN
  • Segments the disk request queue into subqueues of
    length N
  • Subqueues are process one at a time, using SCAN
  • New requests added to other queue when queue is
    processed
  • FSCAN
  • Two queues
  • One queue is empty for new request

46
??? ???? ???? ??(1)
47
??? ???? ???? ??(2)
  • ??? ???? ????? ?? ??
  • ?? ?? ?? ??
  • ???? 200 ?? ???? ??
  • ??? ?? ?? ??? ???? ??
  • ?? ??? 55, 58, 39, 18, 90, 160, 150, 38, 184 ???
    ??
  • ?? ???? ????
  • FIFO
  • SSTF
  • SCAN
  • C-SCAN

48
??? ???? ???? ??(3)
  • ??? ?? ?? ?? ??

49
??? ???? ???? ??(4)
50
RAID 0 (non-redundant)
51
(No Transcript)
52
RAID 1 (mirrored)
53
RAID 2 (redundancy through Hamming code)
54
RAID 3 (bit-interleaved parity)
55
RAID 4 (block-level parity)
56
RAID 5 (block-level distributed parity)
57
RAID 6 (dual redundancy)
58
Disk Cache
  • Buffer in main memory for disk sectors
  • Contains a copy of some of the sectors on the
    disk

59
Least Recently Used
  • The block that has been in the cache the longest
    with no reference to it is replaced
  • The cache consists of a stack of blocks
  • Most recently referenced block is on the top of
    the stack
  • When a block is referenced or brought into the
    cache, it is placed on the top of the stack

60
Least Recently Used
  • The block on the bottom of the stack is removed
    when a new block is brought in
  • Blocks dont actually move around in main memory
  • A stack of pointers is used

61
Least Frequently Used
  • The block that has experienced the fewest
    references is replaced
  • A counter is associated with each block
  • Counter is incremented each time block accessed
  • Block with smallest count is selected for
    replacement
  • Some blocks may be referenced many times in a
    short period of time and then not needed any more

62
UNIX SVR4 I/O
63
Windows 2000 I/O
Write a Comment
User Comments (0)
About PowerShow.com