Jump to content

Memory Hierarchy And Access Time - Sand Software And Sound

From The Stars Are Right


This page takes a more in-depth look at the Raspberry Pi memory hierarchy. Every stage of the memory hierarchy has a capability and pace. Capacities are relatively easy to discover by querying the operating system or reading the ARM1176 technical reference guide. Velocity, Memory Wave nevertheless, is not as easy to find and should normally be measured. I exploit a easy pointer chasing approach to characterize the behavior of every stage in the hierarchy. The technique additionally reveals the conduct of memory-associated efficiency counter events at every degree. The Raspberry Pi implements 5 levels in its memory hierarchy. The levels are summarized within the table beneath. The highest level consists of virtual memory pages which can be maintained in secondary storage. Raspbian Wheezy retains its swap area in the file /var/swap on the SDHC card. This is enough space for Memory Wave 25,600 4KB pages. You are allowed as many pages as will fit into the preallocated swap house.



The Raspberry Pi has both 256MB (Mannequin A) or 512MB (Model B) of major memory. That is sufficient area for 65,536 pages or 131,072 bodily pages, if all of major memory have been accessible for paging. It isn’t all out there for consumer-space programs because the Linux kernel needs area for its own code and knowledge. Linux also helps massive pages, but that’s a separate matter for now. The vmstat command shows details about digital memory utilization. Please check with the man web page for usage. Vmstat is an efficient instrument for troubleshooting paging-related performance points because it shows web page in and out statistics. The processor in the Raspberry Pi is the Broadcom BCM2835. The BCM2835 does have a unified degree 2 (L2) cache. However, the L2 cache is devoted to the VideoCore GPU. Memory references from the CPU side are routed around the L2 cache. The BCM2835 has two stage 1 (L1) caches: a 16KB instruction cache and a 16KB information cache.



Our analysis below concentrates on the information cache. The information cache is 4-approach set associative. Every means in an associative set shops a 32-byte cache line. The cache can handle up to 4 energetic references to the identical set without battle. If all four methods in a set are legitimate and a fifth reference is made to the set, then a conflict occurs and one of many four methods is victimized to make room for the brand new reference. The info cache is nearly indexed and physically tagged. Cache strains and tags are stored separately in DATARAM and TAGRAM, respectively. Digital deal with bits 11:5 index the TAGRAM and DATARAM. Given a 16KB capability, 32 byte traces and four methods, there must be 128 sets. Virtual tackle bits 4:Zero are the offset into the cache line. The information MicroTLB translates a virtual address to a bodily deal with and sends the physical address to the L1 knowledge cache.



The L1 data cache compares the physical tackle with the tag and determines hit/miss status and the right way. The load-to-use latency is three (3) cycles for an L1 information cache hit. The BCM2835 implements a two degree translation lookaside buffer (TLB) structure for virtual to physical handle translation. There are two MicroTLBs: a ten entry knowledge MicroTLB and a ten entry instruction MicroTLB. The MicroTLBs are backed by the primary TLB (i.e., the second stage TLB). The MicroTLBs are fully associative. Every MicroTLB translates a virtual deal with to a bodily deal with in a single cycle when the page mapping information is resident in the MicroTLB (that is, a success within the MicroTLB). The main TLB is a unified TLB that handles misses from the instruction and information MicroTLBs. A 64-entry, 2-means associative structure. Fundamental TLB misses are handled by a hardware page desk walker. A page table walk requires at least one further Memory Wave memory booster access to seek out the page mapping data in primary memory.