1 / 83

Finish Cache

Finish Cache. Cache Misses. When a cache miss occurs, several factors have to be considered. For example, We want the new memory location written into the cache, but where? Can we continue attempting other cache interactions or should we wait? What if the cached data has been modified?

cdudley
Télécharger la présentation

Finish Cache

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Finish Cache

  2. Cache Misses • When a cache miss occurs, several factors have to be considered. For example, • We want the new memory location written into the cache, but where? • Can we continue attempting other cache interactions or should we wait? • What if the cached data has been modified? • Should we do anything with the data we are taking out of the cache?

  3. Replacement Policy • Upon a cache miss, the memory that was not found in cache will be written to cache, but where? • In Direct Mapping, there is no choice it can only be written to the cache address it is mapped to. • In Associative and Set-Associative there is a choice in what to replace.

  4. Replacement Policy (Cont.) • Least Recently Used (LRU) • One approach is to track the use of what is in cache and to replace the line that is being used the least. • This is best in keeping with the locality of reference notion behind cache, but it requires a fair amount of overhead. • Not-Most-Recently Used • Another approach is to choose a line at random except that one protects the line (from the set) that has been used most recently • Less overhead

  5. Blocking or Non-Blocking Cache • Replacement requires interacting with a slower type of memory (a lower level of cache or main memory). Do we allow the processor to continue to access cache during this procedure or not? • This is the distinction between blocking and non-blocking cache. • In blocking, all cache transactions must wait until the cache has been updated. • In non-blocking, other cache transactions are possible.

  6. Cache Write Policy • The data cache may not only be read but may also be written to. But cache is just standing in as a handy representative for main memory. That’s really where one wants to write. This is relatively slow just as reading from main memory is relatively slow. • Rules about when one does this writing to memory is called one’s write policy. • One reason for separating data cache and instruction cache is that the instruction cache does not require a write policy. • Recall the separation is known as the Harvard cache.

  7. Write-Back Cache • Because writing to memory is slow, in Write-Back Cache, a.k.a. "copy back” cache, one waits to until the line of cache is being replaced to write any values back to memory. • Main memory and cache are inconsistent but the cache value will always be used. • In such a case the memory is said to be “stale.”

  8. Dirty Bit • Since writing back to main memory is slow, one only wants to do it if necessary, that is, if some part of line has been updated. • Each line of cache has a “dirty bit” which tells the cache controller whether or not the line has been updated since it was last replaced. • Only if the dirty bit is flipped does one need to write back.

  9. Pros and Cons of Write Back • Pro: Write Back takes advantage of the locality of reference concept. If the line of cache is written to, it’s likely to be written to again soon (before it is replaced). • Con: When one writes back to main memory, one must write the entire line.

  10. Write-Through Cache • With Write-Through Cache, one writes the value back to memory every time a cache line is updated. • Con: Effectively a write-through cache is being used as a cache (fast stand in for memory) only for purposes of reading and not for writing. • Pro: When one writes, one is only writing a byte instead of a line. That’s not much of an advantage given the efficiency of burst/page reading/writing when the cache interacts with memory. • Pro: Integrity: cache and memory always agree

  11. Comparing Policies • Write back is more efficient. • Write through maintains integrity. • Integrity is not so much an issue at the SRAM-DRAM interface in the memory hierarchy since both are volatile. • This issue is more important at the next lower interface main memory/virtual memory as virtual memory is non-volatile.

  12. Victim Cache • Other than write modified data back to memory, what do we do with the data that is being replaced? • One answer is nothing. • Another possibility is to store it in a buffer that is faster than the next lower level, effectively introducing another small level of cache. This is as the victim cache or victim buffer.

  13. References • Computer Architecture, Nicholas Carter • http://www.simmtester.com/page/news/showpubnews.asp?num=101 • http://www.pcguide.com/ref/mbsys/cache/ • http://www.howstuffworks.com/cache.htm/printable • http://slcentral.com/articles/00/10/cache/print.php

  14. Disk Drives

  15. Hard drive • In our original view of a computer as being comprised of ALU, Control, Memory, Input and Output, the hard drive is a device connected either as input or output. • But the hard drive is also sometimes viewed as a logical extension of memory. • The hard drive is the primary storage device. • Compared to RAM, storage is non-volatile • Compared to ROM, storage is more easily written.

  16. Speed and Capacity • The two main characteristics of a hard drive are • Its capacity: how much data can it hold • Its speed: how quickly can it be read from or written to • Data intensive applications such as databases, graphics and so on will require pages to swapped in and out of memory. The speed of the hard drive will be an important factor for determining how efficiently such programs run.

  17. Analog of Moore • Recall that Moore’s Law concerns the exponential growth of the number of transistors on an integrated chip. • There has been similar exponential growth in the capacity of hard drives.

  18. Exponential Improvement in Hard Drive Capacity

  19. Paper Tape and Cards • Prior to hard drives, programs and data could be stored on cards or paper tape. • In both cases a hole could correspond to a 1 and the absence of a hole to a 0.

  20. Magnetic Tape • Magnetic tape was an improvement upon punch cards and paper tape, both in terms of speed and capacity. • In magnetic tape, a long thin piece of plastic is covered with a ferromagnetic material, such as Ferric oxide (Fe2O3).

  21. Magnetic Tapes versus Hard drives • The writing or reading of a individual bit is similar whether we are talking about a hard drive or a magnetic tape. • The difference is one of addressing: • Magnetic tapes have sequential access • Hard drives have random access

  22. Magnets • Little magnets align themselves in a particular way when in the presence of a magnetic field • E.g. a compass points North because it is a magnet aligning itself with the Earth’s magnetic field

  23. Ferromagnetic • Many atoms are like tiny little magnets, but the little magnets point in random directions and tend to cancel out any magnetic effect on a large scale. • An external magnetic field can make these little magnets line up and produce a large-scale (macroscopic) effect. • If the little magnets remain aligned even when the external magnetic field is removed, then the material is said to be ferromagnetic. • The lining up of the magnets is called magnetization. • A ferromagnetic material “holds” or “remembers” its magnetization state.

  24. Writing/Recording • The signal (data changing over time) is fed to a magnet which magnetizes the material on the region of the tape that corresponds to that time. • The tape may record analog or digital information.

  25. Reading/Playing • The magnetized region produces a magnetic field of its own. • Any device that can sense this magnetic field can read the information encoded on the tape. • It is important to note that the reading device (head) does not have to be in physical contact with the tape in order to sense the tape region’s magnetic field – just in its vicinity.

  26. Floating height/Flying height • As opposed to floppies, VCR and cassette tapes, hard disk heads do not come in contact with the medium they are reading from or writing to. • The distance the head is from the material is one of the important design parameters and is known as the floating height or flying height.

  27. Reading, Sensitivity and Density • As the heads are made sensitive to smaller magnetic fields, the region corresponding to a unit of information can be made smaller. • Also as the heads are made to approach the material more closely (where the field is stronger) without touching it, the region corresponding to a unit of information can be made smaller. • If the regions grow smaller, the number of such regions per area (the density) increases. • There are other ways to measure density, so this version is sometimes called the areal density.

  28. Exponential Improvement in Hard Drive Density The units for areal density are bits per square inch (BPSI) or in this case MBPSI (mega)

  29. Shrinking Bit Size

  30. IBM RAMAC • To get a sense of this improvement, consider an early disk drive. • One of the first commercially available hard disks was IBM's RAMAC (Random Access Method of Accounting and Control) introduced in 1956. • Capacity: about 5 MB • Used 50 24" disks!!!!!!!! • Areal density: 2,000 bits per square inch • Data throughput: 8,800 bits/s.

  31. Form Factor • The areal density improvement has allowed the capacity to increase while the size has decreased. • Drive’s form factors (basically their width and height) have continued to grow smaller and smaller. • The 5.25-inch width was a standard. It came in three standard heights • Full-height: 3.25 inch • Half-height: 1.625 inch • Third height: 1 inch

  32. 3.5 inch Form Factor • But now the 3.5-inch width has replaced it as the standard in PCs. • This width comes in two standard heights • Third height: 1-inch which is standard (slim-line) • Half-height: 1.625-inch which is used for higher capacity drives • Besides the overall benefits of miniaturization, smaller widths allow the platters to spin faster and thus help improve the speed.

  33. Platters and Spindle Speed • Instead of the long plastic strip of magnetic tape, hard disks have a collection of circular shaped aluminum or glass platters (which serve as the substrate) that are covered with magnetic material (the media layer). • Data is accessed by having the head float over the platter as its spins. • Access speed is thus related to rotational or spindle speed which is measured in RPM (revolutions per minute). • Spindle speeds in the thousands to tens of thousands are typical these days.

  34. Hard versus floppy disk • The disks in a hard drive are fairly rigid and hence the name “hard” disk. • The disk in a floppy disk is made of a more flexible material.

  35. Anatomy of a Hard Drive • The data is stored on platters: hard, flat circular-shaped piece of aluminum coated with magnetic material on one or both sides. • The spindle serves as a rotational axis for the platters. • The rotational motion is driven by the spindle motor. • The information is accessed by a read/write head. • Typically there are two heads per platter, one on the top, one on the bottom.

  36. Anatomy of a Hard Drive (Cont.) • The head is attached to a part called the slider, which is in turn attached to the actuator arm, which is used to position the head in the desired region. • The position of the actuator arm is controlled by the actuator. • There is actually a parallel array of heads which are moved in unison by the actuator. • The actuator in controlled by the logic board which communicates the rest of the PC.

  37. Don’t try this at home • Reading requires the head to come very, very close to the platter without touching it. • Hard drives should not be opened because a typical speck of dust is larger than the head-to-platter reading distance. • Opening a drive will almost assuredly ruin it. • Head crash: when the head touches the platter

  38. Dust particle versus Flying Height

  39. In both hard and floppy disks, the data is written in concentric circular paths known as tracks A typical floppy disk has 80 (double-density) or 160 (high-density) tracks. Tracks track

  40. Tracks (cont.) • The density of tracks is measured in units of tracks per inch (TPI). • Each track is further divided into sectors. • The location of information is remembered by noting its track and sector numbers.

  41. Sectors • Radial lines break the tracks up into sectors, each of which holds 512 bytes of information. Sector Usually 17 sectors per track for a floppy

  42. Not all sectors are created equal • A sector on the outer portion of the platter has a greater area than a sector on the inner portion. • More and more of the storage area is wasted as one moves out in the radial direction. • More modern drive technologies divide the outer tracks into more sectors to make use of this storage area.

  43. Zoned Bit Recording • Zoned bit recording (ZBR), a.k.a. multiple zone recording or zone recording. • Tracks are broken into groups called zones based on their radial position. Tracks with greater radii are broken into more sectors so that storage area is not wasted. • Requires more sophisticated controller.

  44. Larger Radius, Faster Access • In ZBR, the outer tracks have more sectors and thus hold more data, but the data is accessed by the spinning of the disk. So more data goes by per revolution when reading the outer tracks. • The outer tracks tend to be used first. So disk access performance may go down as one starts to use the inner/slower tracks.

  45. ZBR

  46. Cylinders • Each platter has tracks with the various radii. • All the tracks on different platters but with the same radius make up a cylinder. • For example, if a hard drive has • Four platters • And each platter has 600 tracks • Then • There will be 600 cylinders • Each cylinder will have 8 tracks (assuming that each platter has tracks on both sides).

  47. Why cylinders are important • If the data being written does not fit in a single track, it can be spread across the cylinder. • Activating different heads (at the same radius/cylinder) is an electronic process and thus is faster than moving the arm to a new radius, which is a mechanical process and thus slow.

  48. Accessing a disk • The combination of application, operating system, BIOS and possibly disk interface circuitry determine the location of the data on the hard disk. • The location corresponds to a geometric location on the disk. One needs to know • The cylinder which determines the radius or track. • The head which determines which platter and which side of the platter. • The sector which determines where along the track.

More Related