Memory Management PDF
Document Details
Uploaded by PamperedAmericium2042
STI College
Tags
Related
- Operating Systems Memory Management PDF
- Artificial Intelligence & Data Science S.E. Operating Systems Past Paper PDF - 2019 Pattern
- Operating Systems Fundamentals PDF
- Computer Science: Chapter 3 - Operating Systems (PDF)
- OCR Computer Science A Level 1.2.1 Systems Software Notes PDF
- UNIT 5 MEMORY MANAGEMENT-1 PDF
Summary
This document discusses memory management in operating systems, covering various techniques and concepts used to allocate and manage memory. It describes different types of addresses used in programming, memory allocation terms like frames, pages, and segments and the process of swapping. It highlights the importance of relocation, protection and sharing, logical organization, and efficient memory use. The handout includes a number of important processes and concepts associated with this topic.
Full Transcript
IT2105 Memory Management o External fragmentation – This occurs when the allotted memory Memory Management Requirements blocks are of varying sizes. This builds up due to the cont...
IT2105 Memory Management o External fragmentation – This occurs when the allotted memory Memory Management Requirements blocks are of varying sizes. This builds up due to the continuous Memory management is the functionality of an operating system (OS) that removal of processes in the main memory. manages the primary memory, which includes the movement of processes o Internal fragmentation – This occurs when the allotted memory back and forth between the main and the secondary memory during execution. blocks are of fixed size, and specific processes need more space or Memory management tracks every memory location, whether it is allocated or less space than the size of the allotted memory block (Parahar, 2019) free, and checks the amount of memory to be allocated for each process. It also facilitates the process allocation and correspondingly updates the The following are the requirements that memory management intends to memory status (Tutorialspoint, n.d.). satisfy (Stallings, 2018): Relocation: It is not possible for a programmer to know in advance which Types of addresses used in a program before and after memory allocation programs will reside in the main memory at the exact time of the program (Tutorialspoint, n.d.): execution. Hence, the possibility that the program may be moved within Symbolic addresses – These are the addresses used in a source code. the main memory due to swapping should always be considered. In The variable names, constants, and instruction labels are the basic addition, swapping active processes in and out of the main memory to elements of a symbolic address space. maximize processor utilization is also highly observed. Relative addresses – These are the addresses at the time of compilation. Protection: Each process should be protected against unwanted A compiler converts symbolic addresses into relative addresses. interference by other processes, whether accidental or intentional. Thus, Physical addresses – These addresses are generated by the loader programs in other processes should not be able to reference memory when a program is loaded into the main memory. locations in a process, for reading or writing purposes, without permission. A user process cannot access any portion of the operating system, neither The following are the commonly used terms in memory management: program nor data. Usually, a program in one process cannot branch to an Frame – This pertains to a fixed-length block of main memory. instruction in another process, and without special arrangement, a Page – This refers to a fixed-length block of data that resides in the program in one process cannot access the data area of another process. secondary memory. A page of data may temporarily be copied into a frame Sharing: Any protection mechanism must have the flexibility to allow in the main memory. several processes to access the same portion of the main memory. If a Segment – A variable-length block of data that resides in the secondary number of processes are executing the same program, it is advantageous memory. An entire segment may temporarily be copied into an available to allow each process to access the same copy of the program rather than region of the main memory, or the segment may be divided into pages, have its own separate copy. In most cases, processes that are cooperating which can be individually copied into the main memory (Stallings, 2018). on some task may need to share access to the same data structure. Swapping – It is a mechanism in which a process can be swapped Logical organization: Most programs are organized into modules, some temporarily out of the main memory to the secondary memory in order to of which are unmodified, read-only or execute-only, and some of which make memory space available for other processes. It is also known as contain data that are modifiable. It would be a great advantage if the memory compaction. operating system and computer hardware could effectively manage user Fragmentation – This occurs due to the continuous loading and removal programs and data in modules. of processes in the memory, wherein free memory spaces are broken Physical organization: The task of moving and organizing information down into smaller fragments. This happens when processes cannot be flow between the main and the secondary memory should be a system allocated to memory blocks because of their small size and memory blocks responsibility. This task is the essence of memory management. remains unused (Tutorialspoint, n.d.). Computer memory is organized into at least two (2) levels, which are as follows: 05 Handout 1 *Property of STI [email protected] Page 1 of 2 IT2105 o Main memory – This is a volatile memory that provides fast access at Simple Segmentation. Each process is divided into a number of segments, a relatively high cost. The main memory technically holds programs wherein a process is loaded by adding all of its segments into dynamic and data that are currently in use. partitions. o Secondary memory – This is usually a non-volatile memory at a There is no internal fragmentation in using this technique, resulting to an cheaper cost with slower access. A secondary memory of large improved memory utilization and reduced overhead compared to dynamic capacity is a good storage of programs and data for a longer term. partitioning. External fragmentation is a drawback of this technique. Memory Partitioning Techniques Fixed Partitioning. The main memory is divided into a number of static Virtual Memory partitions at system generation time, wherein a process may be loaded into a Virtual memory is an abstraction of the main memory, providing processes partition of equal or greater size. Nowadays, the use of fixed partitioning is and the kernel with their own, almost infinite, private view of the main memory. uncommon in the industry (Stallings, 2018). Virtual memory is made possible through the support from both the processor It is simple to implement and produces only a minimal operating system and operating system. Below are some characteristics of a virtual memory overhead. (Gregg, 2021): There is a high chance of inefficient use of memory due to internal It supports multitasking, allowing processes and the kernel to operate on fragmentation. their own private address space without worrying about contention. The maximum number of active processes that can be catered is fixed. It supports oversubscription of the main memory, allowing the operating system to transparently map virtual memory between the main and the Dynamic Partitioning. The partitions are created dynamically, wherein each secondary memory, as needed. process is loaded into a partition of exactly the same size as the process. It is not a real memory and most operating systems map virtual memory This technique has no internal fragmentation, which results in a more to real memory only on demand (when the memory is first populated or efficient use of the main memory. written). Inefficient use of the processor can transpire due to the need for memory compression to counter external fragmentation. Virtual Memory Paging. This partitioning method is similar to simple paging, Below are the three (3) possible placement algorithms that can be considered but does not necessarily load all of the pages of the process. This has no in implementing dynamic partitioning: external fragmentation and encompass large virtual address space, that may 1. Best-fit – This chooses the block that is closest to the requested size. lead to a higher degree of multiprogramming. 2. First-fit – This scans the memory from the beginning and chooses the first available block that is large enough to cater to the process. Virtual Memory Segmentation. This partitioning method is similar to simple 3. Next-fit – This scans the memory from the location of the last segmentation, but does not necessarily load all the segments of a process. placement and chooses the next available block that is large enough This has no internal fragmentation and encompass a large virtual address to cater to the process. space, that may also lead to a higher degree of multiprogramming. Simple Paging. The memory is divided into a number of equally sized frames, References: Gregg, B. (2021). System performance: Enterprise and Cloud (2nd ed.). Pearson Education, Inc. while each process is divided into a number of equally sized pages of the same Silberschatz, A., Galvin, P. & Gagne, G. (2018). Operating systems concepts (10th ed.). John Wiley & Sons, Inc. length as the frames. Then, a process is loaded by adding all of its pages into Stallings, W. (2018). Operating systems: Internal and design principles (9th ed.). Pearson Education Limited Tutorialspoint. (n.d.). Operating System – Memory Management. Retrieved on October 25, 2021 from the available frames (Stallings, 2018). https://www.tutorialspoint.com/operating_system/os_memory_management.htm Parahar, M. (2019, November 28). Difference between internal fragmentation and external fragmentation. Retrieved on October 26, 2021 It plays an important role in implementing virtual memory. from https://www.tutorialspoint.com/difference-between-internal-fragmentation-and-external-fragmentation This technique reduces external fragmentation. This technique may cause a small amount of internal fragmentation. 05 Handout 1 *Property of STI [email protected] Page 2 of 2