MITC101
MITC101
IN
OPERATING SYSTEM
MEMORY MANAGEMENT
RAPCHEL ESTRELLA
Address Binding
1.Compile time-Particular space program will be loaded until the time program
will be residing
3.Execution
Memory Allocation
• Is the process of setting aside sections of memory in a program to be used
to store variables, and instances of structures and classes
Static Memory
• Memory allocated during compile time is called static memory.
• The memory allocated is fixed and cannot be increased or decrease during
run time.
Int main ()
{ int arr [5] =
{ 1,2,3,4,5};
}
Dynamic Memory
1. Swapping
2. Paging
3. Segmentation
Swapping
• When a process is executed, it must have resided in memory. Swapping is a process of swapping a
process temporarily into a secondary memory from the main memory, which is fast compared to
secondary memory. A swapping allows more processes to be run and can be fit into memory at one
time.
• The main part of swapping is transferred time and the total time is directly proportional to the amount
of memory swapped. Swapping is also known as roll-out, or roll in because if a higher priority process
arrives and wants service, the memory manager can swap out the lower priority process and then load
and execute the higher priority process. After finishing higher priority work, the lower priority process
swapped back in memory and continued to the execution process. The swapping technique is useful
when larger program is to be executed or some operations have to performed on a large file.
Paging
• The CPU uses segment tables in combination with segment registers. The CPU
utilizes the segment entry value to search for the relevant record in the segment
table when a program reads memory to identify the address to begin and the
dimensions of the section being addressed.
Memory Fragmentation
• Fragmentation is an unwanted problem in the operating system in which the processes are
loaded and unloaded from memory, and free memory space is fragmented. Processes can't
be assigned to memory blocks due to their small size, and the memory blocks stay unused.
• Contiguous memory allocation allocates space to processes whenever the processes enter
RAM. These RAM spaces are divided either by fixed partitioning or by dynamic
partitioning. As the process is loaded and unloaded from memory, these areas are
fragmented into small pieces of memory that cannot be allocated to coming processes.
Causes of Fragmentation
• User processes are loaded and unloaded from the main memory, and
processes are kept in memory blocks in the main memory. Many spaces
remain after process loading and swapping that another process cannot
load due to their size. Main memory is available, but its space is
insufficient to load another process because of the dynamical allocation of
main memory processes.
Types of Fragmentation
There are mainly two types of fragmentation in the operating system. These
are as follows:
1. Internal Fragmentation
2. External Fragmentation
• Internal Fragmentation
• The problem of internal fragmentation may arise due to the fixed sizes of
the memory blocks. It may be solved by assigning space to the process via
dynamic partitioning. Dynamic partitioning allocates only the amount of
space requested by the process. As a result, there is no internal
fragmentation.
• External Fragmentation