File System
FILE CONCEPT
 FILE
 A file is a named collection of related information that is recorded on secondary storage.
 The information in a file is defined by its creator.
 Many different types of information may be stored in a file source programs, object
programs, executable programs, numeric data, text, payroll records, graphic images,
sound recordings, and so on.
 A file has a certain defined which depends on its type.
 A text file is a sequence of characters organized into lines.
 A source file is a sequence of subroutines and functions, each of which is further
organized as declarations followed by executable statements.
 An object file is a sequence of bytes organized into blocks understandable by the
system's linker.
 An executable file is a series of code sections that the loader can bring into memory
and execute.
File Attributes
 A file is named, for the convenience of its human users, and is referred to by its name.
A name is usually a string of characters, such as example.c
 When a file is named, it becomes independent of the process, the user, and even the
system that created it.
 A file's attributes vary from one operating system to another but typically consist
of these:
 Name: The symbolic file name is the only information kept in human readable
form.
 Identifier: This unique tag, usually a number, identifies the file within the file
system; it is the non-human-readable name for the file.
 Type: This information is needed for systems that support different types of files.
 Location: This information is a pointer to a device and to the location of
the file on that device.
 Size: The current size of the file (in bytes, words, or blocks) and possibly
the maximum allowed size are included in this attribute.
 Protection: Access-control information determines who can do reading,
writing, executing, and so on.
 Time, date, and user identification: This information may be kept for
creation, last modification, and last use. These data can be useful for
protection, security, and usage monitoring.
File Operations
 A file is an abstract data type. To define a file properly, we need to consider
the operations that can be performed on files.
 Creating a file: Two steps are necessary to create a file,
 Space in the file system must be found for the file.
 An entry for the new file must be made in the directory.
 Writing a file: To write a file, we make a system call specifying both the
name of the file and the information to be written to the file.
 Given the name of the file, the system searches the directory to find the file's
location.
 The system must keep a write pointer to the location in the file where the next
write is to take place.
 The write pointer must be updated whenever a write occurs.
 Reading a file:
 To read from a file, we use a system call that specifies the name of the file and where
the data should be placed after reading.
 Again, the directory is searched for the associated entry, and the system needs to keep a
read pointer to the location in the file where the next read is to take place.
 Once the read has taken place, the read pointer is updated.
 Because a process is usually either reading from or writing to a file, the current
operation location can be kept as a per-process current file-position pointer.
 Repositioning within a file:
 The directory is searched for the appropriate entry, and the current-file-
position pointer is repositioned to a given value. Repositioning within a
file need not involve any actual I/0. This file operation is also known as
files seek.
 Deleting a file:
 To delete a file, search the directory for the named file. Having found the
associated directory entry, then release all file space, so that it can be
reused by other files, and erase the directory entry.
 Truncating a file:
 The user may want to erase the contents of a file but keep its attributes.
Rather than forcing the user to delete the file and then recreate it, this
function allows all attributes to remain unchanged but lets the file be reset
to length zero and its file space released.
 Other common operations include appending new information to the end of an
existing file and renaming an existing file.
 Most of the file operations mentioned involve searching the directory for the entry
associated with the named file.
 To avoid this constant searching, many systems require that an open () system call be
made before a file is first used actively.
 The operating system keeps a small table, called the open file table containing
information about all open files. When a file operation is requested, the file is
specified via an index into this table, so no searching is required.
 The implementation of the open() and close() operations is more complicated in an
environment where several processes may open the file simultaneously
 The operating system uses two levels of internal tables:
 A per-process table
 A system-wide table
 The per-process table:
 The per-process table tracks all files that a specific process has opened. This
table contains information about how each file is used by the process.
 Each entry in the per-process table in turn points to a system-wide open-file
table.
 The system-wide table
 contains process-independent information, such as the location of the file on disk,
access dates, and file size. Once a file has been opened by one process, the system-
wide table includes an entry for the file.
operating system notes for file managment.pptx
Several pieces of information are associated with an open file.
1. File pointer: On systems that do not include a file offset as part of the read() and write()
system calls, the system must track the last read write location as a current- file-position
pointer. This pointer is unique to each process operating on the file and therefore must be
kept separate from the on-disk file attributes.
2. File-open count: As files are closed, the operating system must reuse its open- file table
entries, or it could run out of space in the table. Because multiple processes may have
opened a file, the system must wait for the last file to close before removing the open-file
table entry. The file-open counter tracks the number of opens and closes and reaches zero
on the last close. The system can then remove the entry.
3. Disk location of the file:Most file operations require the system to modify data within the
file. The information needed to locate the file on disk is kept in memory so that the system
does not have to read it from disk for each operation.
4. Access rights: Each process opens a file in an access mode. This information is stored on
the per-process table so the operating system can allow or deny subsequent I/0 requests.
Access methods
 Sequential methods
 The simplest access method is sequential methods. Information in the file is processed
in linear order i.e. one record after the other.
 The majority of operations performed on a file are reading and writing. These
operations manipulate the file data in a sequential manner.
 A read operation known as “next-reads” reads the next part of the file. This operation
advances the file pointer automatically, which tracks the current position in the file.
 The write operation known as “write next” appends new data to the end of the file.
After writing, the file pointer moves to the end of the newly written data.
 The file can be reset to the beginning, usually to start processing the file from the start
again.
 Some systems allow the program to skip forward or backward by a specific number of
records, denoted by an integer n. This might be limited to n=1 on some systems
operating system notes for file managment.pptx
2. Direct Access
 A file is made up of fixed length logical records that allow programs to read and write
records rapidly in no particular order.
 The direct-access method is based on a disk model of a file, since disks allow
random access to any file block. For direct access, the file is viewed as a numbered
sequence of blocks or records.
 Example: if we may read block 14, then read block 53, and then write block 7.
There are no restrictions on the order of reading or writing for a direct-access file.
 Direct-access files are of great use for immediate access to large amounts of information
such as Databases, where searching becomes easy and fast.
 For the direct-access method, file operations need to be modified to include the block
number as a parameter. Instead of "read next" or "write next", operations become "read n"
or "write n", where n is the block number.
𝑛
 Another approach is to retain "read next" and "write next" operations as with sequential
access, and add an operation "position file to n", where n is the block number. Then, to
𝑛
read block n, the program would position to n and then read next.
𝑛 𝑛
operating system notes for file managment.pptx
Other Access Methods: Indexed sequential
 Other access methods can be built on top of a direct-access method. These methods
generally involve the construction of an index for the file.
 The Index, is like an index in the back of a book contains pointers to the various
blocks.
 To find a record in the file, we first search the index and then use the pointer to access
the file directly and to find the desired record.
Directory Structure
 The most common schemes for defining the logical structure of a directory are
described below
1. Single-level Directory
2. Two-Level Directory
3. Tree-Structured Directories
4. Acyclic-Graph Directories
5. General Graph Directory
1. Single-level Directory
 The simplest directory structure is the single-level directory.
 All files are contained in the same directory, which is easy to support and understand
 A single-level directory has significant limitations, when the number of files increases
or when the system has more than one user.
 As directory structure is single, uniqueness of file name has to be maintained, which is
difficult when there are multiple users.
 Even a single user on a single-level directory may find it difficult to remember the
names of all the files as the number of files increases.
 It is not uncommon for a user to have hundreds of files on one computer system and an
equal number of additional files on another system. Keeping track of so many files is a
daunting task.
2. Two-Level Directory
 In the two-level directory structure, each user has its own user file directory (UFD).
 The UFDs have similar structures, but each lists only the files of a single user.
 When a user refers to a particular file, only his own UFD is searched.
 Different users may have files with the same name, as long as all the file names within
each UFD are unique.
 To create a file for a user, the operating system searches only that user's UFD to
ascertain whether another file of that name exists.
 To delete a file, the operating system confines its search to the local UFD thus; it
cannot accidentally delete another user's file that has the same name.
 •When a user job starts or a user logs in, the system's Master file directory (MFD) is
searched.
 The MFD is indexed by user name or account number, and each entry points to the
UFD for that user.
 Advantage:
 No file name-collision among different users.
 Efficient searching.
 Disadvantage
 Users are isolated from one another and can’t cooperate on the same task
3. Tree Structured Directories
 A tree is the most common directory structure.
 The tree has a root directory, and every file in the system has a unique path name.
 A directory contains a set of files or subdirectories.
 A directory is simply another file, but it is treated in a special way.
 All directories have the same internal format.
 One bit in each directory entry defines the entry as a file (0) or as a subdirectory
(1).
 Special system calls are used to create and delete directories.
 Two types of path-names:
 Absolute path-name: begins at the root.
 Relative path-name: defines a path from the current directory.
 How to delete directory?
 To delete an empty directory: Just delete the directory.
 To delete a non-empty directory:
 First, delete all files in the directory.
 If any subdirectories exist, this procedure must be applied recursively to them.
 Advantage:
 Efficient searching.
 Grouping capability
 Disadvantages:
 A path to a file can be longer than a path in a two-level directory.
 Prohibits the sharing of files (or directories).
operating system notes for file managment.pptx
Acyclic Graph Directories
 The common subdirectory should be shared.
 A shared directory or file will exist in the file system in two or more places at once.
 A tree structure prohibits the sharing of files or directories.
 An acyclic graph is a graph with no cycles.
 It allows directories to share subdirectories and files.
 The same file or subdirectory may be in two different directories. The acyclic graph is a natural
generalization of the tree-structured directory scheme.
 Two methods to implement shared-files (or subdirectories):
 1. Create a new directory-entry called a link. A link is a pointer to another file (or
subdirectory).
 2. Duplicate all information about shared-files in both sharing directories.
 Two problems:
 A file may have multiple absolute path-names.
 Deletion may leave dangling-pointers to the non-existent file.
 Solution to deletion problem:
 Use back-pointers: Preserve the file until all references to it are deleted.
 With symbolic links, remove only the link, not the file. If the file itself is deleted, the
link can be removed.
FILE SYSTEM MOUNTING
 A file must be opened before it is used, a file system must be mounted before it can be
available to processes on the system
 Mount Point: The location within the file structure where the file system is to be
attached.
 The mounting procedure:
 The operating system is given the name of the device and the mount point.
 The operating system verifies that the device contains a valid file system. It does so
by asking the device driver to read the device directory and verifying that the
directory has the expected format
 The operating system notes in its directory structure that a file system is mounted
at the specified mount point.
 To illustrate file mounting, consider the file system shown in figure. The triangles
represent sub- trees of directories that are of interest
 Figure (a) shows an existing file system,
 while Figure (b) shows an un-mounted volume residing on /device/dsk.
 At this point, only the files on the existing file system can be accessed.
 Below figure shows the effects of mounting the volume residing on /device/dsk over
/users.
 If the volume is un-mounted, the file system is restored to the situation
depicted in first Figure.
FILE SHARING
 Sharing of files on multi-user systems is desirable.
 Sharing may be done through a protection scheme.
 On distributed systems, files may be shared across a network.
 Network File-system (NFS) is a common distributed file-sharing method.
 Multiple Users
 File-sharing can be done in 2 ways:
1. The system can allow a user to access the files of other users by default or
2. The system may require that a user specifically grant access.
 To implement file-sharing, the system must maintain more file- & directory-attributes
than on a single-user system.
 Most systems use concepts of file owner and group.
1. Owner
 The user who may change attributes & grant access and has the most control over the file (or
directory).
 Most systems implement owner attributes by managing a list of user-names and user IDs
2. Group
 The group attribute defines a subset of users who can share access to the file.
 Group functionality can be implemented as a system-wide list of group-names and group IDs.
 Exactly which operations can be executed by group-members and other users is definable by
the file's owner.
 The owner and group IDs of files are stored with the other file-attributes and can be used to
allow/deny requested operations.
Remote File Systems
 It allows a computer to mount one or more file-systems from one or more remote-
machines. There are three methods:
1. Manually transferring files between machines via programs like ftp.
2. Automatically DFS (Distributed file-system): remote directories are visible from a
local machine.
3. Semi-automatically via www (World Wide Web): A browser is needed to gain access
to the remote files, and separate operations (a wrapper for ftp) are used to transfer
files.
 ftp is used for both anonymous and authenticated access.
 Anonymous access allows a user to transfer files without having an account on the
remote system.
Client Server Model
 Allows clients to mount remote file-systems from servers.
 The machine containing the files is called the server.
 The machine seeking access to the files is called the client.
 A server can serve multiple clients, and a client can use multiple servers.
 The server specifies which resources (files) are available to which clients.
 A client can be specified by a network-name such as an IP address.
PROTECTION
 When information is stored in a computer system, we want to keep it safe from physical damage (reliability)
and improper access (protection).
 Reliability is generally provided by duplicate copies of files.
 For a small single-user system, we might provide protection by physically removing the floppy disks
and locking them in a desk drawer.
 File owner/creator should be able to control what can be done and by whom.
 Types of Access
 Systems that do not permit access to the files of other users do not need protection. This is too
extreme, so controlled-access is needed.
 Following operations may be controlled:
 1. Read: Read from the file.
 2. Write: Write or rewrite the file.
 3. Execute: Load the file into memory and execute it.
 4. Append: Write new information at the end of the file.
 5. Delete: Delete the file and tree its space for possible reuse.
 6. List: List the name and attributes of the file.

More Related Content

PPTX
Learn about the File Concept in operating systems ppt
PPTX
file_concept.pptx file presentation directories
PPTX
file_concept.pptx file presentation directories
PDF
File Systems
PDF
Unit ivos - file systems
PPT
Operating System - File Management concepts
PPT
Operating Systems - File Space Allocation
PDF
Chapter 5
Learn about the File Concept in operating systems ppt
file_concept.pptx file presentation directories
file_concept.pptx file presentation directories
File Systems
Unit ivos - file systems
Operating System - File Management concepts
Operating Systems - File Space Allocation
Chapter 5

Similar to operating system notes for file managment.pptx (20)

PPTX
Chapter 12.pptx
PPTX
File management
PPTX
Unit 6 OSY.pptx aaaaaaaaaaaaaaaaaaaaaaaa
PPT
PPT
Unit 3 file management
PPTX
The Operating System concepts.. -os.pptx
PPTX
Introduction to File System
PPT
Unit 3 chapter 1-file management
PPTX
(file systems)12312321321321312312312.pptx
PPTX
PPTX
CHAPTER 1 - Operating systems File System Interface.pptx
DOCX
file management
DOCX
File system
PPT
PPTX
File Management in Operating System
PPTX
File Management – File Concept, access methods, File types and File Operation
PDF
File organisation
PPT
file management_osnotes.ppt
PPT
Chapter 10 - File System Interface
Chapter 12.pptx
File management
Unit 6 OSY.pptx aaaaaaaaaaaaaaaaaaaaaaaa
Unit 3 file management
The Operating System concepts.. -os.pptx
Introduction to File System
Unit 3 chapter 1-file management
(file systems)12312321321321312312312.pptx
CHAPTER 1 - Operating systems File System Interface.pptx
file management
File system
File Management in Operating System
File Management – File Concept, access methods, File types and File Operation
File organisation
file management_osnotes.ppt
Chapter 10 - File System Interface
Ad

More from panditestmail (7)

PPTX
Introduction to Agile Technology part 1.pptx
PPTX
Overview AI and Cloud Security part 1.pptx
PPTX
Operating system concepts overview .pptx
PPTX
Operating system fundamentals - OS .pptx
PPTX
operating system notes about virtual memory 4.pptx
PPTX
operating system notes about deadlock 3.pptx
PPTX
Blue and Yellow Illustrative Benefits of Learning English Presentation.pptx
Introduction to Agile Technology part 1.pptx
Overview AI and Cloud Security part 1.pptx
Operating system concepts overview .pptx
Operating system fundamentals - OS .pptx
operating system notes about virtual memory 4.pptx
operating system notes about deadlock 3.pptx
Blue and Yellow Illustrative Benefits of Learning English Presentation.pptx
Ad

Recently uploaded (20)

PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
UiPath Agentic Automation session 1: RPA to Agents
PDF
STKI Israel Market Study 2025 version august
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PPTX
Build Your First AI Agent with UiPath.pptx
PPTX
2018-HIPAA-Renewal-Training for executives
PPTX
Chapter 5: Probability Theory and Statistics
PDF
CloudStack 4.21: First Look Webinar slides
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
The various Industrial Revolutions .pptx
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPTX
TEXTILE technology diploma scope and career opportunities
PDF
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Comparative analysis of machine learning models for fake news detection in so...
UiPath Agentic Automation session 1: RPA to Agents
STKI Israel Market Study 2025 version august
Consumable AI The What, Why & How for Small Teams.pdf
Custom Battery Pack Design Considerations for Performance and Safety
Zenith AI: Advanced Artificial Intelligence
Taming the Chaos: How to Turn Unstructured Data into Decisions
Build Your First AI Agent with UiPath.pptx
2018-HIPAA-Renewal-Training for executives
Chapter 5: Probability Theory and Statistics
CloudStack 4.21: First Look Webinar slides
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
Enhancing plagiarism detection using data pre-processing and machine learning...
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
The various Industrial Revolutions .pptx
sbt 2.0: go big (Scala Days 2025 edition)
TEXTILE technology diploma scope and career opportunities
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
Credit Without Borders: AI and Financial Inclusion in Bangladesh

operating system notes for file managment.pptx

  • 2. FILE CONCEPT  FILE  A file is a named collection of related information that is recorded on secondary storage.  The information in a file is defined by its creator.  Many different types of information may be stored in a file source programs, object programs, executable programs, numeric data, text, payroll records, graphic images, sound recordings, and so on.  A file has a certain defined which depends on its type.  A text file is a sequence of characters organized into lines.  A source file is a sequence of subroutines and functions, each of which is further organized as declarations followed by executable statements.  An object file is a sequence of bytes organized into blocks understandable by the system's linker.  An executable file is a series of code sections that the loader can bring into memory and execute.
  • 3. File Attributes  A file is named, for the convenience of its human users, and is referred to by its name. A name is usually a string of characters, such as example.c  When a file is named, it becomes independent of the process, the user, and even the system that created it.  A file's attributes vary from one operating system to another but typically consist of these:  Name: The symbolic file name is the only information kept in human readable form.  Identifier: This unique tag, usually a number, identifies the file within the file system; it is the non-human-readable name for the file.  Type: This information is needed for systems that support different types of files.
  • 4.  Location: This information is a pointer to a device and to the location of the file on that device.  Size: The current size of the file (in bytes, words, or blocks) and possibly the maximum allowed size are included in this attribute.  Protection: Access-control information determines who can do reading, writing, executing, and so on.  Time, date, and user identification: This information may be kept for creation, last modification, and last use. These data can be useful for protection, security, and usage monitoring.
  • 5. File Operations  A file is an abstract data type. To define a file properly, we need to consider the operations that can be performed on files.  Creating a file: Two steps are necessary to create a file,  Space in the file system must be found for the file.  An entry for the new file must be made in the directory.  Writing a file: To write a file, we make a system call specifying both the name of the file and the information to be written to the file.  Given the name of the file, the system searches the directory to find the file's location.  The system must keep a write pointer to the location in the file where the next write is to take place.  The write pointer must be updated whenever a write occurs.
  • 6.  Reading a file:  To read from a file, we use a system call that specifies the name of the file and where the data should be placed after reading.  Again, the directory is searched for the associated entry, and the system needs to keep a read pointer to the location in the file where the next read is to take place.  Once the read has taken place, the read pointer is updated.  Because a process is usually either reading from or writing to a file, the current operation location can be kept as a per-process current file-position pointer.
  • 7.  Repositioning within a file:  The directory is searched for the appropriate entry, and the current-file- position pointer is repositioned to a given value. Repositioning within a file need not involve any actual I/0. This file operation is also known as files seek.  Deleting a file:  To delete a file, search the directory for the named file. Having found the associated directory entry, then release all file space, so that it can be reused by other files, and erase the directory entry.  Truncating a file:  The user may want to erase the contents of a file but keep its attributes. Rather than forcing the user to delete the file and then recreate it, this function allows all attributes to remain unchanged but lets the file be reset to length zero and its file space released.
  • 8.  Other common operations include appending new information to the end of an existing file and renaming an existing file.  Most of the file operations mentioned involve searching the directory for the entry associated with the named file.  To avoid this constant searching, many systems require that an open () system call be made before a file is first used actively.  The operating system keeps a small table, called the open file table containing information about all open files. When a file operation is requested, the file is specified via an index into this table, so no searching is required.
  • 9.  The implementation of the open() and close() operations is more complicated in an environment where several processes may open the file simultaneously  The operating system uses two levels of internal tables:  A per-process table  A system-wide table  The per-process table:  The per-process table tracks all files that a specific process has opened. This table contains information about how each file is used by the process.  Each entry in the per-process table in turn points to a system-wide open-file table.  The system-wide table  contains process-independent information, such as the location of the file on disk, access dates, and file size. Once a file has been opened by one process, the system- wide table includes an entry for the file.
  • 11. Several pieces of information are associated with an open file. 1. File pointer: On systems that do not include a file offset as part of the read() and write() system calls, the system must track the last read write location as a current- file-position pointer. This pointer is unique to each process operating on the file and therefore must be kept separate from the on-disk file attributes. 2. File-open count: As files are closed, the operating system must reuse its open- file table entries, or it could run out of space in the table. Because multiple processes may have opened a file, the system must wait for the last file to close before removing the open-file table entry. The file-open counter tracks the number of opens and closes and reaches zero on the last close. The system can then remove the entry. 3. Disk location of the file:Most file operations require the system to modify data within the file. The information needed to locate the file on disk is kept in memory so that the system does not have to read it from disk for each operation. 4. Access rights: Each process opens a file in an access mode. This information is stored on the per-process table so the operating system can allow or deny subsequent I/0 requests.
  • 12. Access methods  Sequential methods  The simplest access method is sequential methods. Information in the file is processed in linear order i.e. one record after the other.  The majority of operations performed on a file are reading and writing. These operations manipulate the file data in a sequential manner.  A read operation known as “next-reads” reads the next part of the file. This operation advances the file pointer automatically, which tracks the current position in the file.  The write operation known as “write next” appends new data to the end of the file. After writing, the file pointer moves to the end of the newly written data.  The file can be reset to the beginning, usually to start processing the file from the start again.  Some systems allow the program to skip forward or backward by a specific number of records, denoted by an integer n. This might be limited to n=1 on some systems
  • 14. 2. Direct Access  A file is made up of fixed length logical records that allow programs to read and write records rapidly in no particular order.  The direct-access method is based on a disk model of a file, since disks allow random access to any file block. For direct access, the file is viewed as a numbered sequence of blocks or records.  Example: if we may read block 14, then read block 53, and then write block 7. There are no restrictions on the order of reading or writing for a direct-access file.  Direct-access files are of great use for immediate access to large amounts of information such as Databases, where searching becomes easy and fast.  For the direct-access method, file operations need to be modified to include the block number as a parameter. Instead of "read next" or "write next", operations become "read n" or "write n", where n is the block number. 𝑛  Another approach is to retain "read next" and "write next" operations as with sequential access, and add an operation "position file to n", where n is the block number. Then, to 𝑛 read block n, the program would position to n and then read next. 𝑛 𝑛
  • 16. Other Access Methods: Indexed sequential  Other access methods can be built on top of a direct-access method. These methods generally involve the construction of an index for the file.  The Index, is like an index in the back of a book contains pointers to the various blocks.  To find a record in the file, we first search the index and then use the pointer to access the file directly and to find the desired record.
  • 17. Directory Structure  The most common schemes for defining the logical structure of a directory are described below 1. Single-level Directory 2. Two-Level Directory 3. Tree-Structured Directories 4. Acyclic-Graph Directories 5. General Graph Directory
  • 18. 1. Single-level Directory  The simplest directory structure is the single-level directory.  All files are contained in the same directory, which is easy to support and understand  A single-level directory has significant limitations, when the number of files increases or when the system has more than one user.  As directory structure is single, uniqueness of file name has to be maintained, which is difficult when there are multiple users.  Even a single user on a single-level directory may find it difficult to remember the names of all the files as the number of files increases.  It is not uncommon for a user to have hundreds of files on one computer system and an equal number of additional files on another system. Keeping track of so many files is a daunting task.
  • 19. 2. Two-Level Directory  In the two-level directory structure, each user has its own user file directory (UFD).  The UFDs have similar structures, but each lists only the files of a single user.  When a user refers to a particular file, only his own UFD is searched.  Different users may have files with the same name, as long as all the file names within each UFD are unique.  To create a file for a user, the operating system searches only that user's UFD to ascertain whether another file of that name exists.  To delete a file, the operating system confines its search to the local UFD thus; it cannot accidentally delete another user's file that has the same name.  •When a user job starts or a user logs in, the system's Master file directory (MFD) is searched.  The MFD is indexed by user name or account number, and each entry points to the UFD for that user.
  • 20.  Advantage:  No file name-collision among different users.  Efficient searching.  Disadvantage  Users are isolated from one another and can’t cooperate on the same task
  • 21. 3. Tree Structured Directories  A tree is the most common directory structure.  The tree has a root directory, and every file in the system has a unique path name.  A directory contains a set of files or subdirectories.  A directory is simply another file, but it is treated in a special way.  All directories have the same internal format.  One bit in each directory entry defines the entry as a file (0) or as a subdirectory (1).  Special system calls are used to create and delete directories.  Two types of path-names:  Absolute path-name: begins at the root.  Relative path-name: defines a path from the current directory.
  • 22.  How to delete directory?  To delete an empty directory: Just delete the directory.  To delete a non-empty directory:  First, delete all files in the directory.  If any subdirectories exist, this procedure must be applied recursively to them.  Advantage:  Efficient searching.  Grouping capability  Disadvantages:  A path to a file can be longer than a path in a two-level directory.  Prohibits the sharing of files (or directories).
  • 24. Acyclic Graph Directories  The common subdirectory should be shared.  A shared directory or file will exist in the file system in two or more places at once.  A tree structure prohibits the sharing of files or directories.  An acyclic graph is a graph with no cycles.  It allows directories to share subdirectories and files.  The same file or subdirectory may be in two different directories. The acyclic graph is a natural generalization of the tree-structured directory scheme.  Two methods to implement shared-files (or subdirectories):  1. Create a new directory-entry called a link. A link is a pointer to another file (or subdirectory).  2. Duplicate all information about shared-files in both sharing directories.  Two problems:  A file may have multiple absolute path-names.  Deletion may leave dangling-pointers to the non-existent file.
  • 25.  Solution to deletion problem:  Use back-pointers: Preserve the file until all references to it are deleted.  With symbolic links, remove only the link, not the file. If the file itself is deleted, the link can be removed.
  • 26. FILE SYSTEM MOUNTING  A file must be opened before it is used, a file system must be mounted before it can be available to processes on the system  Mount Point: The location within the file structure where the file system is to be attached.  The mounting procedure:  The operating system is given the name of the device and the mount point.  The operating system verifies that the device contains a valid file system. It does so by asking the device driver to read the device directory and verifying that the directory has the expected format  The operating system notes in its directory structure that a file system is mounted at the specified mount point.
  • 27.  To illustrate file mounting, consider the file system shown in figure. The triangles represent sub- trees of directories that are of interest  Figure (a) shows an existing file system,  while Figure (b) shows an un-mounted volume residing on /device/dsk.  At this point, only the files on the existing file system can be accessed.
  • 28.  Below figure shows the effects of mounting the volume residing on /device/dsk over /users.  If the volume is un-mounted, the file system is restored to the situation depicted in first Figure.
  • 29. FILE SHARING  Sharing of files on multi-user systems is desirable.  Sharing may be done through a protection scheme.  On distributed systems, files may be shared across a network.  Network File-system (NFS) is a common distributed file-sharing method.  Multiple Users  File-sharing can be done in 2 ways: 1. The system can allow a user to access the files of other users by default or 2. The system may require that a user specifically grant access.
  • 30.  To implement file-sharing, the system must maintain more file- & directory-attributes than on a single-user system.  Most systems use concepts of file owner and group. 1. Owner  The user who may change attributes & grant access and has the most control over the file (or directory).  Most systems implement owner attributes by managing a list of user-names and user IDs 2. Group  The group attribute defines a subset of users who can share access to the file.  Group functionality can be implemented as a system-wide list of group-names and group IDs.  Exactly which operations can be executed by group-members and other users is definable by the file's owner.  The owner and group IDs of files are stored with the other file-attributes and can be used to allow/deny requested operations.
  • 31. Remote File Systems  It allows a computer to mount one or more file-systems from one or more remote- machines. There are three methods: 1. Manually transferring files between machines via programs like ftp. 2. Automatically DFS (Distributed file-system): remote directories are visible from a local machine. 3. Semi-automatically via www (World Wide Web): A browser is needed to gain access to the remote files, and separate operations (a wrapper for ftp) are used to transfer files.  ftp is used for both anonymous and authenticated access.  Anonymous access allows a user to transfer files without having an account on the remote system.
  • 32. Client Server Model  Allows clients to mount remote file-systems from servers.  The machine containing the files is called the server.  The machine seeking access to the files is called the client.  A server can serve multiple clients, and a client can use multiple servers.  The server specifies which resources (files) are available to which clients.  A client can be specified by a network-name such as an IP address.
  • 33. PROTECTION  When information is stored in a computer system, we want to keep it safe from physical damage (reliability) and improper access (protection).  Reliability is generally provided by duplicate copies of files.  For a small single-user system, we might provide protection by physically removing the floppy disks and locking them in a desk drawer.  File owner/creator should be able to control what can be done and by whom.  Types of Access  Systems that do not permit access to the files of other users do not need protection. This is too extreme, so controlled-access is needed.  Following operations may be controlled:  1. Read: Read from the file.  2. Write: Write or rewrite the file.  3. Execute: Load the file into memory and execute it.  4. Append: Write new information at the end of the file.  5. Delete: Delete the file and tree its space for possible reuse.  6. List: List the name and attributes of the file.