0% found this document useful (0 votes)
61 views5 pages

Relocation and External Fragmentation

Relocation in operating systems allows processes to be moved in memory during execution for efficient memory utilization and flexibility. External fragmentation occurs when free memory is scattered, making it difficult to allocate large contiguous spaces, often requiring solutions like paging and compaction. Together, relocation can help mitigate the effects of external fragmentation by consolidating free memory.

Uploaded by

Fatima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views5 pages

Relocation and External Fragmentation

Relocation in operating systems allows processes to be moved in memory during execution for efficient memory utilization and flexibility. External fragmentation occurs when free memory is scattered, making it difficult to allocate large contiguous spaces, often requiring solutions like paging and compaction. Together, relocation can help mitigate the effects of external fragmentation by consolidating free memory.

Uploaded by

Fatima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Relocation and External Fragmentation: Comprehensive Notes

1. Relocation

1.1 Definition

Relocation in operating systems refers to the ability to move processes within memory during their
execution. It allows efficient utilization of memory by dynamically adjusting the physical location of
processes.

1.2 Need for Relocation

1. Dynamic Process Allocation:

o Processes may need to be moved to different memory locations to accommodate new


processes or free memory space.

2. Efficient Memory Utilization:

o Enables better use of available memory by reorganizing processes.

3. Flexibility:

o Ensures that a process can execute irrespective of its initial location in memory.

1.3 How Relocation Works

1. Logical and Physical Addresses:

o Processes generate logical addresses, which are translated into physical addresses by
the memory management unit (MMU).

2. Relocation Register:

o A hardware register stores the base address of a process. Logical addresses are added to
the relocation register to compute the physical address.

3. Dynamic vs. Static Relocation:

o Static Relocation: Done before execution; the process remains in the same memory
location.

o Dynamic Relocation: Performed during execution, allowing processes to move.

1.4 Example of Relocation

• Process A starts at logical address 0. Its relocation register is set to 1000.


• Logical Address: 120 → Physical Address: 1000 + 120 = 1120.

1.5 Diagram: Relocation Process

2. External Fragmentation

2.1 Definition

External fragmentation occurs when free memory is scattered into small, non-contiguous blocks, making
it challenging to allocate large contiguous memory spaces even though sufficient total free memory
exists.

2.2 Causes of External Fragmentation

1. Dynamic Memory Allocation:

o Processes of varying sizes are allocated memory dynamically.

2. Process Termination:

o When a process finishes, it leaves a memory hole, leading to fragmentation.

3. Non-contiguous Allocation:

o Fixed-sized partitions exacerbate fragmentation.

2.3 Effects of External Fragmentation

1. Wasted Memory:

o Significant memory may remain unused despite being free.

2. Reduced Performance:

o Allocation of new processes becomes slower and inefficient.

3. Compaction Overhead:

o Requires compaction to reduce fragmentation, which is resource-intensive.

2.4 Solutions to External Fragmentation

1. Paging and Segmentation:

o Eliminates the need for contiguous allocation.


2. Compaction:

o Reorganizes memory by moving processes to consolidate free memory.

3. Buddy System:

o Allocates memory in blocks that are powers of two, reducing fragmentation.

2.5 Example of External Fragmentation

1. Memory Size: 1000 KB

2. Processes:

o Process A: 300 KB (allocated)

o Process B: 200 KB (allocated)

o Process C: 100 KB (allocated)

3. Process A terminates, leaving a 300 KB hole.

4. New Process D requires 350 KB, but cannot be allocated because the 300 KB hole is insufficient,
and memory is non-contiguous.

2.6 Diagram: External Fragmentation

3. Relocation and External Fragmentation in Context

3.1 Relocation Solves Fragmentation

Relocation can mitigate external fragmentation by dynamically moving processes to consolidate free
memory.

3.2 Example: Relocation with Fragmentation

1. Initial State:
2. After Relocation:

4. Real-World Applications

1. Operating Systems:

o Relocation is widely used in systems with dynamic memory allocation, like Windows and
Linux.

2. Memory Compaction:

o Some embedded systems use compaction to address fragmentation.

3. Paging Systems:

o Virtual memory with paging eliminates external fragmentation entirely.

5. Figures and Diagrams

Figure 1: Relocation Process

Figure 2: External Fragmentation


6. Summary

Aspect Relocation External Fragmentation

Definition Moving processes during execution. Scattered free memory blocks.

Problem Solved Allows dynamic memory allocation. Reduces wasted memory.

Solution Uses relocation registers. Paging, segmentation, compaction.

Impact Improves flexibility. Decreases memory utilization.

You might also like