Successfully reported this slideshow.
Upcoming SlideShare
×

Free space managment46

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
• Full Name
Comment goes here.

Are you sure you want to Yes No

Free space managment46

1. 1. Free Space Management http://raj-os.blogspot.in/ 1
2. 2. HOME PREVIOUS TOPIC NEXTPREVIOUS QUESTION PAPERS FOR OSCPP TUTORIALS http://raj-os.blogspot.in/ 2
3. 3. RecapIn 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 http://raj-os.blogspot.in/ 3
4. 4. ObjectivesOn 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 http://raj-os.blogspot.in/ 4
5. 5. Understand Free Space Management• Need for free space management – Limited amount of disk space – Necessary to reuse the space from deleted files http://raj-os.blogspot.in/ 5
6. 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 http://raj-os.blogspot.in/ 6
7. 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 http://raj-os.blogspot.in/ 7
8. 8. Various Implementations of Free Space List• Bit Vector• Linked List• Grouping• Counting http://raj-os.blogspot.in/ 8
9. 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 http://raj-os.blogspot.in/ 9
10. 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…… http://raj-os.blogspot.in/ 10
11. 11. Bit Vector (n blocks) 0 1 2 n-1 … 0 ⇒ block[i] free bit[i] = 1 ⇒ block[i] occupiedBlock number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit http://raj-os.blogspot.in/ 11
12. 12. Bit Vector• Bit map requires extra spaceExample: – Disk Size = 1.3 GB – Block size = 512 bytes – Need a bit map of over 332 KB to track its free blocks http://raj-os.blogspot.in/ 12
13. 13. Bit Vector• Advantage: – Relatively Simple and Efficient – Easy to get contiguous files http://raj-os.blogspot.in/ 13
14. 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 http://raj-os.blogspot.in/ 14
15. 15. Linked Free Space List on DiskExample:• 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 http://raj-os.blogspot.in/ 15
16. 16. Fig 1Linked free space list on disk http://raj-os.blogspot.in/ 16
17. 17. Linked List• Linked list (free list) – Cannot get contiguous space easily – No waste of space – Not efficient for faster access – Substantial I/O http://raj-os.blogspot.in/ 17
18. 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 http://raj-os.blogspot.in/ 18
19. 19. Block No Block No Block NoBlock No Block No Block No . . . ... . . . .Block No Block No Block NoFirst Free block Fig 2 Grouping http://raj-os.blogspot.in/ 19
20. 20. Grouping• Advantage – Large number of free blocks can be found quickly http://raj-os.blogspot.in/ 20
21. 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 count http://raj-os.blogspot.in/ 21
22. 22. Counting• Entry in a free space list consists of – Disk address – Count http://raj-os.blogspot.in/ 22
23. 23. CountingConstraints: • 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 http://raj-os.blogspot.in/ 23
24. 24. SummaryIn this class, you have learnt:• What is free space management• Various free space management techniques http://raj-os.blogspot.in/ 24
25. 25. Frequently asked questions1. Explain the need for free space management2. List the various implementations of free space list3. Explain bit vector http://raj-os.blogspot.in/ 25
26. 26. Frequently Asked Questions4. Explain the following free space management techniquesa) linked listb) Groupingc) Counting5. Write the advantages and disadvantages of linked list method of free space management http://raj-os.blogspot.in/ 26
27. 27. Quiz• To keep track of disk space the system maintains Free space list• Bit map requires extra space [T/F] True http://raj-os.blogspot.in/ 27
28. 28. Quiz• In Linked allocation it is easy to get the contiguous space [T/F] False• In Counting it is easy to get the contiguous space [T/F] True http://raj-os.blogspot.in/ 28
29. 29. Other subject materials• Web designing• Micro processors• C++ tutorials• javahome http://raj-os.blogspot.in/ 29