{"id":3916,"date":"2023-06-15T16:29:18","date_gmt":"2023-06-15T10:59:18","guid":{"rendered":"https:\/\/binaryterms.com\/?p=3916"},"modified":"2023-06-13T16:30:04","modified_gmt":"2023-06-13T11:00:04","slug":"memory-hierarchy-in-computer-architecture","status":"publish","type":"post","link":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html","title":{"rendered":"Memory Hierarchy in Computer Architecture"},"content":{"rendered":"<p>Memory hierarchy describes how the computer organizes the memory devices based on their speed, size and cost per bit. The various memory devices we use to design a system are registers, cache memory, main memory, and magnetic disks. All these memories operate at different speeds and have different costs per bit.<\/p>\n<h2>Why Memory Hierarchy?<\/h2>\n<p>How much memory (size) of each kind will be enough to design a system is an open-ended question. Because as much memory will be available, the applications will develop to utilize the available memory space. So, memory size alone is not the constraint on which we can decide the memory hierarchy.<\/p>\n<p>Our next constraint is speed. The performance of any system depends on how fast the processor can access any particular memory in the system. The faster the processor is able to access the memory, the faster it will execute the required instructions of the program or application. So speed is an important constraint that plays a vital role in deciding the memory hierarchy.<\/p>\n<p>Now the last constraint is cost per bit. Although the system\u2019s performance matters a lot, but if we think practically, the memory units must be cost-effective in relation to the other components of the computing devices, such as processors, motherboards, etc.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3917\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg\" alt=\"Memory Hierarchy\" width=\"406\" height=\"350\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg 406w, https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy--300x259.jpg 300w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/p>\n<p>So, these three constraints, speed, cost, and size, go hand in hand while deciding the memory hierarchy.<\/p>\n<h5>The relationship between these three constraints is:<\/h5>\n<ul>\n<li>Memory with the fastest access time has the greatest cost per bit.<\/li>\n<li>The memory with greater capacity has a slower access time.<\/li>\n<li>Memory with greater capacity has a smaller cost per bit.<\/li>\n<\/ul>\n<p>Observing the above relationship between the constraints of memory devices, the designer can choose memory with greater capacity to satisfy the large memory requirement. The greater capacity memories are also cost-effective as their cost per bit is low.<\/p>\n<p>However, to enhance the system\u2019s performance, the designer has to choose faster memory in lower capacity to maintain the balance between the access time and the cost per bit of the memory.<\/p>\n<p>Thus, a system designer must employ memory hierarchy instead of relying on a single component. We usually use the memory hierarchy to design a computer system with smaller, expensive, faster memories supplemented by larger, cheaper, and slower ones.<\/p>\n<h3>Memory devices in Memory Hierarchy<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3918\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Position-of-Memory-Devices-in-Memory-Hierarchy.jpg\" alt=\"Position of Memory Devices in Memory Hierarchy\" width=\"138\" height=\"300\" \/><\/p>\n<h4>Register<\/h4>\n<p>Registers are internal to the CPU. The system uses high-speed storage elements to store operands when they are brought into the processor. Registers are the smallest memory unit capable of storing one word of data.<\/p>\n<p>Registers have the shortest access time compared to other memory units in the memory hierarchy. A processor can have several registers for different purposes; some common registers are:<\/p>\n<ul>\n<li><strong>Instruction Registers<\/strong> \u2013 Holds the instruction currently in execution.<\/li>\n<li><strong>Program Counter<\/strong> \u2013 Holds the memory address of the next instruction that the system has to fetch and execute.<\/li>\n<li><strong>Accumulator<\/strong> \u2013 Holds temporary operands and the result of an ALU operation.<\/li>\n<\/ul>\n<p>Although registers are at the top of the memory hierarchy, they only provide a small portion of the required memory.<\/p>\n<h4>Cache Memory<\/h4>\n<p>Cache memory is next in the memory hierarchy after registers in terms of speed of access. It\u2019sIt\u2019s a small memory unit implemented directly on the processor chip. The system employs cache memory to hold copies of instructions and data recently being processed.<\/p>\n<p>However, the system permanently stores the instructions and data in a much larger memory external to the processor. Now, when the processor requires the same set of recently used instructions, it can access the copy stored in cache memory instead of returning to the main memory.<\/p>\n<p>Cache memory has an even shorter access time if compared to the main memory. Now even cache memory has two or more levels. The primary cache, or the <strong>Level 1 (L1)<\/strong> cache, is internal to the processor chip. However, the access time to the primary cache memory is comparable to the access time of registers.<\/p>\n<p>The system designer places the secondary cache, i.e.<strong> Level 2 (L2)<\/strong> cache, between the L1 cache and main memory. Its access time is comparatively larger than the L1 cache. Even an L2 cache is implemented on the processor chip.<\/p>\n<p>The tertiary cache or Level 3 L3 cache is somewhat larger than L1 and L2, and its access time is even larger than L1 and L2. The system places L3 between L2 and L3 cache. L3 cache may or may not be implemented on the processor chip.<\/p>\n<h4>Main memory<\/h4>\n<p>Main memory, or primary memory, or RAM, is next in the memory hierarchy after cache memory. The main memory is a large dynamic memory implemented externally to the processor chip. The access time to the main memory can be 100 times longer as compared to the primary cache.<\/p>\n<h4>Magnetic Disk<\/h4>\n<p>The magnetic disk is the secondary storage, and the designer employs disks in large amounts in a computer system. The magnetic disk has a longer access time as compared to other memory units in the memory hierarchy. Thus, the magnetic disk is present at the bottom of the memory hierarchy.<\/p>\n<h4>Magnetic Tape<\/h4>\n<p>The magnetic tape has an even longer access time as compared to the magnetic disks. Thus, we place it at the bottom of the memory hierarchy. Magnetic tapes are portable, non-volatile secondary memory. It stores the programs and data files as files and records instead of bytes and words.<\/p>\n<p>So far, we have discussed the concepts of the memory hierarchy and the motive behind organizing the memory devices in a hierarchy. Finally, we have discussed each of the memory devices with their features and characteristics. The hierarchical memory operates to bring the instructions and data closer to the processor that the processor will require shortly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Memory hierarchy describes how the computer organizes the memory devices based on their speed, size and cost per bit. The various memory devices we use to design a system are registers, cache memory, main memory, and magnetic disks. All these memories operate at different speeds and have different costs per bit. Why Memory Hierarchy? How [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[3],"tags":[],"class_list":{"0":"post-3916","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-computer-architecture","7":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Memory Hierarchy in Computer Architecture - Binary Terms<\/title>\n<meta name=\"description\" content=\"Memory hierarchy describes how the computer organizes the memory devices based on their access time, size of memory and cost per bit.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Memory Hierarchy in Computer Architecture - Binary Terms\" \/>\n<meta property=\"og:description\" content=\"Memory hierarchy describes how the computer organizes the memory devices based on their access time, size of memory and cost per bit.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html\" \/>\n<meta property=\"og:site_name\" content=\"Binary Terms\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-15T10:59:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg\" \/>\n<meta name=\"author\" content=\"Neha T\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Neha T\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html\"},\"author\":{\"name\":\"Neha T\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\"},\"headline\":\"Memory Hierarchy in Computer Architecture\",\"datePublished\":\"2023-06-15T10:59:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html\"},\"wordCount\":945,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg\",\"articleSection\":[\"Computer Architecture\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html\",\"url\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html\",\"name\":\"Memory Hierarchy in Computer Architecture - Binary Terms\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#primaryimage\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg\",\"datePublished\":\"2023-06-15T10:59:18+00:00\",\"description\":\"Memory hierarchy describes how the computer organizes the memory devices based on their access time, size of memory and cost per bit.\",\"breadcrumb\":{\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#primaryimage\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg\",\"width\":406,\"height\":350,\"caption\":\"Memory Hierarchy\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/binaryterms.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Memory Hierarchy in Computer Architecture\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/binaryterms.com\/#website\",\"url\":\"https:\/\/binaryterms.com\/\",\"name\":\"Binary Terms\",\"description\":\"The Computer Science &amp; IT Guide\",\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/binaryterms.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/binaryterms.com\/#organization\",\"name\":\"Binary Terms\",\"url\":\"https:\/\/binaryterms.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"width\":400,\"height\":63,\"caption\":\"Binary Terms\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\",\"name\":\"Neha T\",\"url\":\"https:\/\/binaryterms.com\/author\/author\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Memory Hierarchy in Computer Architecture - Binary Terms","description":"Memory hierarchy describes how the computer organizes the memory devices based on their access time, size of memory and cost per bit.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html","og_locale":"en_GB","og_type":"article","og_title":"Memory Hierarchy in Computer Architecture - Binary Terms","og_description":"Memory hierarchy describes how the computer organizes the memory devices based on their access time, size of memory and cost per bit.","og_url":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html","og_site_name":"Binary Terms","article_published_time":"2023-06-15T10:59:18+00:00","og_image":[{"url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg","type":"","width":"","height":""}],"author":"Neha T","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Neha T","Estimated reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#article","isPartOf":{"@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html"},"author":{"name":"Neha T","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe"},"headline":"Memory Hierarchy in Computer Architecture","datePublished":"2023-06-15T10:59:18+00:00","mainEntityOfPage":{"@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html"},"wordCount":945,"commentCount":0,"publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"image":{"@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#primaryimage"},"thumbnailUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg","articleSection":["Computer Architecture"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html","url":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html","name":"Memory Hierarchy in Computer Architecture - Binary Terms","isPartOf":{"@id":"https:\/\/binaryterms.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#primaryimage"},"image":{"@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#primaryimage"},"thumbnailUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg","datePublished":"2023-06-15T10:59:18+00:00","description":"Memory hierarchy describes how the computer organizes the memory devices based on their access time, size of memory and cost per bit.","breadcrumb":{"@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#primaryimage","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2023\/02\/Memory-Hierarchy-.jpg","width":406,"height":350,"caption":"Memory Hierarchy"},{"@type":"BreadcrumbList","@id":"https:\/\/binaryterms.com\/memory-hierarchy-in-computer-architecture.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/binaryterms.com\/"},{"@type":"ListItem","position":2,"name":"Memory Hierarchy in Computer Architecture"}]},{"@type":"WebSite","@id":"https:\/\/binaryterms.com\/#website","url":"https:\/\/binaryterms.com\/","name":"Binary Terms","description":"The Computer Science &amp; IT Guide","publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/binaryterms.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/binaryterms.com\/#organization","name":"Binary Terms","url":"https:\/\/binaryterms.com\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","width":400,"height":63,"caption":"Binary Terms"},"image":{"@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe","name":"Neha T","url":"https:\/\/binaryterms.com\/author\/author"}]}},"_links":{"self":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/3916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/comments?post=3916"}],"version-history":[{"count":2,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/3916\/revisions"}],"predecessor-version":[{"id":3920,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/3916\/revisions\/3920"}],"wp:attachment":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/media?parent=3916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/categories?post=3916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/tags?post=3916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}