Skip to main content

7.Operating System - Memory Management



Process Address Space: The process address space is the set of logical addresses that a process references in its code.

Static vs Dynamic Loading: The choice between Static or Dynamic Loading is to be made at the time of the computer program being developed. If you have to load your program statically, then at the time of compilation, the complete programs will be compiled and linked without leaving any external program or module dependency.

If you are writing a dynamically loaded program, then your compiler will compile the program and for all the modules which you want to include dynamically, only references will be provided and the rest of the work will be done at the time of execution.

At the time of loading, with static loading, the absolute program (and data) is loaded into memory in order for execution to start.

If you are using dynamic loading, dynamic routines of the library are stored on a disk in re-locatable form and are loaded into memory only when they are needed by the program.

Static vs Dynamic Linking: As explained above, when static linking is used, the linker combines all other modules needed by a program into a single executable program to avoid any runtime dependency. When dynamic linking is used, it is not required to link the actual module or library with the program, rather a reference to the dynamic module is provided at the time of compilation and linking.

Swapping: Swapping is a mechanism in which a process can be swapped temporarily out of the main memory (or move) to secondary storage (disk) and make that memory available to other processes. At some later time, the system swaps back the process from the secondary storage to the main memory. Though performance is usually affected by the swapping process it helps in running multiple and big processes in parallel and that's the reason Swapping is also known as a technique for memory compaction.

Memory Allocation (Low Memory, High Memory):

  • Low Memory -- Operating system resides in this memory.
  • High Memory -- User processes are held in high memory.

Fragmentation: As processes are loaded and removed from memory, the free memory space is broken into little pieces. It happens after sometimes that processes cannot be allocated to memory blocks considering their small size and memory blocks remain unused. This problem is known as Fragmentation.

Paging: A computer can address more memory than the amount physically installed on the system. This extra memory is actually called virtual memory and it is a section of a hard that's set up to emulate the computer's RAM. The paging technique plays an important role in implementing virtual memory.

Paging is a memory management technique in which process address space is broken into blocks of the same size called pages (size is the power of 2, between 512 bytes and 8192 bytes). The size of the process is measured in the number of pages.

Segmentation: Segmentation is a memory management technique in which each job is divided into several segments of different sizes, one for each module that contains pieces that perform related functions. Each segment is actually a different logical address space of the program.

Comments

Popular posts from this blog

5.Operating System - Process

Process:   A process is basically a program in execution. The execution of a process must progress in a sequential fashion. To put it in simple terms, we write our computer programs in a text file and when we execute this program, it becomes a process that performs all the tasks mentioned in the program. When a program is loaded into the memory and it becomes a process, it can be divided into four sections ─ stack, heap, text and data. Program:  A computer program is a collection of instructions that performs a specific task when executed by a computer. When we compare a program with a process, we can conclude that a process is a dynamic instance of a computer program. Process Life Cycle (Start, Ready, Running, Waiting, Terminate/Exit): Process Control Block (PCB):  A Process Control Block is a data structure maintained by the Operating System for every process. The PCB is identified by an integer process ID (PID). A PCB keeps all the information needed to keep track of...

1. Operating System - Overview

  Definition: An operating system is a program that acts as an interface between the user and the computer hardware and controls the execution of all kinds of programs. Memory Management:   Memory management refers to the management of Primary Memory or Main Memory. It keeps track of primary memory, i.e., what part of it is in use by whom, what parts are not in use. It allocates and de-allocates the memory when a process requests it to do so. Processor Management :   Processor Management k eeps track of the processor and the status of a process. The program responsible for this task is known as a  traffic controller . It is responsible for a llocating and de-allocating the processor (CPU) to a process. Device Management :  An Operating System manages device communication via their respective drivers.  Device Management keeps track of all devices. The program responsible for this task is known as the I/O Controller. It d ecides which process gets the d...

8. Operating System - Virtual Memory and Input/Output

Definition: A computer can address more memory than the amount physically installed on the system. This extra memory is actually called virtual memory and it is a section of a hard disk that's set up to emulate the computer's RAM. The main visible advantage of this scheme is that programs can be larger than physical memory. Virtual memory serves two purposes. First, it allows us to extend the use of physical memory by using disk. Second, it allows us to have memory protection, because each virtual address is translated to a physical address. Demand Paging: A demand paging system is quite similar to a paging system with swapping where processes reside in secondary memory and pages are loaded only on demand, not in advance. Page Replacement Algorithm: Page replacement algorithms are the techniques using which an Operating System decides which memory pages to swap out, write to disk when a page of memory needs to be allocated Reference String: The string of memory references i...