pratima fragmentation

8
FRAGMENTATION BY PRATIMA SHARMA ASSISTANT PROFESSOR ww.advanced.edu.in

Upload: pratima-sharma

Post on 16-Apr-2017

228 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: Pratima fragmentation

FRAGMENTATIONBYPRATIMA SHARMAASSISTANT PROFESSOR

www.advanced.edu.in

Page 2: Pratima fragmentation

Fragmentation 1. Fragmentation occurs when memory is allocated dynamically .

2. When a process arrives it gets the desired memory from the block of available memory known as Hole.

3. As processes are loaded and removed from memory the hole is divided into small pieces known as fragments.

For example

Consider the available memory(Hole) is of 16 kb. Three Processes P1,P2,P3 of 4,6,2kb respectively loaded into the memory.

As they come they break 16kb memory into 4 fragments of size 4,6,2kb occupied by three processes and one fragment of free space i.e. 4kb.

www.advanced.edu.in

Page 3: Pratima fragmentation

Diagram showing Fragmentation

Memory (16 kb) Memory is divided into 4 fragments

This diagram shows how fragments are formed

www.advanced.edu.in

P1(4kb)

P2(6kb)

P3(2kb)

Free space(4kb)

Page 4: Pratima fragmentation

External Fragmentation

www.advanced.edu.in

1. External Fragmentation occurs when there is enough total memory space to satisfy the request of coming process but the available space is not contiguous.

2. For example consider the previous problem in this if process P1 is removed from the memory .

3. The space that was occupied by P1 is now free.

4. Now we have two free fragments of 4kb each.

5. Total free space available is 8 kb .

We have 8 kb free space. If a process P5 of 6kb comes, than also we cant provide space to that process because that 8kb free space is not contiguous. And P5 requires 6kb consecutively.

Page 5: Pratima fragmentation

General example of this problem can also be seen as space between two vehicles that is wasted.

www.advanced.edu.in

Free Space(4kb)

P2(6kb)

P3(2kb)

Free space(4kb)

8kb free space is there but request of Process P5 can’t be fulfill as memory is not consecutively free. So this problem waste the main memory.

Page 6: Pratima fragmentation

Solution to External Fragmentation Problem

www.advanced.edu.in

1. Compaction: In this method shuffling of memory is done such that all occupied memory is gather at one place and free memory at other end. But this solution is difficult to implement practically.

2. Use Non-Contiguous Memory in place of Contiguous Memory this can be done by

(a) Paging

(b) Segmentation

Page 7: Pratima fragmentation

Internal FragmentationInternal Fragmentation is the wastage of memory within the fragment that is allotted to the process.

For example Consider if a Process P6 is of 2kb and we have free space fragment of 4kb .Then 2kb is wasted as the P6 occupied that fragment which is only of 2kb.Such wastage of Memory is called Internal Fragmentation

P6(2kb)Free

space(2kb)

Internal Fragmentation

www.advanced.edu.in

Page 8: Pratima fragmentation

Pratima Sharma

Assistant Professor

[email protected]

Advanced Educational Institutions,70 km Milestone,

Delhi-Mathura Road, Dist. Palwal, Haryana-121105

+91–1275–398400, 302222www.advance.edu.in

www.advanced.edu.in