0% found this document useful (0 votes)
8 views

File System Structure1

file system structure - operating system

Uploaded by

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

File System Structure1

file system structure - operating system

Uploaded by

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

File System Structure

• Different layers of f.s


1. Store
2. Retrieve
3. Access

File system Structure


user – name, attributes, operations, directories,
internal – logical to physical
• Application – ppt
• Logical – metadata, directory
structure, file control block
• File org module – information about
files, logical and physical blocks,
translation of log to phy, free space
management
• Basic f.s – issue generic comments to
device driver, memory buffer and
cache management
• i/o control – device driver, interrupt
handler
• Devices – physical devices
File System
Implementation
To implement a file structure we need these in disk
• Boot control block – when system boots
• Volume control block – no of free blocks, used , total block size,…
• Directory structure – all files basic information
File control block
• Boot Control Block
• Boot Control Block contains all the information which is needed to boot an
operating system from that volume. It is called boot block in UNIX file system. In
NTFS, it is called the partition boot sector.
• Volume Control Block
• Volume control block all the information regarding that volume such as number of
blocks, size of each block, partition table, pointers to free blocks and free FCB
blocks. In UNIX file system, it is known as super block. In NTFS, this information is
stored inside master file table.
• Directory Structure (per file system)
• A directory structure (per file system) contains file names and pointers to
corresponding FCBs. In UNIX, it includes inode numbers associated to file names.
• File Control Block
• File Control block contains all the details about the file such as
ownership details, permission details, file size,etc. In UFS, this detail is
stored in inode. In NTFS, this information is stored inside master file
table as a relational database structure. A typical file control block is
shown in the image below.
The in-memory data structures are used for file system management as well as performance improvement
via caching. This information is loaded on the mount time and discarded on ejection.
• In-memory Mount Table
In-memory mount table contains the list of all the devices which are being mounted to the system.
Whenever the connection is maintained to a device, its entry will be done in the mount table.
• In-memory Directory structure cache
This is the list of directory which is recently accessed by the CPU. The directories present in the list can also
be accessed in the near future so it will be better to store them temporally in cache.
• System-wide open file table
This is the list of all the open files in the system at a particular time. Whenever the user open any file for
reading or writing, the entry will be made in this open file table.
• Per process Open file table
It is the list of open files subjected to every process. Since there is already a list which is there for every
open file in the system thereforeIt only contains Pointers to the appropriate entry in the system wide table.
In memory file system structure
a)file open b)file read
Directory implementation
• Linear list
• Search – difficult
• Linked list

• Hash table
• Optimized
• Decreased directory search time

• Adv – entries fixed size – hash table works well


• Disadv
• Collision
Allocation methods
• Contiguous allocation
• Linked allocation
• Indexed allocation
Contiguous allocation
• Continuous set of blocks
• Head movements very low – adv
• Direct access/ sequential access?
• Direct –
• List – 28,29,30,31
• Can access 30
• Disadv – external fragmentation
• Compaction
• Compaction overhead

• Space needed not known in advance


• To overcome this – low space allocate
• If so – error – file size exceeded allocation
• More space allocate – internal
fragmentation
Linked allocation
• Pointers
• 9 start
• Points to next location
• -1 – does not points anything
• Adv
• No external fragmentation
• Disadv
• Need more pointers
• Direct access difficult
• If one pointer fails – access not
possible
FAT
Indexed Allocation
• Memory wastage
• One file – one index blocks
Free space management
1. Bit vector
1. 1- block free(empty)
2. 0 –block occupied

1111000111111001.
2. Linked list
• A linked list can also be used to
keep track of all free blocks.
• Traversing the list and/or finding
a contiguous block of a given size
are not easy, but fortunately are
not frequently needed
operations. Generally the system
just adds and removes single
blocks from the beginning of the
list.
Grouping
• A variation on linked list free lists is to use links of blocks of indices of free blocks. If a block holds up to N addresses, then the first block in the
linked-list contains up to N-1 addresses of free blocks and a pointer to the next block of free addresses.

Counting
• When there are multiple contiguous blocks of free space then the system can keep track of the starting address of the group and the number of
contiguous free blocks. As long as the average length of a contiguous group of free blocks is greater than two this offers a savings in space needed
for the free list. ( Similar to compression techniques used for graphics images when a group of pixels all the same color is encountered. )

Space Maps
• Sun's ZFS file system was designed for HUGE numbers and sizes of files, directories, and even file systems.
• The resulting data structures could be VERY inefficient if not implemented carefully. For example, freeing up a 1 GB file on a 1 TB file system could
involve updating thousands of blocks of free list bit maps if the file was spread across the disk.
• ZFS uses a combination of techniques, starting with dividing the disk up into ( hundreds of ) metaslabs of a manageable size, each having their
own space map.
• Free blocks are managed using the counting technique, but rather than write the information to a table, it is recorded in a log-structured
transaction record. Adjacent free blocks are also coalesced into a larger single free block.
• An in-memory space map is constructed using a balanced tree data structure, constructed from the log data.
• The combination of the in-memory tree and the on-disk log provide for very fast and efficient management of these very large files and free
blocks.
Recovery
• Consistency checking
• Log-structured file systems
• Other solutions
• snapshot
• Backup and restore
• Full backup
• Incremental backup

You might also like