Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

10/11/2022

ĐẠI HỌC
CÔNG NGHỆ VIETNAM NATIONAL UNIVERSITY HANOI (VNU)
ĐẠI HỌC
CÔNG NGHỆ
VNU UNIVERSITY OF ENGINEERING AND TECHNOLOGY

Computer Architecture
Lecture 6: External memories

Xuan-Tu Tran
VNU University of Engineering and Technology &
VNU Information Technology Institute
Vietnam National University, Hanoi

Email: tutx@vnu.edu.vn www.uet.vnu.edu.vn/~tutx

ĐẠI HỌC
CÔNG NGHỆ
4. Bộ nhớ ngoài

▪ RAM for storage


– Flash
▪ Đĩa từ - Magnetic Disk
– HDD
– RAID
– Removable
▪ Đĩa quang - Optical
– CD-ROM
– CD-Recordable (CD-R)
– CD-R/W
– DVD
▪ Băng từ - Magnetic Tape

10/11/2022 Xuan-Tu Tran 2

1
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
Magnetic Disks

Rotation
Inter-track gap Track

Inter-sector gap
S6 •••

S6 •••
Track sector
Sector •••

SN
S6

S5

SN
S5

SN
S5
S4

S1
S4

S1
S3 S2

S4

S1
S3 S2

S3 S2

Read-write head
(1 per surface)

Platter

Direction of
Cylinder Spindle Boom
arm motion

Figure 6.2 Disk Data Layout


10/11/2022 Xuan-Tu Tran 3

ĐẠI HỌC
CÔNG NGHỆ
HDD sector layout

index

physical sector 0 physical sector 1 physical sector 29


sector

gap ID gap data gap gap ID gap data gap gap ID gap data gap
1 field 2 field 3 1 field 2 field 3 1 field 2 field 3
0 0 1 1 29 29
bytes 17 7 41 515 20 17 7 41 515 20 17 7 41 515 20

600 bytes/sector

synch track head sector synch


CRC data CRC
byte # # # byte

bytes 1 2 1 1 2 1 512 2

Figure 6.4 Winchester Disk Format (Seagate ST506)

10/11/2022 Xuan-Tu Tran 4

2
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
HDD characteristics

Head Motion Platters


Fixed head (one per track) Single platter
Movable head (one per surface) Multiple platter

Disk Portability Head Mechanism


Nonremovable disk Contact (floppy)
Removable disk Fixed gap
Aerodynamic gap (Winchester)
Sides
Single sided
Double sided

10/11/2022 Xuan-Tu Tran 5

ĐẠI HỌC
CÔNG NGHỆ
Typical HDD parameters
Characteristics Seagate Seagate Seagate Seagate Laptop
Enterprise Barracuda XT Cheetah NS HDD
Application Enterprise Desktop Network Laptop
attached storage,
application
servers
Capacity 6 TB 3 TB 600 GB 2 TB
Average seek 4.16 ms N/A 3.9 ms read 13 ms
time 4.2 ms write
Spindle speed 7200 rpm 7200 rpm 10, 075 rpm 5400 rpm
Average latency 4.16 ms 4.16 ms 2.98 5.6 ms
Maximum 216 MB/s 149 MB/s 97 MB/s 300 MB/s
sustained
transfer rate
Bytes per sector 512/4096 512 512 4096
Tracks per 8 10 8 4
cylinder (number
of platter
surfaces)
Cache 128 MB 64 MB 16 MB 8 MB
10/11/2022 Xuan-Tu Tran 6

3
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
Giản đồ thời gian truyền dữ liệu

Wait for Wait for Seek Rotational Data


Device Channel Delay Transfer

Device Busy

Figure 6.5 Timing of a Disk I/O Transfer

10/11/2022 Xuan-Tu Tran 7

ĐẠI HỌC
CÔNG NGHỆ
Magnetic Disks

▪ Ưu điểm: rẻ ($/MB), độ tin cậy chấp nhận được


– Primary storage, memory swapping

▪ Nhược: chỉ có thể đọc/ghi toàn bộ một sector


➔ không thể truy cập trực tiếp như bộ nhớ chính

▪ Thời gian truy cập đĩa


– Queuing delay
• Wait until disk gets to do this operation
– Seek time
• Head moves to correct track
– Rotational latency
• Correct sector must get under the head
– Data transfer time and controller time

10/11/2022 Xuan-Tu Tran 8

4
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
Khuynh hướng của đĩa từ

▪ Dung lượng: ~gấp đôi sau mỗi năm

▪ Thời gian truy cập trung bình


– 5-12ms (việc cải thiện tốc độ tương đối chậm)

▪ Latency quay trung bình (1/2 full rotation)


– 5,000 RPM to 10,000 RPM to 15,000 RPM
– Cải thiện chậm, phức tạp (reliability, noise)

▪ Tốc độ truyền dữ liệu


– Phục thuộc vào bề mặt đĩa, dữ liệu trên một track

10/11/2022 Xuan-Tu Tran 9

ĐẠI HỌC
CÔNG NGHỆ
Đĩa quang

▪ Giới hạn bởi các chuẩn


– CD and DVD capacity fixed over years

– Technology actually improves, but it takes time


for it to make it into new standards

▪ Kích thước bé, dễ thay thế


– Good for backups and carrying around

10/11/2022 Xuan-Tu Tran 10

5
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
Băng từ

▪ Thời gian truy cập rất chậm


– Must rewind tape to correct place for read/write

▪ Chi phí thấp ($/MB)


– It’s just miles of tape!

– But disks have caught up anyway…

▪ Được sử dụng để sao lưu dữ liệu (secondary storage)


– Large capacity & Replaceable

10/11/2022 Xuan-Tu Tran 11

ĐẠI HỌC
CÔNG NGHỆ
RAM for Storage

• Disks are about 100 times cheaper ($/MB)

• DRAM is about 100,000 faster (latency)

• Solid-State Disks
– Actually, a DRAM and a battery
• Much faster than disk, more reliable
• Expensive (not very good for archives and such)

• Flash memory
– Much faster than disks, but slower than DRAM
– Very low power consumption
– Can be sold in small sizes (few GB, but tiny)

10/11/2022 Xuan-Tu Tran 12

6
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ SSD Compared to HDD
SSDs have the following advantages over HDDs:

▪ High-performance input/output operations per second (IOPS)

▪ Durability

▪ Longer lifespan

▪ Lower power consumption

▪ Quieter and cooler running capabilities

▪ Lower access times and latency rates

10/11/2022 Xuan-Tu Tran 13

ĐẠI HỌC
CÔNG NGHỆ
Comparison of SSD and HDD

NAND Flash Drives Seagate Laptop Internal


HDD
File copy/write speed 200—550 Mbps 50—120 Mbps
Power draw/battery life Less power draw, averages 2– More power draw, averages
3 watts, resulting in 30+ 6–7 watts and therefore uses
minute battery boost more battery
Storage capacity Typically not larger than 512 Typically around 500 GB and
GB for notebook size drives; 1 2 TB maximum for notebook
TB max for desktops size drives; 4 TB max for
desktops
Cost Approx. $0.50 per GB for a 1- Approx $0.15 per GB for a 4-
TB drive TB drive

10/11/2022 Xuan-Tu Tran 14

7
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
Solid State Drive Architecture

Host System
Operating System
Software
File System Software
I/O Driver Software

Interface

Interface SSD

Controller

Addressing

Data buffer/ Error


cache correction

Flash
memory
components
Flash
memory
components
Flash
memory
components

Flash
memory
10/11/2022 components
Xuan-Tu Tran 15

Figure 6.8 Solid State Drive Architecture

ĐẠI HỌC
CÔNG NGHỆ
Practical Issues

There are two practical issues peculiar to SSDs


that are not faced by HDDs:
• SDD performance has a • Flash memory becomes unusable after
tendency to slow down as the a certain number of writes
device is used – Techniques for prolonging life:
– The entire block must be read from • Front-ending the flash with a cache
the flash memory and placed in a to delay and group write operations
RAM buffer • Using wear-leveling algorithms that
evenly distribute writes across block
– Before the block can be written
of cells
back to flash memory, the entire
• Bad-block management techniques
block of flash memory must be
erased – Most flash devices estimate their
– The entire block from the buffer is own remaining lifetimes so systems
now written back to the flash can anticipate failure and take
memory preemptive action

10/11/2022 Xuan-Tu Tran 16

8
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
Một số vấn đề lỗi

• Phân loại theo nguyên nhân


– Hardware Faults
• Hardware devices fail to perform as designed
– Design Faults
• Faults in software and some faults in HW
• E.g. the Pentium FDIV bug was a design fault
– Operation Faults
• Operator and user mistakes
– Environmental Faults
• Fire, power failure, sabotage, etc.

10/11/2022 Xuan-Tu Tran 17

ĐẠI HỌC
CÔNG NGHỆ
Khắc phục: cải thiện độ tin cậy

• Fault Avoidance
– Prevent occurrence of faults by construction

• Fault Tolerance
– Prevent faults from becoming failures
– Typically done through redundancy

• Error Removal
– Removing latent errors by verification

• Error Forecasting
– Estimate presence, creation, and consequences of errors

10/11/2022 Xuan-Tu Tran 18

9
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
Disk Fault Tolerance with RAID

• Redundant Array of Independent/Inexpensive Disks


– Several smaller disks play a role of one big disk

• Can improve performance


– Data spread among multiple disks
– Accesses to different disks go in parallel

• Can improve reliability


– Data can be kept with some redundancy

10/11/2022 Xuan-Tu Tran 19

ĐẠI HỌC
CÔNG NGHỆ
Raid Levels
Disks Large I/O Data Small I/O Request
Category Level Description Data Availability Transfer
Required Rate
Capacity
Lower than single Very high for both
Striping 0 Nonredundant N Very high
disk read and write
Higher than single Up to twice that of a
Higher than RAID
disk for read; single disk for read;
Mirroring 1 Mirrored 2N 2, 3, 4, or 5; lower
similar to single similar to single disk
than RAID 6
disk for write for write
Much higher than
Redundant via Hamming single disk; Highest of all Approximately twice
2 N+m
code comparable to listed alternatives that of a single disk
RAID 3, 4, or 5
Parallel access
Much higher than
single disk; Highest of all Approximately twice
3 Bit-interleaved parity N+1
comparable to listed alternatives that of a single disk
RAID 2, 4, or 5
Similar to RAID 0
Much higher than Similar to RAID 0 for
for read;
4 Block-interleaved parity N+1 single disk; read; significantly
significantly
comparable to lower than single disk
lower than single
RAID 2, 3, or 5 for write
disk for write
Much higher than Similar to RAID 0 Similar to RAID 0 for
Independent
Block-interleaved single disk; for read; lower read; generally lower
access 5 N+1
distributed parity comparable to than single disk than single disk for
RAID 2, 3, or 4 for write write
Similar to RAID 0 Similar to RAID 0 for
Block-interleaved dual Highest of all for read; lower read; significantly
6 N+2
distributed parity listed alternatives than RAID 5 for lower than RAID 5 for
write write
10/11/2022 Xuan-Tu Tran 20

10
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ
RAID 0, 1, 2

strip 0 strip 1 strip 2 strip 3


strip 4 strip 5 strip 6 strip 7
strip 8 strip 9 strip 10 strip 11
strip 12 strip 13 strip 14 strip 15

(a) RAID 0 (non-redundant)

strip 0 strip 1 strip 2 strip 3 strip 0 strip 1 strip 2 strip 3


strip 4 strip 5 strip 6 strip 7 strip 4 strip 5 strip 6 strip 7
strip 8 strip 9 strip 10 strip 11 strip 8 strip 9 strip 10 strip 11
strip 12 strip 13 strip 14 strip 15 strip 12 strip 13 strip 14 strip 15

(b) RAID 1 (mirrored)

b0 b1 b2 b3 f0(b) f1(b) f2(b)

(c) RAID 2 (redundancy through Hamming code)


10/11/2022 Xuan-Tu Tran 21
Figure 6.6 RAID Levels (page 1 of 2)

ĐẠI HỌC
CÔNG NGHỆ
RAID 3 & 4

b0 b1 b2 b3 P(b)

(d) RAID 3 (bit-interleaved parity)

block 0 block 1 block 2 block 3 P(0-3)


block 4 block 5 block 6 block 7 P(4-7)
block 8 block 9 block 10 block 11 P(8-11)
block 12 block 13 block 14 block 15 P(12-15)

(e) RAID 4 (block-level parity)

10/11/2022block 0 block 1 block 2Xuan-Tu Tran


block 3 P(0-3) 22

block 4 block 5 block 6 P(4-7) block 7


block 8 block 9 P(8-11) block 10 block 11
block 12 P(12-15) block 13 block 14 block 15
P(16-19) block 16 block 17 block 18 block 19

(f) RAID 5 (block-level distributed parity) 11


(d) RAID 3 (bit-interleaved parity) 10/11/2022

block 0 block 1 block 2 block 3 P(0-3)


block 4 block 5 block 6 block 7 P(4-7)
block 8 block 9 block 10 block 11 P(8-11)
block 12 block 13 block 14 block 15 P(12-15)

ĐẠI HỌC
CÔNG NGHỆ
RAID 5 & 6
(e) RAID 4 (block-level parity)

block 0 block 1 block 2 block 3 P(0-3)


block 4 block 5 block 6 P(4-7) block 7
block 8 block 9 P(8-11) block 10 block 11
block 12 P(12-15) block 13 block 14 block 15
P(16-19) block 16 block 17 block 18 block 19

(f) RAID 5 (block-level distributed parity)

block 0 block 1 block 2 block 3 P(0-3) Q(0-3)


block 4 block 5 block 6 P(4-7) Q(4-7) block 7
block 8 block 9 P(8-11) Q(8-11) block 10 block 11
block 12 P(12-15) Q(12-15) block 13 block 14 block 15

(g) RAID 6 (dual redundancy)

10/11/2022 Figure 6.6 RAID Levels (page 2 of 2)


Xuan-Tu Tran 23

ĐẠI HỌC
CÔNG NGHỆ
Data mapping for raid level 0
Logical Disk

strip 0 strip 0 strip 1 strip 2 strip 3


strip 1 strip 4 strip 5 strip 6 strip 7
strip 2 strip 8 strip 9 strip 10 strip 11
strip 3 strip 12 strip 13 strip 14 strip 15
strip 4
strip 5
Physical Physical Physical Physical
strip 6 Disk 0 Disk 1 Disk 2 Disk 3
strip 7
strip 8
strip 9
Array
Management
strip 10
Software
strip 11
strip 12
strip 13
strip 14
strip 15

10/11/2022 Xuan-Tu Tran 24


Figure 6.7 Data Mapping for a RAID Level 0 Array

12
10/11/2022

ĐẠI HỌC
CÔNG NGHỆ

10/11/2022 Xuan-Tu Tran 25

ĐẠI HỌC
CÔNG NGHỆ

10/11/2022 Xuan-Tu Tran 26

13
10/11/2022

Latency Numbers Every Programmer


Should Know
ĐẠI HỌC
CÔNG NGHỆ

http://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
10/11/2022 Xuan-Tu Tran 27

ĐẠI HỌC
CÔNG NGHỆ
Tổng kết

• Khái niệm về bộ nhớ trong máy tính, các đặc điểm chính, …

• Bộ nhớ chính
– Nguyên tắc
– Phân loại
– Tổ chức bộ nhớ lớn

• Bộ nhớ cache
– Nguyên tắc chung
– Các phương pháp ánh xạ
– Các giải thuật thay thế, chính sách ghi, …

• Bộ nhớ ngoài: ổ cứng, quang, RAID, …

10/11/2022 Xuan-Tu Tran 28

14

You might also like