Chapter5 ExternalMemory
Chapter5 ExternalMemory
Luis Tarrataca
[email protected]
CEFET-RJ
1 Motivation
2 Magnetic Disks
Write Mechanism
Read Mechanism
RAID 0
RAID 1
RAID 2
RAID 3
RAID 4
RAID 5
RAID 6
Practical Issues
L. Tarrataca Chapter 6 - External Memory 3 / 66
Motivation
Motivation
• Magnetic disks;
• Optical Memory;
• Magnetic tapes.
Magnetic Disks
Data are recorded on and later retrieved from the disk via a head:
Write Mechanism
Write Mechanism:
Read Mechanism
Read Mechanism:
Based on the read / write head mechanism how are disks organized?
Any ideas?
Based on the read / write head mechanism how are disks organized?
Any ideas?
How can the head find these elements within the disk?
How can the head find these elements within the disk?
How can the head find these elements within the disk?
• Reason why:
• Space seen as available by OS 6= to physical disk space
Example (1/3)
Example (2/3)
• Each sector holds 515 bytes of data plus other control information;
Example (3/3)
Lets look at a specific example:
• SYNCH byte is a special bit pattern that delimits the beginning of the field;
• Track number
So, what do you think are some variables that influence the performance
of a disk?
• Seek time - the time it takes to position the head at the track;
b
T =
rN
RAID 0
Figure: Data Mapping for a RAID Level 0 Array (Nonredundant). (Source: [Stallings, 2015])
Figure: Data Mapping for a RAID Level 0 Array (Nonredundant). (Source: [Stallings, 2015])
RAID 0 advantage:
• Recall that total read / write time is a function of seek and rotational delay:
• By distributing across multiple disks we are diminishing these times;
• Instead of having multiple seek and rotational delays for a single hard disk.
RAID 1
Very simple:
Figure: Data Mapping for a RAID Level 1 Array (Mirrored). (Source: [Stallings, 2015])
• Disadvantage:
• Principal disadvantage of RAID 1 is the cost:
• Requires twice the disk space of the logical disk that it supports.
• Advantage:
• Achieves high I/O request rates if the bulk of the requests are reads.
• Performance of RAID 1 can approach double of that of RAID 0.
RAID 2
Figure: Data Mapping for a RAID Level 2 Array (Hamming code). (Source: [Stallings, 2015])
Figure: Data Mapping for a RAID Level 2 Array (Hamming code). (Source: [Stallings, 2015])
• Code bits are stored in the corresponding bit positions on multiple parity
disks;
RAID 3
• Difference:
• requires only a single redundant disk, no matter how large the disk array.
Figure: Data Mapping for a RAID Level 3 Array (Bit-interleaved parity). (Source: [Stallings, 2015])
• Parity bit is computed for the set of individual bits in the same position on
all of the data disks.
X4 (i ) = X0 (i ) ⊕ X1 (i ) ⊕ X2 (i ) ⊕ X3 (i )
X1 (i ) = X0 (i ) ⊕ X2 (i ) ⊕ X3 (i ) ⊕ X4 (i )
RAID 4
• More suitable for applications that have high I/O request rates;
Figure: Data Mapping for a RAID Level 4 Array (Block-level parity). (Source: [Stallings, 2015])
• Parity bits are stored in the corresponding strip on the parity disk:
X4 (i ) = X0 (i ) ⊕ X1 (i ) ⊕ X2 (i ) ⊕ X3 (i )
RAID 5
• Similar to RAID 4
• Difference: RAID 5 distributes the parity strips across all disks.
Figure: Data Mapping for a RAID Level 5 Array. (Source: [Stallings, 2015])
RAID 6
• Two different parity calculations are carried out and stored in separate
blocks on different disks.
• Idea: Regenerate data even if two disks containing user data fail.
Figure: Data Mapping for a RAID Level 6 Array (Dual redundancy). (Source: [Stallings, 2015])
• In recent years the cost and performance of flash memory has evolved.
• SSD + HD;
• Hybrid HD ( SSD + HD ).
What do you think are the advantages of using an SSD instead of a HDD?
• Durability. Why?
• Durability. Why?
• Less susceptible to physical shock and vibration;
• capacity is low;
Figure: Comparison of Solid State Drives and Disk Drives. (Source: [Stallings, 2015])
4 Entire block from the buffer is now written back to the flash memory.
• Depends on the quality of the flash memory (good estimate 105 writes)
• There are also a variety of techniques to handle the life of flash memory:
• A cache to delay and group write operations;
• Wear-leveling algorithms: evenly distribute writes across block of cells;
• Bad-block management techniques: when eventually blocks do kaputz!
• Compare and contrast hard disk drives and solid disk drives.
Your focus should always be on the building blocks for developing a solution
=)
References I
Stallings, W. (2015).
Pearson Education.