Topicseecs.vanderbilt.edu/courses/cs231/fall2003/lecture/...1 1 Topics • Hamming algorithm •...
Transcript of Topicseecs.vanderbilt.edu/courses/cs231/fall2003/lecture/...1 1 Topics • Hamming algorithm •...
1
1
Topics
• Hamming algorithm
• Magnetic disks
• RAID
2
Hamming Algorithm
• In a Hamming code– r parity bits added to m-bit word– Forms codeword with length (m + r) bits
• Bit numbering– Starts at 1 with leftmost (high-order) bit– All powers of 2 are parity bits– Remaining bits are for data
2
3
Bit Numbering for Hamming Algorithm
__ __ __ __ __ __ __ __ __ __ __ __1 2 3 4 5 6 7 8 9 10 11 120 0 0 00 0 0 0 0 0 0 0
Parity bits (powers of 2)
Data bits (remaining bits)
Given an 8-bit data word to encode
4
Parity Bit Assignment
8, 40011128, 2, 11101118, 20101108, 110019
9, 10, 11, 12000184, 2, 1111074, 2011064, 110105
5, 6, 7, 12001042, 111003
3, 6, 7, 10, 11010023, 5, 7, 9, 1110001
1’s2’s4’s8’s
EncodesEncoded by
Bit No. in BinaryBit No.
3
5
Method for Parity Check• For parity bit 1
– b1 ⊕ b3 ⊕ b5 ⊕ b7 ⊕ b9 ⊕ b11
• For parity bit 2– b2 ⊕ b3 ⊕ b6 ⊕ b7 ⊕ b10 ⊕ b11
• For parity bit 4– b4 ⊕ b5 ⊕ b6 ⊕ b7 ⊕ b12
• For parity bit 8– b8 ⊕ b9 ⊕ b10 ⊕ b11 ⊕ b12
Even parity →→→→ 0Odd parity →→→→ 1
6
Boolean Exclusive Sum - XOR Function
• Logic operation
• Output is “true” when either input is “true” but not both
• Corresponds to addition in base 2
011101110000FBA
F = A ⊕⊕⊕⊕ B
A
BF
Truth table for XOR function
4
7
Class Exercise
• Compute the codeword for the 8-bit data:
1001 0110
__ __ __ __ __ __ __ __ __ __ __ __1 2 3 4 5 6 7 8 9 10 11 12
1 0 0 1 0 1 1 01 0 1 0
8
–Bit 1 checks: 1, 3, 5, 7, 9, 11 incorrect
–Bit 2 checks: 2, 3, 6, 7, 10, 11 incorrect
–Bit 4 checks: 4, 5, 6, 7, 12 correct
–Bit 8 checks: 8, 9, 10, 11, 12 incorrect
Class Exercise
• Find the bit that is incorrect in the following codeword. This 12 bit codeword encodes 8 data bits.
1100 1110 0001
Bit 11
5
9
For Further Study
• Article on parity and non-parity main memory– http://www.pcguide.com/ref/ram/err.htm
10
Memory Hierarchy
Down the hierarchy:• Increased access time
• Increased storagecapacity
• Increased number ofbits per dollar
6
11
Storing Data on a Magnetic Disk
• Tracks are concentric circles on a platter• Sectors are pie-shaped wedges on a track• Cylinders are a set of tracks at a given radial distance
12
Data Transfer Time
Seek – move to correct radial position (cylinder)
Rotational latency – desired sector located under read/write head
7
13
Formatting a Track
14
Photo of Disk Head, Arm, Actuator
Adapted from David Patterson’s CS 252 lecture notes. Copyright 2001 UCB.
Actuator
Arm Head
Platters (12)
Spindle
8
15
(Not So) Floppy Disk• Small removable medium to distribute S/W• General characteristics the same as hard disk
– Except the floppy disk read/write heads touch the disk, causing extra wear and tear
16
• Standard way to connect storage device to computer– Hard drives, internal floppy drives, CD-ROM drives, and
even some tape backup drives• Extended IDE for Logical Block Addressing (LBA)
– Required to address larger drives– (224 – 1) sector numbers are converted to head, sector,
and cylinder addresses
http://computer.howstuffworks.com/ide.htm
Integrated Drive Electronics (IDE)
9
17
Small Computer System Interface (SCSI)Benefits of SCSI:• Speed – up to 160 megabytes per second (MB/s)• Reliability• Can put multiple devices on one bus • Compatible with most computer systems
Potential problems when using SCSI:• Requires configuration for a specific computer. • Limited system BIOS support. • Numerous variations (speeds, connectors)• No common software interface
18
Small Computer System Interface (SCSI)
• http://computer.howstuffworks.com/scsi.htm
10
19
IDE/EIDE vs. SCSI
IDE/EIDE• Low-cost
• Intel-based systems
• Allow only one active device at a time
• Lower data transfer rate
SCSI• High-cost
• Standard in UNIX workstations
• All devices run at once
• Higher data transfer rate
20
Redundant Arrays of (Inexpensive) Disks
• Files are "striped" across multiple disks
• Redundancy yields high data availability– Availability: service still provided to user, even if
some components failed
• Disks will still fail
• Contents reconstructed from data redundantly stored in the array⇒ Capacity penalty to store redundant info⇒ Bandwidth penalty to update redundant info
Adapted from David Patterson’s CS 252 lecture notes. Copyright 2001 UCB.
11
21
RAID Levels 0 Through 5
Backup and parity drives are shaded
22
RAID Level 1 – Disk Mirroring
• Each disk is fully duplicated onto its “mirror”• Most expensive solution
– 100% capacity overhead
12
23
Exercise• RAID level 3 is able to correct single-bit errors
using only one parity drive. What is the point of RAID level 2? After all, it also can only correct one error and takes more drives to do so.
24
Exercise AnswerRAID level 2 can not only recover from crashed drives, but also from undetected transient errors. If one drive delivers a single bad bit, RAID level 2 will correct this with its Hamming code, but RAID level 3 will not.