This document outlines key topics related to file systems and directories. It discusses definitions of files and directories, different file attributes and types, basic file operations like create and read, methods to access files sequentially and randomly. It also describes different directory structures like single level, two level and hierarchical, common directory operations, and basic information stored in a file directory like file name, type, size and access permissions.
1. Topic Outline
FILE SYSTEM DIRECTORY
File definition
File Systems and Disks
File Attributes
File types
File operations
Method of accessing file
Directory definition
Directory structures
Directory Operations
Information Elements of
a File Directory
04/16/171 abdalla ali khamis abdallalikha@gmail.com
2. File
2
A file is a named collection of related information
that is recorded on secondary storage(Abraham
Silberschatz).
Data files are numeric, alphabetic, alphanumeric,
or binary. Files may be free form like text files or
be formatted rigidly . r (Abraham Silberschatz)
04/16/17abdalla ali khamis abdallalikha@gmail.com
3. File Systems and Disks
3
User view is a named collection of data which are store
in secondary storage medium.
OS & file system view File is collection of disk blocks i.e.,
a container in which File System maps file names and offsets
to disk blocks
04/16/17abdalla ali khamis abdallalikha@gmail.com
6. FILE OPERATIONS
6
Creating a file
Writing a file
Reading a file.
Repositioning within a file
Deleting a file
Truncating a file
04/16/17abdalla ali khamis abdallalikha@gmail.com
7. Methods for Accessing Files
Sequential access: Sequential access is the one in
which the record are access in the form of sequence
whereby read all bytes or records in order in which
read one record after the other from the beginning in
the file.
Random access: Random access in the one in which
the record can be read un any order.
Indexed sequential: Indexed sequential access is the
one in which file is access items in file based on the
contents of (part of) an item in the file.
04/16/177 abdalla ali khamis abdallalikha@gmail.com
8. Directory – A Special Kind of File
8
A tool for users & applications to organize and find
files
User-friendly names
Names that are meaningful over long periods of time
The data structure for OS to locate files (i.e.,
containers) on disk
04/16/17abdalla ali khamis abdallalikha@gmail.com
9. Directory structures
9
o Single level
One directory per system, one entry pointing to each file
Small, single-user or single-use systems
PDA, cell phone, etc.
o Two-level
Single “master” directory per system
Each entry points to one single-level directory per user
Uncommon in modern operating systems
o Hierarchical
Any directory entry may point to
Individual file
Another directory
Common in most modern operating systems
04/16/17abdalla ali khamis abdallalikha@gmail.com
10. Directory Operations
10
o Create:
Make a new directory
o Add, Delete entry:
o Invoked by file create & destroy, directory create & destroy
o Find, List:
o Search or enumerate directory entries
o Rename:
o Change name of an entry without changing anything else about it
o Link, Unlink:
o Add or remove entry pointing to another entry elsewhere
o Introduces possibility of loops in directory graph
o Destroy:
o Removes directory; must be empty
04/16/17abdalla ali khamis abdallalikha@gmail.com
11. Information Elements of a File
Directory: basic information
File Name:
This is a name as chosen by the creator of the file.
File Type:
A file type can be of the text type, binary, load module, and
many other types.
File Organization:
File organization is for systems that support different
organizations.
04/16/1711 abdalla ali khamis abdallalikha@gmail.com
12. Information Elements of a File
Directory: Address Information
o Volume:This component indicates a device on which
the file is stored
o Starting Address:This is a starting physical address
on secondary storage (for example: cylinder, track,
and block number on disk)
o Size Used:This is a current size of the file. It can be
measured in bytes, words, or blocks.
o Size Allocated:This is the maximum size a file can
have.
04/16/1712 abdalla ali khamis abdallalikha@gmail.com
13. Information Elements of a File
directory: access control information
Owner:
This is a user who is assigned control of the file. The
owner may be able to grant or deny access (to the file)
to other users and to change these privileges.
Access Information:
A simple version of this element would include the
user’s name and password for each authorized user.
Permitted Actions:
This is for controlling reading, writing, executing, and
transmitting over a network.
04/16/1713 abdalla ali khamis abdallalikha@gmail.com
14. Information Elements of a File
Directory: usage information
o Date Created
o Identity of Creator
o Date Last Read Access
o Identity of Last Reader
o Date Last Modified
o Identity of Last Modifier
o Date of Last Backup
o Current Usage:
04/16/1714 abdalla ali khamis abdallalikha@gmail.com
15. Study Questions
1. Why do some systems keep track of the type of a file,
while others leave it to the user or simply do not
implement multiple file types?
2. Explain the purpose of the open and close operations.
3. List advantages and advantages of operating system
“knowing” and supporting many file types
4. Why would we want a subdirectory in our account?
04/16/1715 abdalla ali khamis abdallalikha@gmail.com