0% found this document useful (0 votes)
18 views21 pages

Unit 6

The document discusses file management in operating systems, covering the definition of computer files, file systems, and their functions such as creation, organization, backup, and recovery. It also explains different directory structures (single-level, two-level, tree-structured) and types of file systems (simple, basic, physical, logical). Additionally, it outlines file allocation methods including continuous, linked, and indexed allocation, highlighting their advantages and characteristics.

Uploaded by

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

Unit 6

The document discusses file management in operating systems, covering the definition of computer files, file systems, and their functions such as creation, organization, backup, and recovery. It also explains different directory structures (single-level, two-level, tree-structured) and types of file systems (simple, basic, physical, logical). Additionally, it outlines file allocation methods including continuous, linked, and indexed allocation, highlighting their advantages and characteristics.

Uploaded by

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

UNIT-6

FILE MANAGEMENT
 A computer file is defined as a medium used for
saving and managing data in the computer system.

 The data stored in the computer system is


completely in digital format, although there can be
various types of files that help us to store the data.

 A file system is a method an operating system uses to


store, organize, and manage files and directories on a
storage device.
Functions of File Management in Operating System

 File creation: Creating new files and folders for storing data.

 File organization: Organizing files and folders in a logical and


efficient manner, such as grouping related files together in a common
folder.

 File backup: Creating copies of important files to prevent data loss in


case of hardware failure or other issues.

 File search: Finding files quickly and easily by searching for keywords
or file attributes such as date created or file size.

 File compression: Reducing the size of files to save disk space or to


make them easier to transfer over the internet.
 File encryption: Protect files from unauthorized access by encrypting
them with a password or other security measures.

 File sharing: Allowing multiple users to access and edit the same file
simultaneously or share files with other devices on a network.

 File deletion: Removing files or folders from the storage device to free
up space.

 File recovery: Restoring files that have been accidentally deleted or


lost due to system crashes or other issues.

 File permissions: Setting access controls for files and folders to


determine who can read, write, or execute them.
File Directories

 The collection of files is a file directory.

 The directory contains information about the files,


including attributes, location, and ownership.

 Much of this information, especially that is concerned with


storage, is managed by the operating system.
Single-Level Directory

 Naming problem: Users cannot have the same


name for two files.
 Grouping problem: Users cannot group files
according to their needs.
Two-Level Directory

 Path name: Due to two levels there is a path name for


every file to locate that file.
 Now, we can have the same file name for different users.
 Searching is efficient in this method.
Tree-Structured Directory

 The directory is maintained in the form of a tree. Searching


is efficient and also there is grouping capability. We have
absolute or relative path name for a file.
Types of File System

 Simple file system


 Basic file system
 Physical file system
 Logical file system
Simple file system

 Design & implement a simple file system is easy.

 The simple file system handles a single application at


any given time.

 Does not support protection of files.

 It contains limited length file names, limited length


file extensions, no subdirectories.
Basic file system

 It Issues general commands to the device driver to


read and write physical blocks on disk.

 It manages the memory buffers and caches.

 A block in the buffer can hold the contents of the


disk block and the cache stores frequently used file
system metadata.
Physical file system:

 Physical files contain the actual data that is stored on an iSeries


system, and a description of how data is to be presented to or
received from a program.

 Records in database files can be described using either a field-level


description or a record-level description.

 A field-level description describes the fields in the record to the


system. Database files that are created with field-level descriptions
are referred to as externally described files.

 A record-level description describes only the length of the record,


and not the contents of the record. Database files that are created
with record-level descriptions are referred to as program-described
files.
Logical file system:

 Logical files do not contain data. They contain a description of records that
are found in one or more physical files.

 A logical file is a view or representation of one or more physical files.

 Logical files that contain more than one format are referred to as multi-
format logical files.

 If your program processes a logical file that contains more than one record
format, you can use the _Rformat() function to set the format you wish to
use.

 Some operations cannot be performed on logical files. If you open a logical


file for stream file processing with open modes W, W+, WB, or WB+, the
file is opened.
File Allocation Methods

 Continuous Allocation
 Linked Allocation(Non-contiguous allocation)
 Indexed Allocation
Continuous Allocation

 A single continuous set of blocks is allocated to a file at


the time of file creation.
 Thus, this is a pre-allocation strategy, using variable size
portions.
 The file allocation table needs just a single entry for each
file, showing the starting block and the length of the file.
 This method is best from the point of view of the
individual sequential file.
 Multiple blocks can be read in at a time to improve I/O
performance for sequential processing. It is also easy to
retrieve a single block.
Example

 For example, if a file starts at block b, and the ith


block of the file is wanted, its location on secondary
storage is simply b+i-1.
Linked Allocation(Non-Contiguous Allocation)

 Allocation is on an individual block basis. Each block contains a pointer to


the next block in the chain.

 Again the file table needs just a single entry for each file, showing the
starting block and the length of the file.

 Although pre-allocation is possible, it is more common simply to allocate


blocks as needed.

 Any free block can be added to the chain. The blocks need not be
continuous.

 An increase in file size is always possible if a free disk block is available.


There is no external fragmentation because only one block at a time is
needed but there can be internal fragmentation but it exists only in the last
disk block of the file.
Indexed Allocation

 It addresses many of the problems of contiguous and


chained allocation.
 In this case, the file allocation table contains a
separate one-level index for each file:
 The index has one entry for each block allocated to
the file.
 The allocation may be on the basis of fixed-size
blocks or variable-sized blocks. Allocation by blocks
eliminates external fragmentation, whereas
allocation by variable-size blocks improves locality.

You might also like