2.1.2 Describe primary memory.
2.1.3 Explain the use of cache memory.
a computer memory that a processor can access directly.
a computer memory that the CPU can write data to and retrieve data from while executing programs.
Registers, Cache memory and RAM are all part of primary memory.
There is an important distinction between computer memory and storage:
Stores program operations and data while a program is being executed.
There are several types of memory, including registers, cache, RAM and virtual memory.
Stores programs and files long term, even when they are not in use.
Devices such as hard drives, USB memory sticks or SD cards are used to store files such as photos, music and software applications long term.
The data stored is referred to as persistent data.
Figure 1.1 Block diagram of the computer showing
the CPU, cache, primary memory and non-volatile memory.
“random access” means that the data in the memory can be directly accessed in any order.
Volatile memory, when a computer is switched off, all data stored in its RAM is lost.
Data can be written to and read from memory very quickly
Acts as temporary storage and working space for the operating systems and its applications.
Stores data and instructions currently in use
Active part of the operating system;
Applications;
The graphical user interface (GUI).
It is a storage for data that can be read but not altered.
It cannot be changed by either a program or a user.
e.g. ROM stores the instructions for the computer to start up when it is turned on again, Basic Input and Output System (BIOS).
There are numerous ROM chips located on the motherboard and a few on expansion boards. The chips are essential for the basic input/out system (BIOS), boot up, reading and writing to peripheral devices, basic data management and the software for basic processes for certain utilities.
Stores permanent instructions
Is mainly used for firmware.
Firmware are software programs or sets of instructions that are embedded into a hardware device.
It supplies the needed instructions on how a device communicates with various hardware components.
It could be used to start up a device or control the operation of a peripheral.
A smaller and faster (SRAM) that holds information that are most actively used
Stores frequently used instructions
This means that processors can access this memory much faster than main memory.
It is used to temporarily hold instructions and data that the CPU is likely to reuse.
The CPU automatically checks cache for instructions before requesting data from main memory.
This saves fetching the instructions and data repeatedly from RAM -- a relatively slow process which might otherwise keep the CPU waiting.
Transfers to and from the cache take significantly less time.
L1 - placed on the microprocessor itself
L2 - placed between the primary memory (RAM) and the microprocessor (CPU)
Figure 1.2 Cache
cache memory is closer to the CPU than RAM
cache memory is faster than RAM
cache memory is more expensive than RAM
cache memory is separated in L1, L2... levels
Figure 1.3 Relationship between RAM, Processor and Cache Memory
Is considered effective because in most programs the same data or instructions are accessed over and over.
By keeping as much of this information as possible in SRAM, the computer avoids accessing the slower DRAM.
Cache is graded as Level 1 (L1), Level 2 (L2) and Level 3 (L3).
L1.
Is usually part of the processor chip itself and is both the smallest and the fastest to access.
Its size is often restricted to between 8 KB and 64 KB.
L2 and L3.
Are bigger than L1.
Are extra caches built between the CPU and the RAM.
Although sometimes L2 is built into the CPU with L1.
Takes slightly longer to access than L1.
The more L2 and L3 memory available, the faster a computer can run.
In a multi-core processor, each CPU core has its own L1 cache, but may share L2 and L3 caches.
A disk cache is a cache memory that is used to speed up the process of storing and accessing data from the host hard disk.
Enables faster processing of reading/writing, commands and other input and output processes between the hard disk, the memory and computing components.
Typically stores the most recent and frequently used programs and data.
When a user or program requests data, the operating system first reviews the disk cache.
If the data is found, the OS and memory quickly deliver the data to the program.
Works under the same principle as memory caching, but instead of using high-speed SRAM, disk caching or a disk cache uses conventional main memory.
The most recently accessed data from the disk and its adjacent sectors are stored in a memory buffer.
When a program needs to access data from the disk, it first checks the disk controller cache.
The performance can be dramatically improved using disk caching because accessing a data in RAM can be thousands of times faster than accessing a hard disk.
Cache memory is made out of high-speed static RAM (SRAM), rather than the slower and cheaper dynamic RAM (DRAM) which is used for main memory.
Static Random Access Memory (SRAM) is a type of RAM that holds data in a static form as long as the memory has power.
Unlike DRAM, it does not need to be refreshed.
SRAM stores each bit of data on four transistors using two cross-coupled inverters.
The two stable states characterize 0 and 1.
Dynamic RAM has one capacitor and one transistor per bit.
SRAM does not have a capacitor to store the data, hence SRAM works without refreshing.
SRAM is faster and more reliable than DRAM.
While DRAM supports access times (access time is the time required to read or write data to/from memory) of about 60 nanoseconds, SRAM can give access times as low as 10 nanoseconds.
SRAM is significantly more expensive to produce than DRAM.
Since SRAM is faster, it is used in registers and cache memory. Since it has a high cost, it is often used only as a memory cache.