Os - Memory Management in Operating System
Os - Memory Management in Operating System
Overview
A computer system can address and utilize more memory than the size of
the memory present in the computer hardware. This extra memory is
referred to as virtual memory. Virtual memory is a part of secondary
memory that the computer system uses as primary memory. Paging has a
vital role in the implementation of virtual memory.
The process address space is a set of logical addresses that every process
refers to in its code. Paging is a technique of memory management in
which the process address space is broken into blocks. All the blocks are of
the same size and are referred to as “pages”. The size of a page is a power
of 2 and its value is in the range of 512 bytes to 8192 bytes. The size of a
process is measured in terms of the number of pages.
A similar division of the main memory is done into blocks of fixed size.
These blocks are known as “frames” and the size of a frame is the same as
that of a page to achieve optimum usage of the primary memory and for
avoiding external fragmentation.
What is Fragmentation?
When processes are moved to and from the main memory, the available
free space in primary memory is broken into smaller pieces. This happens
when memory cannot be allocated to processes because the size of
available memory is less than the amount of memory that the process
requires. Such blocks of memory stay unused. This issue is called
fragmentation.
Fragmentation is of the following two types:
1. External Fragmentation:
2. Internal Fragmentation:
1. Segmentation
The location of any data items stored in the segment can be determined by
the distance of the actual position of the data item from the base address of
the segment. This distance is called an offset or displacement value.
Simply put, when data is to be obtained from a segment, then the actual
address of data is computed as the sum of the base address of the
segment and the offset value.
The offset value and the base address of a segment are both specified in a
program instruction itself.
2. Paging
Explained earlier
3. Swapping
Conclusion
Memory is the important part of the computer that is used to store the data.
Its management is critical to the computer system because the amount of
main memory available in a computer system is very limited. At any time,
many processes are competing for it. Moreover, to increase performance,
several processes are executed simultaneously. For this, we must keep
several processes in the main memory, so it is even more important to
manage them effectively.
o Simple to implement.
o Easy to manage and design.
o In a Single contiguous memory management scheme, once a
process is loaded, it is given full processor's time, and no other
processor will interrupt it.
Multiple Partitioning:
o Fixed Partitioning
o Dynamic Partitioning
Fixed Partitioning
o Simple to implement.
o Easy to manage and design.
Dynamic Partitioning
o Simple to implement.
o Easy to manage and design.
What is paging?
Advantages of paging: