7 disk 1
7 disk 1
CPU Memory
Memory Bus
(System Bus)
Bridge
I/O Bus
Disk
NIC
2
Storage-Device Hierarchy
3
Secondary Storage
4
Disks
5
Moving-head Disk Machanism
cylinder: track of the same size
6
Disk Scheduling
Disks are at least four orders of magnitude slower than the main
memory
The performance of disk I/O is vital for the performance of the computer
system as a whole
Access time (seek time+ rotational delay) >> transfer time for a sector
Therefore the order in which sectors are read matters a lot
Disk scheduling
Usually based on the position of the requested sector rather than
according to the process priority
Possibly reorder stream of read/write request to improve performance
7
Disk Scheduling (Cont.)
Head pointer 53
8
FCFS
9
SSTF
10
SSTF (Cont.)
11
SCAN
The disk arm starts at one end of the disk, and moves
toward the other end, servicing requests until it gets to
the other end of the disk, where the head movement is
reversed and servicing continues.
Sometimes called the elevator algorithm.
Illustration shows total head movement of 208
cylinders.
12
SCAN (Cont.)
13
C-SCAN
14
C-SCAN (Cont.)
15
C-LOOK
Version of C-SCAN
Arm only goes as far as the last request in each
direction, then reverses direction immediately, without
first going all the way to the end of the disk.
16
C-LOOK (Cont.)
17
Selecting a Disk-Scheduling Algorithm
18
Disk Management
19
Swap-Space Management
20
Disk Reliability
21
RAID
22
RAID Level 0
stripe 0
strip 0 strip 1 strip 2 strip 3
strip 4 strip 5 strip 6 strip 7
...
23
RAID Level 1
24
RAID Levels 2 and 3
25
Parity Codes
0 0
26
RAID Levels 4 and 5
RAID 4
Large strips with a parity strip like RAID 3
Independent access - each disk operates independently, so multiple I/O request
can be satisfied in parallel
Independent access small write = 2 reads + 2 writes
Example: if write performed only on strip 0:
P’(i) = X2(i) X1(i) X0’1(i)
= X2(i) X1(i) X0’(i) X0(i) X0(i)
= P(i) X0’(i) X0(i)
Parity disk can become bottleneck
strip 0 strip 1 strip 2 P(0-2)
strip 3 strip 4 strip 5 P(3-5)
RAID 5
Like RAID 4 but parity strips are distributed across all disks
27
Calculating a Hamming Code
• Procedure:
–Place message bits in their non-power-of-two Hamming
positions
–Build a table listing the binary representation each each of
the message bit positions
–Calculate the check bits
28
Hamming Code Example
Message to be sent: 1 0 1 1
1 0 1 1
Position 1 2 3 4 5 6 7
29
Hamming Code Example
Message to be sent: 1 0 1 1
1 0 1 1
Position 1 2 3 4 5 6 7
30
Hamming Code Example
Message to be sent: 1 0 1 1
1 1 0 1 1
Starting with the 20 position:
Position 1 2 3 4 5 6 7
Look at positions with 1’s
2n: check bits 20 21 22
in them
Otherwise, place a 0
31
Hamming Code Example
Message to be sent: 1 0 1 1
1 0 1 0 1 1
Repeat with the 21 position:
Position 1 2 3 4 5 6 7
Look at positions those
2n: check bits 20 21 22
positions with 1’s in them
Otherwise, place a 0
32
Hamming Code Example
Message to be sent: 1 0 1 1
1 0 1 1 0 1 1
Repeat with the 22 position:
Position 1 2 3 4 5 6 7
Look at positions those
2n: check bits 20 21 22
positions with 1’s in them
Otherwise, place a 0
33
Hamming Code Example
34
Using Hamming Codes to Correct Single-Bit
Errors
Received message: 1 0 1 1 0 0 1
1 0 1 1 0 0 1
Position 1 2 3 4 5 6 7
35
Using Hamming Codes to Correct Single-Bit
Errors
Received message: 1 0 1 1 0 0 1
1 0 1 1 0 0 1
Starting with the 20 position:
Position 1 2 3 4 5 6 7
Look at positions with 1’s
2n: check bits 20 21 22
in them
36
Using Hamming Codes to Correct Single-Bit
Errors
Received message: 1 0 1 1 0 0 1
1 0 1 1 0 0 1
Repeat with the 21 position:
Position 1 2 3 4 5 6 7
Look at positions with 1’s
2n: check bits 20 21 22
in them
37
Using Hamming Codes to Correct Single-Bit
Errors
Received message: 1 0 1 1 0 0 1
1 0 1 1 0 0 1
Repeat with the 22 position:
Position 1 2 3 4 5 6 7
Look at positions with 1’s
2n: check bits 20 21 22
in them
38
Finding the error’s location
1 0 1 1 0 0 1
Position 1 2 3 4 5 6 7
39
Finding the error’s location
1 0 1 1 0 0 1
Position 1 2 3 4 5 6 7
No error in bits 1, 3, 5, 7
40
Finding the error’s location
1 0 1 1 0 0 1
Position 1 2 3 4 5 6 7
41
Finding the error’s location
An Easier Alternative to the Last Slides
3 = 21 + 20 = 0 1 1
5 = 22 + 20 = 1 0 1
6 = 22 + 21 = 1 1 0
7 = 22 + 21 + 20 = 1 1 1
E E NE
1 1 0 =6
E = error in column
NE = no error in column
42
Hamming Codes
43