Secondary Memory Memory Hierarchy

advertisement

Secondary Memory

Memory Hierarchy :

In modern computers, there are several types of memory:

Cache: RAM technology Capacity 256K- 1 M, 10 nanoseconds

Main memory: RAM - ROM technology 100 M- 1G,

100 nanoseconds

Secondary storage (Disk): 10 G-1000 G, 10-30 milliseconds

Tertiary Storage (Tape, CD):1G -100 T, a few seconds- a few minutes

The memory system in a computer is organized as a hierarchy containing faster, more expensive members and slower, less expensive members.

CPU cache memory

Main

Memor y

Disk

Memory

Tape

Memory

Components towards the left side, which are nearer of the CPU, need faster access times and thus are more expensive. Components on the right side provide slower access times, but cost less. Information must flow back and forth in the hierarchy.

Magnetic Disks:

Bits of data (0’s and 1’s) are stored on circular magnetic platters called disks

A disk rotates rapidly

A disk head reads and writes bits of data as they pass under the head

Often several platters are organized into a disk pack

Disks are non-volatile, stable

They have tremendous capacity (about 100 times more than RAM)

They are much cheaper than RAM (40 times cheaper per Meg)

Disk Organization:

Disks are direct access storage devices as opposed to serial devices (tapes)

Disks are composed of a disk assembly and a head assembly

A disk assembly is a collection of one or more platters with a common spindle (axle)

Information is stored in the surface of the platters.

A head assembly consists of several disk arms ending in disk heads.

The arm can move outwards or inwards towards the spindle

read/write head

(1 per surface)

Surface1

Surface 2

Surface 3

Surface 4

Surface 5

Surface 6 moving arm

(starts and stops) spindle (rotating shaft never stops)

3 platters, 6 surfaces, 6 read/write heads

Organization of data on the surface of the platter:

Track

Sector (wedge)

Block (sequence of bits)

Each platter surface is divided into tracks (concentric circles).

Tracks above and below one another form a cylinder

Each track is divided into sectors; a sector is the smallest addressable unit.

Each block of data is addressed by its track, sector, and surface: track 126, sector 4, surface 3.

Given the address of a block, the disk head moves to the given track, and waits for the block to rotate into position.

This process takes a long time, but once in position, the block rotates under past the head very quickly.

Consequently, it takes a long time to read the first bit in a block, but very little time to read the remaining bits in the block.

For this reason, a disk reads/writes an entire block of data at a time, not just a single bit or byte.

Typically, only one head can read/write at a given time.

All heads move together, they are all at the same radius.

Cylinders:

A cylinder is the set of tracks at a given radius of a disk pack. A cylinder is the set of tracks that can be accessed without moving the disk arm. Moving the disk arm is relatively slow. Once the heads are positioned at a cylinder, data in that cylinder can be accessed more quickly than data in other cylinders.

We try to store related data (e.g. a file) on the same cylinder.

Access Time:

Given the address of a block, it takes time to access

(read or write) it.

Access time has two main components: a.

Seek time: the time needed to move the read/write heads to the correct track. It is the most expensive time, since it is mechanical o It takes 5 ms (milliseconds) to move from one track to the next (track-to-track) o 50 ms maximum (from inside track to outside track) o 10 to 30 ms average (from one random track to another random track) o Average seek time: about 1/3 of the total number of cylinders b.

Latency (rotational delay): It is the time needed for the desired bit to rotate into position under the disk head, typically the value of latency is 8 ms

Note:

Min latency =0

Max latency = Time for disk revolution

Average latency= Min +Max/2 OR Max/2 OR time for ½ disk revolution

Most disks today rotate at least at 5000-9000 rpm, which is about 6-11 milliseconds per revolution.

c.

Transfer time is calculated as follows:

(number of bytes transferred/number of bytes on track )*rotation time.

Transfer time for a 4K block is about half a millisecond.

Example: Given the following disk characteristics:

- 25 sectors/ surface

800 tracks / surface

512 bytes / block

3600 rpm (revolutions per minute)

7 ms track-to-track seek time.

28 ms avg seek time

50 ms max seek time

Latency:

3600 rpm

Î

3600 rev/min

Î 3600/60 =60 rev/sec

Î

1/60 sec/rev

Î

.0167 sec/rev

Î

16.7 ms max latency

Î

16.7/2 = 8.35 ms avg latency

Disk Capacity

20 surfaces

25 sectors

512 Bytes/block

#bytes/track = #bytes/block * # blocks/track

= 512 *25

= 12,800 Bytes= 12.8 KB

#Bytes/surface = # bytes/track * # tracks/surface

= 12,800 * 800 = 10,240,00 Bytes = 10.24

MB (mega Bytes)

#Bytes/pack = #bytes/surface * #surfaces/pack

= 10.24 MB * 20 = 204.8 MB

Read Time (Cylinder by Cylinder)

How long does it take to read the entire disk, one cylinder at a time

20

- 25 sectors/ surface

800 tracks

800 tracks / surface

512 bytes / block

3600 rpm (revolutions per minute)

7 ms track-to-track seek time.

28 ms avg seek time

50 ms max seek time

Track latency = 16.7 ms (1 revolution) surface latency = track latency x #tracks/surface

= 16.7 ms * 800 = 13360ms=

13.36s

Total read time= surface latency * #surfaces + #track switches * track-to-track seek time

= 13360*20 + 799*7 =

Total Read time = 800 cylinder reads + 799 cylinder switches

Total read time

=

4 cylinder totat latency reads

+

4 cylinder total seek

4 3

− time

Total read time = (800 *334 ms) + (799 * 7 ms)

= 267 sec + 5.59 sec = 272.59 sec

Observation:

read-time per byte = Total read time /# bytes/pack

= MB sec/MB

µ s/byte (micro sec/byte)

This is comparable to main memory speed! Reading a disk sequentially is very fast.

In contrast, seek time for a random read of 1 byte is

28 ms, i.e., 28,000

µ s.

Data processing requires random access. Usually, we do not read more than one block (512 bytes) sequentially at any given time, i.e., Read a block, while processing it.

Download