CS401 Study Guide
This study guide will help you get ready for the final exam. It discusses the key topics in each unit, walks through the learning outcomes, and lists important vocabulary terms. It is not meant to replace the course materials!
Unit 6: Memory Management
6a. Explain the memory hierarchy
- Define computing memory hierarchy.
- Explain why response time is important.
- Explain why memory hierarchy is important.
Proper memory management is essential for computer environments to function correctly. Poor memory hierarchy will lead to poor performance in architectural design, predictions necessary for scheduling or computing, and lower-level programming constructs.
Response time, complexity, and capacity are all related. Poor memory hierarchy will lead to longer response times and poor computer performance across the system.
Review this material in Overview of Memory Hierarchy.
6b. Discuss how the operating system interacts with memory
- What is memory management and why is it important?
Memory management refers to the OS function responsible for managing the computer's primary memory. The memory management function keeps track of the status of each memory location, whether it is allocated or free. It determines how to allocate memory among competing processes by deciding which process will get memory, when they will receive it, and how much they are allowed. When memory is allocated, it determines which memory locations will be assigned. It tracks when memory is freed or unallocated and updates the status.
Without proper memory management, the computer does not know where it is in processing a function. It is immediately lost and the programs will crash.
Review memory management in Paging.
6c. Describe how virtual memory works
- Define virtual memory.
- Explain how virtual memory works.
Virtual memory is an essential part of modern computing. It describes the hardware and software-based memory management capability that allows computers to compensate for physical memory shortages.
The OS temporarily transfers data from random access memory (RAM) to disk storage. Virtual address space is increased using active memory in RAM and inactive memory in hard disk drives (HDDs) to form contiguous addresses that hold the application and its data.
6d. Discuss three algorithms for dynamic memory allocation
- What is dynamic memory allocation?
- When should dynamic memory allocation be used?
- What are three dynamic memory allocation techniques?
Dynamic memory allocation refers to the process of assigning memory space during the execution or run time. It is critical to have elegant dynamic memory allocation techniques. These techniques occur while computer operations are in process. These memory allocation decisions and executions must be handled elegantly and efficiently (in milliseconds) before the computing operation overtakes the memory available for it to continue and the system crashes.
You should use dynamic memory allocation during the following conditions:
- When you do not know how much memory a program will need.
- When you want to use data structures without any upper limit of memory space.
- When you want to use memory space more efficiently. For example, let's say you have allocated memory space for a 1D array as an array , and you only use 10 memory spaces. Without dynamic memory allocation, the remaining 10 memory spaces will be wasted because other program variables will not be able to use them.
- Dynamically-created lists insertions and deletions allow us to easily manipulate addresses. Statically-allocated memory insertions and deletions lead to more movements and wasted memory.
- Dynamic memory allocation is needed for structures and linked lists in programming,
Three techniques for dynamic memory allocation include:
- Stack allocation;
- Heap allocation;
- Fibonacci allocation.
Review this material in Memory Management.
6e. Explain methods of memory access
- Name three methods of memory access.
Computer engineers created different methods of memory access because no one method provides a viable solution for all situations, such as the need for different response times.
- Random Access Memory – each memory location has a unique address. You can use this unique address to reach any memory location, in the same amount of time, in any order.
- Sequential Access Memory – allows memory access in sequence (in order).
- Direct Access Memory – information is stored in tracks. Each track has a separate read/write head.
6f. Describe paging and page replacement algorithms
- Define paging. What is a page in an OS?
- Define a page frame. What is a page transfer?
- How does paging work? When does paging occur?
Paging refers to a computer operating system that uses paging for virtual memory management.
A page is a unit of memory whose location is held in a page table. A page is the smallest unit of data for memory management in a virtual operating system. A page is a fixed-length, contiguous block of virtual memory, described by a single entry in the page table. It is the smallest unit of data for memory management in a virtual memory operating system.
A page frame is the smallest fixed-length contiguous block of physical memory into which memory pages are mapped by the operating system.
A page transfer of pages between main memory and an auxiliary store, such as a hard disk drive, is referred to as paging or swapping. Page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk when a page of memory needs to be allocated.
Page replacement happens when a requested page is not in memory (page fault) and a free page cannot be used to satisfy the allocation, either because there are none, or because the number of free pages is lower than some threshold.
Review this material in Paging.
Unit 6 Vocabulary
- Computer memory
- Direct-access memory management
- Dynamic memory allocation
- Memory access
- Memory hierarchy
- Memory management
- Page frame
- Page replacement
- Page swapping
- Random-access memory management
- Response time
- Sequential access memory management
- Virtual memory