Memory and stuff.
le well drawn pyramid
Features Name Volatile Mutable Accessibility Description Data is lost quickly after powering down Data can be overwritten CPU can directly access data in memory
Cache Memory - features Top level of memory Is volatile Mutable Accessible
Cache Memory - description Copies data from other places Commonly has two levels. – The first level (L1 cache) is directly ‘in’ the CPU Smallest size (2-64kB) Fastest speed (lowest distance to CPU) – L2 cache was formerly near the CPU on the motherboard Relatively larger than L1 Pretty fast too!
Cache Memory - purpose When the CPU reaches for data, it first looks in the cache. If it finds what it wants, it’s called a ‘cache hit’ Else, it will reach to the other levels of memory, and this is a ‘cache miss’ Roughly 95% cache hits [citation needed]
Cache Memory - analogy Librarian (CPU) looks for things from book storage room Cache is like a pouch storing most commonly borrowed books, saving the time needed to – Walk to room and back (data transfer round trip) – Search for the book in the room Instead, Librarian first searches inside pouch containing 5 books – Smaller volume => easier to search – Virtually 0 distance
Cache Memory (tl;dr) Top level Volatile, mutable, directly accessible Small, fast Stores copies of most commonly used data
Primary Storage - features Next level after cache. Most common example is RAM (random access memory) Is volatile Mutable Accessible through memory bus
Primary Storage - description DRAM (dynamic) – Data is stored in capacitors that act as bits Charged = 1, no charge =0 – Capacitors leak over time => data leaks over time too – Data has to be periodically rewritten into DRAM ‘refresh cycle’ – Most common form (cheapest)
Primary Storage - description SRAM (static) – Uses 4-6 transistors/bit than DRAM DRAM uses 1 transistor + 1 capacitor/bit Thus, costs more to make – Because of how it works, data is remanent (‘stays’) But it is still volatile (when it loses power, data eventually vanishes) – Significantly less powerhungry No need for data refresh As little as a few microwattsH in idle state
Secondary storage - features Non-volatile – Stored on tape/metallic discs – Read/write with magnetic heads (think turntable) May be mutable or not Not directly accessible – Uses either primary (RAM) or I/O channels
Secondary storage - purpose Storing data permanently Completely mutable (hard disk drive) – This type is mutable; stored on disk but can be rewritten Partially mutable (flash memory) – Electronically rewritable – Used by USBs, cameras, PDAs, phones… Completely unmutable (ROM) – Used to store information permanently (CDs, for example)
Secondary storage - purpose Difference in mutability, from HDD to ROM Speed goes up – Flash memory is about as fast as DRAM – pure ROM is as fast as SRAM Portability goes up
Secondary storage - BIOS The computer boots up through this BIOS is ROM that primary memory reads from Primary memory passes this info to CPU
Virtual Memory Virtualization of different types of storage – Creates a virtual version of memory The OS (and other programs) treat the computer as if there is only one type of memory – “Virtual” memory Space is borrowed from secondary storage, speed from primary storage
Virtual Memory “Page file” is a block of memory – Its size is the size of space borrowed from secondary storage Thrashing occurs when you use up your virtual memory, and the computer repeatedly swaps between virtual and actual memory