SlideShare a Scribd company logo
1 of 29
Free Space Management




                        http://raj-os.blogspot.in/   1
HOME     PREVIOUS TOPIC NEXT
PREVIOUS QUESTION PAPERS FOR OS
CPP TUTORIALS




        http://raj-os.blogspot.in/   2
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

                       http://raj-os.blogspot.in/        3
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




                        http://raj-os.blogspot.in/   4
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
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
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
Various Implementations of Free Space List

• Bit Vector


• Linked List


• Grouping


• Counting


                 http://raj-os.blogspot.in/    8
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
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
Bit Vector (n blocks)

           0 1 2                                 n-1
                                         …
                    0 ⇒ block[i] free
         bit[i] =
                    1 ⇒ block[i] occupied


Block number calculation

  (number of bits per word) *
  (number of 0-value words) +
  offset of first 1 bit
                    http://raj-os.blogspot.in/         11
Bit Vector

• 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


                 http://raj-os.blogspot.in/       12
Bit Vector

• Advantage:

  – Relatively Simple and Efficient

  – Easy to get contiguous files




                    http://raj-os.blogspot.in/   13
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
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
                      http://raj-os.blogspot.in/     15
Fig 1
Linked free space list on disk
         http://raj-os.blogspot.in/   16
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
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
Block No     Block No                             Block No
Block No     Block No                             Block No
    .                                                .
                .                           ...      .
    .           .                                    .


Block No     Block No                             Block No


First Free
  block
                    Fig 2

                      Grouping


                    http://raj-os.blogspot.in/               19
Grouping

• Advantage

  – Large number of free blocks can be found quickly




                   http://raj-os.blogspot.in/      20
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
Counting

• Entry in a free space list consists of

   – Disk address

   – Count




                    http://raj-os.blogspot.in/   22
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



                   http://raj-os.blogspot.in/           23
Summary

In this class, you have learnt:
• What is free space management

• Various free space management techniques




                    http://raj-os.blogspot.in/   24
Frequently asked questions

1. Explain the need for free space management

2. List the various implementations of free space list

3. Explain bit vector




                     http://raj-os.blogspot.in/          25
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



                         http://raj-os.blogspot.in/               26
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
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
Other subject materials

•   Web designing
•   Micro processors
•   C++ tutorials
•   java

home


                 http://raj-os.blogspot.in/   29

More Related Content

What's hot

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithmsPiyush Rochwani
 
Disk scheduling algorithms
Disk scheduling algorithms Disk scheduling algorithms
Disk scheduling algorithms Paresh Parmar
 
Free Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSFree Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSUnited International University
 
Index allocation 48 1
Index allocation 48 1Index allocation 48 1
Index allocation 48 1myrajendra
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating SystemJanki Shah
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating systemPrankit Mishra
 
Allocation methods continuous method.47
Allocation methods continuous method.47 Allocation methods continuous method.47
Allocation methods continuous method.47 myrajendra
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43myrajendra
 
Distributed Processing
Distributed ProcessingDistributed Processing
Distributed ProcessingImtiaz Hussain
 

What's hot (20)

Demand paging
Demand pagingDemand paging
Demand paging
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Memory management
Memory managementMemory management
Memory management
 
Page Replacement
Page ReplacementPage Replacement
Page Replacement
 
File Allocation Methods.ppt
File Allocation Methods.pptFile Allocation Methods.ppt
File Allocation Methods.ppt
 
Disk scheduling algorithms
Disk scheduling algorithms Disk scheduling algorithms
Disk scheduling algorithms
 
Directory structure
Directory structureDirectory structure
Directory structure
 
Free Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSFree Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFS
 
Index allocation 48 1
Index allocation 48 1Index allocation 48 1
Index allocation 48 1
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
Mapping
MappingMapping
Mapping
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
 
Allocation methods continuous method.47
Allocation methods continuous method.47 Allocation methods continuous method.47
Allocation methods continuous method.47
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
 
Distributed Processing
Distributed ProcessingDistributed Processing
Distributed Processing
 
Shell programming
Shell programmingShell programming
Shell programming
 
Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
 

Similar to Free space managment46

Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58myrajendra
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56myrajendra
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space managementrajshreemuthiah
 
Disk structure.45
Disk structure.45Disk structure.45
Disk structure.45myrajendra
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.pptBUSHRASHAIKH804312
 
File implementation
File implementationFile implementation
File implementationMohd Arif
 
cache memory introduction, level, function
cache memory introduction, level, functioncache memory introduction, level, function
cache memory introduction, level, functionTeddyIswahyudi1
 
files,indexing,hashing,linear and non linear hashing
files,indexing,hashing,linear and non linear hashingfiles,indexing,hashing,linear and non linear hashing
files,indexing,hashing,linear and non linear hashingRohit Kumar
 
Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02Seshu Chakravarthy
 
Plam15 slides.potx
Plam15 slides.potxPlam15 slides.potx
Plam15 slides.potxVlad Lesin
 
Cache Memory for Computer Architecture.ppt
Cache Memory for Computer Architecture.pptCache Memory for Computer Architecture.ppt
Cache Memory for Computer Architecture.pptrularofclash69
 

Similar to Free space managment46 (20)

Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58Issues in acyclic graph directories.57 to 58
Issues in acyclic graph directories.57 to 58
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
 
OS Unit5.pptx
OS Unit5.pptxOS Unit5.pptx
OS Unit5.pptx
 
Disk structure.45
Disk structure.45Disk structure.45
Disk structure.45
 
10. ROS (1).pptx
10. ROS (1).pptx10. ROS (1).pptx
10. ROS (1).pptx
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.ppt
 
cache memory
cache memorycache memory
cache memory
 
File implementation
File implementationFile implementation
File implementation
 
04 cache memory
04 cache memory04 cache memory
04 cache memory
 
cache memory introduction, level, function
cache memory introduction, level, functioncache memory introduction, level, function
cache memory introduction, level, function
 
CAO-Unit-III.pptx
CAO-Unit-III.pptxCAO-Unit-III.pptx
CAO-Unit-III.pptx
 
files,indexing,hashing,linear and non linear hashing
files,indexing,hashing,linear and non linear hashingfiles,indexing,hashing,linear and non linear hashing
files,indexing,hashing,linear and non linear hashing
 
Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02
 
Plam15 slides.potx
Plam15 slides.potxPlam15 slides.potx
Plam15 slides.potx
 
04 cache memory
04 cache memory04 cache memory
04 cache memory
 
04 cache memory
04 cache memory04 cache memory
04 cache memory
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
File system implementation
File system implementationFile system implementation
File system implementation
 
Cache Memory for Computer Architecture.ppt
Cache Memory for Computer Architecture.pptCache Memory for Computer Architecture.ppt
Cache Memory for Computer Architecture.ppt
 

More from myrajendra (20)

Fundamentals
FundamentalsFundamentals
Fundamentals
 
Data type
Data typeData type
Data type
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Jdbc workflow
Jdbc workflowJdbc workflow
Jdbc workflow
 
2 jdbc drivers
2 jdbc drivers2 jdbc drivers
2 jdbc drivers
 
3 jdbc api
3 jdbc api3 jdbc api
3 jdbc api
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Dao example
Dao exampleDao example
Dao example
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
Internal
InternalInternal
Internal
 
3. elements
3. elements3. elements
3. elements
 
2. attributes
2. attributes2. attributes
2. attributes
 
1 introduction to html
1 introduction to html1 introduction to html
1 introduction to html
 
Headings
HeadingsHeadings
Headings
 
Forms
FormsForms
Forms
 
Css
CssCss
Css
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Starting jdbc
Starting jdbcStarting jdbc
Starting jdbc
 

Free space managment46

  • 1. Free Space Management http://raj-os.blogspot.in/ 1
  • 2. HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS http://raj-os.blogspot.in/ 2
  • 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 http://raj-os.blogspot.in/ 3
  • 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 http://raj-os.blogspot.in/ 4
  • 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. 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. 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. Various Implementations of Free Space List • Bit Vector • Linked List • Grouping • Counting http://raj-os.blogspot.in/ 8
  • 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. 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. Bit Vector (n blocks) 0 1 2 n-1 … 0 ⇒ block[i] free bit[i] = 1 ⇒ block[i] occupied Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit http://raj-os.blogspot.in/ 11
  • 12. Bit Vector • 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 http://raj-os.blogspot.in/ 12
  • 13. Bit Vector • Advantage: – Relatively Simple and Efficient – Easy to get contiguous files http://raj-os.blogspot.in/ 13
  • 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. 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 http://raj-os.blogspot.in/ 15
  • 16. Fig 1 Linked free space list on disk http://raj-os.blogspot.in/ 16
  • 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. 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. Block No Block No Block No Block No Block No Block No . . . ... . . . . Block No Block No Block No First Free block Fig 2 Grouping http://raj-os.blogspot.in/ 19
  • 20. Grouping • Advantage – Large number of free blocks can be found quickly http://raj-os.blogspot.in/ 20
  • 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. Counting • Entry in a free space list consists of – Disk address – Count http://raj-os.blogspot.in/ 22
  • 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 http://raj-os.blogspot.in/ 23
  • 24. Summary In this class, you have learnt: • What is free space management • Various free space management techniques http://raj-os.blogspot.in/ 24
  • 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 http://raj-os.blogspot.in/ 25
  • 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 http://raj-os.blogspot.in/ 26
  • 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. 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. Other subject materials • Web designing • Micro processors • C++ tutorials • java home http://raj-os.blogspot.in/ 29