free space managment46
Post on 21-Oct-2014
2.426 views
DESCRIPTION
TRANSCRIPT
![Page 1: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/1.jpg)
http://raj-os.blogspot.in/ 1
Free Space Management
![Page 2: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/2.jpg)
http://raj-os.blogspot.in/ 2
HOME PREVIOUS TOPIC NEXTPREVIOUS QUESTION PAPERS FOR OSCPP TUTORIALS
![Page 3: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/3.jpg)
http://raj-os.blogspot.in/ 3
Recap
In the last class, you have learnt:
• Secondary memory, types of secondary memory
• Various types of heads, advantages of one over other
• Techniques for increasing storage capacity
• Characteristics of the disk
![Page 4: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/4.jpg)
http://raj-os.blogspot.in/ 4
Objectives
On completion of this period, you would be able to
know
• Need for free space management
• Various implementations of free space lists
• Bit vector, Linked list, Grouping, Counting
![Page 5: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/5.jpg)
http://raj-os.blogspot.in/ 5
Understand Free Space Management
• Need for free space management
– Limited amount of disk space
– Necessary to reuse the space from deleted files
![Page 6: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/6.jpg)
http://raj-os.blogspot.in/ 6
Need for Free Space Management
• To keep track of disk space :
– The system maintains a free space list
– The free space list records all disk blocks that are free
![Page 7: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/7.jpg)
http://raj-os.blogspot.in/ 7
File Creation & Deletion
• File creation
– Search the free space list of the required amount of space
– Allocate the space to the new file
– Remove the space from free space list
• File deletion
– Add the disk space to the free space list
![Page 8: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/8.jpg)
http://raj-os.blogspot.in/ 8
Various Implementations of Free Space List
• Bit Vector
• Linked List
• Grouping
• Counting
![Page 9: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/9.jpg)
http://raj-os.blogspot.in/ 9
Bit Vector
• Free space list is implemented as a bit map or bit vector
• If the block is free the bit is set to 1
• If the block is allocated the bit is set to 0
![Page 10: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/10.jpg)
http://raj-os.blogspot.in/ 10
Bit Vector
• Example:
– Consider a disk, where blocks
2,3,4,5,8,9,10,11,12,13,17,18,25,26 & 27 are free
and the rest of the blocks are allocated
– The free-space bit map would be
– 001111001111110001100000011100000……
![Page 11: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/11.jpg)
http://raj-os.blogspot.in/ 11
Bit Vector (n blocks)
…0 1 2 n-1
bit[i] =0 block[i] free
1 block[i] occupied
Block number calculation
(number of bits per word) *(number of 0-value words) +offset of first 1 bit
![Page 12: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/12.jpg)
http://raj-os.blogspot.in/ 12
• Bit map requires extra space
Example:
– Disk Size = 1.3 GB
– Block size = 512 bytes
– Need a bit map of over 332 KB to track its free
blocks
Bit Vector
![Page 13: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/13.jpg)
http://raj-os.blogspot.in/ 13
Bit Vector
• Advantage:
– Relatively Simple and Efficient
– Easy to get contiguous files
![Page 14: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/14.jpg)
http://raj-os.blogspot.in/ 14
Linked List
• Approach
– Link all free disk blocks together
– Keep a pointer to the first free block
– This block contains a pointer to next free block, and so on
14
![Page 15: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/15.jpg)
http://raj-os.blogspot.in/ 15
Linked Free Space List on Disk
Example:
• As shown in figure in the next slide, there is a
• Pointer to block 2, as the first free block
• Block 2 would contain a pointer to block 3,
• Which would point to block 4,
• Which would point 5,8,9,10,11,12,13,17,18,25,26,27
15
![Page 16: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/16.jpg)
http://raj-os.blogspot.in/ 16
Linked free space list on disk Fig 1
16
![Page 17: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/17.jpg)
http://raj-os.blogspot.in/ 17
Linked List
• Linked list (free list)– Cannot get contiguous space easily
– No waste of space
– Not efficient for faster access
– Substantial I/O
17
![Page 18: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/18.jpg)
http://raj-os.blogspot.in/ 18
Grouping
• Approach
– Store addresses of n free blocks in the first free
block
– The first n-1 of these are actually free
– The last block contains the address as of another
free blocks, and so on as shown in the next slide
Fig : 2
18
![Page 19: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/19.jpg)
http://raj-os.blogspot.in/ 19
Grouping
Block No
.
Block No
.
.
Block No
Block No
.
Block No
Block No
Block No
.
.
.
Block No
Block No
. . .
First Free block Fig 2
19
![Page 20: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/20.jpg)
http://raj-os.blogspot.in/ 20
Grouping
• Advantage
– Large number of free blocks can be found quickly
20
![Page 21: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/21.jpg)
http://raj-os.blogspot.in/ 21
Counting
• Approach
– Based on the fact that several contiguous blocks may
be allocated and freed simultaneously
– Holds the address of the first free block and number
“n” of free contiguous blocks that follow the first
block
– Each entry is the free space list consist of a disk
address and a count21
![Page 22: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/22.jpg)
http://raj-os.blogspot.in/ 22
Counting
• Entry in a free space list consists of
– Disk address
– Count
22
![Page 23: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/23.jpg)
http://raj-os.blogspot.in/ 23
Counting
Constraints:
• Each entry requires more space than a simple
disk address
• The overall list will be shorter, as long as the
count is greater than one
23
![Page 24: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/24.jpg)
http://raj-os.blogspot.in/ 24
Summary
In this class, you have learnt:
• What is free space management
• Various free space management techniques
24
![Page 25: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/25.jpg)
http://raj-os.blogspot.in/ 25
Frequently asked questions
1. Explain the need for free space management
2. List the various implementations of free space list
3. Explain bit vector
25
![Page 26: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/26.jpg)
http://raj-os.blogspot.in/ 26
Frequently Asked Questions
4. Explain the following free space management techniques
a) linked list
b) Grouping
c) Counting
5. Write the advantages and disadvantages of linked list method
of free space management
26
![Page 27: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/27.jpg)
http://raj-os.blogspot.in/ 27
Quiz
• To keep track of disk space the system maintains
• Bit map requires extra space [T/F]
Free space list
True
![Page 28: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/28.jpg)
http://raj-os.blogspot.in/ 28
Quiz
• In Linked allocation it is easy to get the contiguous space [T/F]
• In Counting it is easy to get the contiguous space [T/F]
False
True
28
![Page 29: Free space managment46](https://reader034.vdocuments.site/reader034/viewer/2022051512/54473686afaf9f59178b498d/html5/thumbnails/29.jpg)
Other subject materials
• Web designing
• Micro processors
• C++ tutorials
• java
home
29http://raj-os.blogspot.in/