Memory Management PDF

Summary

This document provides an overview of memory management concepts, including different memory types (primary, secondary, cache), memory caching techniques, and a comparison table highlighting the cache sizes of various Intel and AMD CPU series. It also presents the key memory management techniques and the structure of memory management schemes, in the context of operating systems.

Full Transcript

MEMORY MANAGEMENT Memory management is a crucial aspect of computer systems, as it involves the efficient allocation and utilization of memory to ensure smooth execution of processes and applications Memory management operates at three levels: hardware, operating system, and program/application, a...

MEMORY MANAGEMENT Memory management is a crucial aspect of computer systems, as it involves the efficient allocation and utilization of memory to ensure smooth execution of processes and applications Memory management operates at three levels: hardware, operating system, and program/application, and it aims to achieve efficient utilization of memory and optimize memory availability Computer-system operation One or more CPUs, device controllers connect through common bus providing access to shared memory Concurrent execution of CPUs and devices competing for memory cycles ✓ Memory management determines what is in memory and when Optimizing CPU utilization and computer response to users Memory Management Activities: ❑ Keeping track of which parts of memory are currently being used and by whom ❑ Deciding which processes (or parts thereof) and data to move into and out of memory ❑ Allocating and deallocating memory space as needed Types of Memory 1. Primary Memory (RAM): This is the main memory of a computer system where data is temporarily stored for quick access by the CPU. It is volatile, meaning that it loses its content when the power is turned off. 2. Secondary Memory (Storage): This includes devices like hard drives, SSDs, and other non- volatile storage mediums. Unlike RAM, data stored in secondary memory persists even when the power is turned off. 3. Cache Memory :This is a small-sized type of volatile computer memory that provides high-speed data access to the processor and stores frequently used computer programs, applications, and data. Cache memory is faster than main memory and helps improve the speed and performance of the computer. "volatile" and "non-volatile" refer to the characteristics of memory with respect to data persistence: 1. Volatile Memory: Volatile memory is temporary and loses its contents when the power is turned off or in the event of a system crash. Example: RAM (Random Access Memory) is a common type of volatile memory used by computers. Data stored in RAM is quickly accessible by the CPU, but it is lost when the power is cut off. 2. Non-Volatile Memory: Non-volatile memory retains its stored data even when the power is turned off or in the event of a system crash. Example: Examples of non-volatile memory include ROM (Read-Only Memory), Flash memory, and various types of storage devices such as hard drives, SSDs (Solid State Drives), and USB drives. These retain data even when the power is removed. Memory Caching Memory caching is a technique used to store copies of frequently accessed main memory locations in a smaller, faster storage space. This allows the CPU to access critical information quickly without repeatedly retrieving it from the slower main memory. Types of Cache memory 1. L1 Cache: Located directly on the CPU chip, L1 cache is the fastest but has the least capacity. It stores small amounts of data and instructions that are frequently used by the processor; (is always located on the processor) 2. L2 Cache: Positioned between the L1 cache and the main memory, L2 cache has a larger capacity than L1 cache and provides additional storage for frequently accessed data.(can either be located on the CPU or on the motherboard depending on the architecture) 3. L3 Cache: Some systems have an additional level of cache, known as L3 cache, which is shared among multiple CPU cores. It further enhances data access speeds for the entire processor. Comparison table of Intel and AMD CPUs in terms of cache size Max Memory CPU Series L1 Cache L2 Cache L3 Cache Support Intel i3-10100T 32KB 256KB N/A 1.1GHz Intel i3-10100 32KB 256KB N/A 1.1GHz Intel i3-10300 32KB 256KB N/A 1.15GHz Intel i3-10320 32KB 256KB N/A 1.15GHz AMD Ryzen 3 3100 N/A 32KB + 32KB (x4) 512KB (x4) N/A AMD Ryzen 3 3300X N/A 32KB + 32KB (x8) 512KB (X8) N/A Intel i7-10700K N/A 128KB N/A 3.8GHz Intel i7-10700 N/A 128KB N/A 2.9GHz Intel i7-10700T N/A 128KB N/A 2.0GHz AMD Ryzen 7 3700X N/A 32KB + 32KB (x8) 512KB (X8) N/A AMD Ryzen 7 3700U N/A 32KB + 32KB (x4) 512KB (X4) N/A Intel i9-10900K N/A 20MB N/A 3.7GHz AMD Ryzen Threadripper Pro 32MB + 32MB 3995WX N/A (x64) 256MB N/A AMD Ryzen 32MB + 32MB Threadripper 3960X N/A (x24) 256MB N/A AMD Ryzen 32MB + 32MB Threadripper 3970X N/A (x32) 256MB N/A Virtual Memory and Machine: Virtual memory also known as virtual storage, is a memory management technique of an operating system (OS) that uses hardware and software to allow a computer to compensate for physical memory shortages by temporarily transferring data from random access memory (RAM) to disk storage. It maps memory addresses used by a program, called virtual addresses, into physical addresses in computer memory. Machine: In the context of virtual memory, a "machine" refers to the computer system as a whole, including its hardware and software components. The machine utilizes virtual memory to efficiently manage memory resources and enable the execution of large programs. MEMORY MANAGEMENT TECHNIQUES 1. Contiguous Memory Management Schemes: In this scheme, each program occupies a single contiguous block of storage locations. It limits the computer to execute only one process at a time. Multiprogramming can be used to overcome the limitation and allow more than one process to reside in the main memory simultaneously 2. Non-Contiguous Memory Management Schemes: In this scheme, the program is divided into blocks (fixed size or variable size) and loaded at different portions of memory. Program blocks are not stored adjacent to each other 3. Paging: This technique divides the computer's main memory into fixed-size units known as pages and the program into fixed-size blocks known as page frames. It allows the physical memory to be non-contiguous, and the pages of a process can be scattered throughout the physical memory 4. Segmentation: This technique divides the computer's main memory into segments, where each segment is a logical unit such as a function, a method, a variable, an object, a stack, a queue, or a table. It provides protection and sharing of code and data 5. Swapping: Swapping is a method in which the process is swapped between the main memory and the secondary storage when it is required. It allows more processes to be run than can fit into the main memory at the same time 6. Compaction: Compaction is a technique used to reduce external fragmentation by shuffling the memory contents to place all free memory together in one large block Table that outlines some common operating systems and the memory management techniques they use: Operating Techniques Used Description of Process System Windows - Paging - Paging: Divides physical memory into fixed-sized blocks (pages). Pages are swapped in and out of secondary storage (paging file) as Segmentation needed. Virtual Memory Segmentation: Divides programs into segments, allowing dynamic growth. Combines with paging for virtual memory. Virtual Memory: Uses a combination of paging and segmentation to provide a larger address space than physical memory. Linux - Paging - Paging: Similar to Windows, divides physical memory into pages. Pages are swapped in and out of the swap space on disk. Swapping Swapping: Entire processes or parts of processes are moved to and from swap space on disk when they are not in use. macOS - Demand Paging - Demand Paging: Similar to paging but only brings in pages as they are needed, reducing initial loading time. Virtual Memory Virtual Memory: Combines demand paging with other techniques to provide a larger address space. Uses a swap space on disk for less frequently used pages. Unix - Paging - Paging: Divides memory into pages, similar to Linux and Windows. Swapping: Similar to Linux, moves entire processes or Swapping parts of processes to and from disk. Demand Paging: Pages are Demand Paging loaded into memory only when they are accessed, reducing initial load times. Android - Paging - Paging: Android, based on the Linux kernel, uses paging for memory management. Swapping - Swapping: Similar to Linux, Android may use swapping to move processes or parts of processes to and from disk. iOS - Demand Paging - Demand Paging: Pages are loaded into memory only when needed, reducing initial loading time Virtual Memory Virtual Memory: Similar to macOS, iOS uses virtual memory to provide a larger address space than physical memory. Memory management can vary between different versions of the same operating system. Activity: Choose two questions to answer. 1. Design a diagram illustrating the hierarchy of cache memory types in a computer system. 2. Propose a new memory management technique and explain its potential advantages over existing techniques. 3. In which memory management scheme would the technique of swapping be most beneficial? 4. How does virtual memory compensate for physical memory shortages, and what role does it play in efficient memory utilization? 5. Compare the memory management techniques used by Windows and Linux operating systems, highlighting their similarities and differences. 6. Evaluate the impact of demand paging on overall system performance compared to traditional paging methods. 7. Assess the advantages and disadvantages of using cache memory in a computer system, considering factors such as speed, capacity, and cost. 8. Critically analyze the memory management techniques used in mobile operating systems (Android and iOS), discussing their effectiveness in resource optimization.

Use Quizgecko on...
Browser
Browser