BytesOfProgress

Wiki


Von-Neumann / x86

x86 CPUs are known for their versatility and are commonly used in personal computers. They handle a wide range of tasks and can run various types of software. The x86 architecture has evolved over the years, and modern x86 CPUs often have multiple cores and advanced features to handle complex tasks efficiently.

The CPU grabs instructions from the computer's memory. Then, it figures out what each instruction is asking it to do. Next, it does the actual work: adding numbers, moving things around, or whatever the instructions might be.

The x86 CPU has a small but high-speed memory known as a cache (SRAM). Think of it like a workspace where the CPU stores regularly used information or tools, making it faster to retrieve them. This speeds up the CPU's performance by reducing the need to constantly go back to the main memory for every small task.

A CPU is capable of managing numerous processes simultaneously. It achieves this by switching between tasks really fast, creating the illusion that everything is happening simultaneously.

CPUs operate through a series of complex, coordinated steps involving multiple components to execute instructions and manage data. The core of the CPU contains arithmetic logic units (ALUs), which perform mathematical operations and logical comparisons, and a control unit (CU) that interprets instructions from memory. The CPU fetches instructions from the system's RAM, decodes them to understand the required action, and then executes them using the ALUs and other components.

There is a hierarchy of registers inside CPUs, small storage locations that provide the fastest access to data. These include general-purpose registers for arithmetic operations and special-purpose registers for specific tasks, like instruction pointers and status flags.

The hierarchy of registers is not part of the cache. Registers and cache memory are different components within the CPU, each serving different purposes.

Registers are small, fast storage locations within the CPU itself. They provide the fastest access to data and are used for immediate arithmetic operations, instruction execution, and managing CPU states. Examples include general-purpose registers for arithmetic operations and special-purpose registers for specific tasks like instruction pointers and status flags.

Cache memory is a small, high-speed memory located close to the CPU cores. It stores frequently accessed data and instructions to reduce the time needed to fetch data from the main memory (RAM). There are 3 main different kinds of cache.


Different kinds of caches

The trade-off between speed and size is a common consideration in cache design, and the hierarchy of L1, L2, and L3 caches is optimized to balance these factors for efficient overall system performance.

L1 Cache

The L1d (Data Cache) is typically the fastest but also the smallest among the different cache levels. It's designed to provide extremely fast access to frequently used data directly associated with a specific CPU core. Due to its proximity to the core, the L1d cache can deliver data at speeds that are crucial for minimizing latency in program execution.

Per-core: Each CPU core typically has its own dedicated L1 cache.

L2 Cache

The L2 Cache is faster than the L3 cache but slower than the L1 cache. It falls in between in terms of both speed and size. Like the L1 cache, each CPU core usually has its own dedicated L2 cache, providing a larger storage capacity compared to L1. This cache serves as a middle ground, offering faster access than the L3 cache while still maintaining a reasonable size.

L3 Cache

The L3 Cache is larger than both L1 and L2 caches but is slower in terms of access speed. Unlike the per-core L1 and L2 caches, the L3 cache is shared among all CPU cores. It acts as a common pool of cached data for communication between different cores. While not as fast as the L1 and L2 caches, the L3 cache provides a larger storage capacity for frequently accessed data that can be shared among multiple cores, contributing to overall system efficiency.




back