0% found this document useful (0 votes)
10 views34 pages

File System Concepts and Operations

The document provides an overview of file systems, covering fundamental concepts, directory structures, file operations, and file management techniques. It discusses file attributes, access methods, and the importance of metadata, as well as techniques like mounting, unmounting, and memory-mapped files. Additionally, it addresses file sharing in multi-user environments and the significance of file naming conventions.

Uploaded by

alula girma
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)
10 views34 pages

File System Concepts and Operations

The document provides an overview of file systems, covering fundamental concepts, directory structures, file operations, and file management techniques. It discusses file attributes, access methods, and the importance of metadata, as well as techniques like mounting, unmounting, and memory-mapped files. Additionally, it addresses file sharing in multi-user environments and the significance of file naming conventions.

Uploaded by

alula girma
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

1

File System

CS Year III, 2023 Compiled by: Adane B.


2
Outline
⇒ Fundamental concepts on file

⇒ Directory Structure
⇒ File system techniques (mounting and unmounting, virtual file
systems)

⇒ Special purpose file systems

⇒ Memory-mapped files

⇒ Naming file

CS Year III, 2023 Compiled by: Adane B.


3
File Concept
 A file is a collection of related data or information that is stored under a
particular name and directory
 Data files may be numeric, character/alphabetic, alphanumeric, or
binary.
 The File system provides the mechanism for storage and multiple access to
both data and programs residing on the disks.
 File system is a method of storing and organizing computer files and
their data.
 It organizes files into a database for the storage, organization,
manipulation, and retrieval by the computer's operating system.
 File systems are used on data storage devices such as a hard disks to
maintain the physical location of the files

CS Year III, 2023 Compiled by: Adane B.


4 File Concept

File Management System:


 Files are managed by the operating system.
 How they are structured, named, accessed, used, protected
and implemented.
 Bridges the gap between low-level disk organization (an
array of blocks) and the user’s views (a stream or collection
of records) (mapped).

CS Year III, 2023 Compiled by: Adane B.


5 What is Data?
 Computer data is information processed or stored by a
computer.
 This information may be in the form of text documents,
images, audio clips, software programs, or other types of
data.
 Computer data may be processed by the computer's CPU
and is stored in files and folders on the computer's hard
disk.

CS Year III, 2023 Compiled by: Adane B.


6 Meta Data
 Metadata is essentially data about data.
 It is information describing and detailing files.
 Metadata includes information about the attributes, properties, and
characteristics of files and directories
 Metadata can be defined by user or generated automatically by an
application or operating system.
 Files often have associated timestamps that indicate important time-related
information
 Time stamps/ date and time of day, sometimes yyy/MM/dd*HH:mm:ss
 Creation Time : When the file was originally created.
 Modification Time : When the file's content was last modified.
 Access Time : When the file was last accessed.
 Change Time: When the file's metadata was last changed.

CS Year III, 2023 Compiled by: Adane B.


File Operations
7

 A file is a collection of logically related data that is recorded on


the secondary storage in the form of sequence of operations.
 File operations refer to the basic actions or manipulations that
can be performed on files in an operating system
 Operations can be implemented on a file such as read, write, open
and close etc.
 These operations are performed by the user by using the
commands provided by the operating system.

CS Year III, 2023 Compiled by: Adane B.


8 Types of File Operations
 Create: This operation involves the creation of a new file or directory.
 Typically done through system calls or file management utilities provided by
the operating system.
 Read: Reading the contents of a file.
 Programs or applications can read data from a file using system calls or file
input/output (I/O) functions.
 Write : Modifying or adding data to a file.
 Programs or applications can write data to a file using system calls or file
I/O functions. This operation may overwrite existing content or append new
data.
 Delete: Removing a file or directory.
 This operation permanently removes the file or directory from the file
system.
CS Year III, 2023 Compiled by: Adane B.
9 File Attribute
 When a file is named, it becomes independent of the process, the user, and even the
system that created it.
 Name – only information kept in human-readable form
 Identifier – unique tag (number) identifies file within file system
 Type – needed for systems that support different file types
 Location – pointer to file location on device
 Size – current file size
 Protection – controls who can do reading, writing, executing
 Time, date, and user identification – info about file creation, last modification,
and last use.
 Information about files are kept in the directory structure, which is maintained on
the disk.

CS Year III, 2023 Compiled by: Adane B.


10 File Access Methods
 File organization refers to the way data is stored in a file.
 There are four methods of organizing files on a storage media.
This include:
1. Sequential access
2. Random/ direct access
3. indexed-sequential

CS Year III, 2023 Compiled by: Adane B.


11 Sequential file organization

 Records are stored and accessed in a


particular order sorted using a key field.
 Retrieval requires searching sequentially
through the entire file record by record to
the end.
 process could read all the bytes or
records in a file in order, starting at the
beginning, but could not skip around
and read them out of order.
 Used in Magnetic tape rather than disk.

CS Year III, 2023 Compiled by: Adane B.


12 Random or direct file organization
 Records are stored randomly but accessed directly.
 To access a file stored randomly, a record key is used to determine
where a record is stored on the storage media.
 Magnetic and optical disks allow data to be stored and accessed
randomly.
 Advantages of random file access
 Quick retrieval of records.
 The records can be of different sizes.
 Eg .. To give info about passenger on airplane.

CS Year III, 2023 Compiled by: Adane B.


13 Random or direct file organization

CS Year III, 2023 Compiled by: Adane B.


14 Indexed-sequential file organization method
 Almost similar to sequential
method only that, an index is used
to enable the computer to locate
individual records on the storage
media.
 For example, on a magnetic drum,
records are stored sequential on the
tracks.
 However, each record is assigned an
index that can be used to access it
directly.

CS Year III, 2023 Compiled by: Adane B.


15 Buffering in file
 The File > Open command opens a file on disk and loads it into a file
buffer.
 A file buffer is the temporary image of the file that you can edit.
 You can edit the file buffer without affecting the original file, until you
save it using the Save command.
 The File > Save command writes the file buffer contents back over the
original file. This is the only time the original file is changed.
 When the file is close, the file buffer contents are simply thrown away.
 Open command is opens the original file, at the same time its copies the
original file into an abstract buffer that exists independently of any files.

CS Year III, 2023 Compiled by: Adane B.


16
Directory Structure
A directory structure, also known as a file system hierarchy, is the organization or layout of
directories (folders) and files on a computer or storage device
To keep track of files, file systems normally have directories or folders
Directory is a node in hierarchical (file system) which contains zero or more other nodes.
 A collection of nodes containing information about all files.

CS Year III, 2023 Compiled by: Adane B.


17
Logical Structure of Directory
Single-Level Directory: All files are contained in the same directory, hence they must have unique names.
 Has only one directory which is called the root directory.
 The users are not allowed to create subdirectories under the root directory.
 All the files created by the several users are present in the root directory only.
 Grouping is difficult, b/c only one directory
 Drawback: a user cannot use the same file name
 It is often used on simple embedded devices such as telephones, digital cameras, and some portable
music players.

CS Year III, 2023 Compiled by: Adane B.


18 Directory Structure
Modern users with thousands of files, it would be impossible to find anything if all files were in a
single directory?
Two-Level Directory: Separate directory for each user
 The users create directory directly inside the root directory.
 Allows each user to keep their files separately inside their own directory.
 Allows to use the same name for the files but under different user directories.
 Can have the same file name for different user.
 Efficient searching.
 Every file in the system has a path name.

CS Year III, 2023 Compiled by: Adane B.


19 Directory Structure
Tree-Structured Directories:
 The tree has a root directory,
and every file in the system has
a unique path name.
 every directory or file has
only one parent directory.
 A tree structure prohibits the
sharing of files or directories.

CS Year III, 2023 Compiled by: Adane B.


20 Directory Structure
A cyclic-Graph Directories:
 Have shared subdirectories and files
 A graph with no cycles.
 allows a directory or a file to have many
parent directories.
 The same file or subdirectory may be in
two different directories.
• Eg… list dir have two parents which is “w” and
“words”

CS Year III, 2023 Compiled by: Adane B.


21 Operations on Directory
Operation that can be performed on the directory.
 Searching
 Creating
 Deleting
 List a directory
 Renaming
 Link:- The file can be allowed to appear in more than
one directory.
 Here, the system call creates a link between the file
and the name specified by the path where the file is
to appear.
CS Year III, 2023 Compiled by: Adane B.
22
File system techniques
Partitioning
 Is the creation of one or more regions on secondary storage
to manage each region separately.
 These regions are called partitions.
 Each partition then appears to the operating system as a
distinct "logical" disk that uses part of the actual disk
 It allows the use of different filesystems to be installed
for different kinds of files.
 Separating user data from system data
 Partitioning can also make backing up easier.

CS Year III, 2023 Compiled by: Adane B.


23 File system techniques…
Virtual file system
 A virtual file system (VFS) is programming that
forms an interface between an operating
system's and a more concrete filesystem.
 It also manages the data storage and retrieval
between the operating system and the storage sub-
system.
 The VFS maintains a catch of directory lookups to
enable easy location of frequently accessed
directories.

CS Year III, 2023 Compiled by: Adane B.


24
File system techniques…
Mounting and Unmounting Files
• Mounting is a process by which the OS makes files and
directories on a storage device available for users to
access via the computer's file system.
• The exact location in Virtual File System(VFS) that the
newly-mounted medium got registered is called mount
point;
• when the mounting process is completed, the user can
access files and directories on the medium from there.
• Unmounting, in which the operating system cuts off all
user access to files and directories on the mount point,
writes the remaining queue of user data to the storage
device.

CS Year III, 2023 Compiled by: Adane B.


25
Mounting and Unmounting Files…
 The mount procedure is straightforward. The OS is given the
name of the device and the mount point.
 Mount is command attach file to file hierarchy
 Unmount is command to detach file from file hierarchy
The mount command mounts a storage device or file system,
making it accessible and attaching it to an existing
directory structure.
The unmount command "unmounts" a mounted filesystem,
informing the system to complete any
pending read or write operations, and safely detaching it.
the OS notes in its directory structure that a file system is
mounted at the specified mount point.

CS Year III, 2023 Compiled by: Adane B.


26
Mounting and Unmounting Files

(a) Existing. (b) Unmounted Partition

CS Year III, 2023 Compiled by: Adane B.


27

Mount point

CS Year III, 2023 Compiled by: Adane B.


28
File Sharing
 When an OS accommodates multiple users, the issues of
file sharing, file naming, and file protection become
important.
 Most systems have evolved to use the concepts of file (or
directory) owner (user) and group.
 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

CS Year III, 2023 Compiled by: Adane B.


29 File Sharing – Multiple Users
 The owner is the user who can change attributes and
grant access and who has the most control over the file.
 The group attribute defines a subset of users who can
share access to the file.
 User IDs identify users, allowing permissions and
protections to be per-user.
 Group IDs allow users to be in groups, permitting group
access rights.

CS Year III, 2023 Compiled by: Adane B.


File Sharing – Remote File Systems
30

 Uses networking to allow file system access between


systems
 Manually via programs like FTP
 Automatically, seamlessly using distributed file systems
 Semi automatically via the world wide web

CS Year III, 2023 Compiled by: Adane B.


Memory-Mapped Files
31

 File access requires a system call and disk access.


 Open()
 Read()
 Write()
 We can use the virtual memory techniques to treat file
I/O as routine memory accesses.
 Memory mapping a file allows a part of the virtual
address space to be logically associated with the file.

31
CS Year III, 2023 Compiled by: Adane B.
32 File Naming
 operating systems allow strings of one to eight letters
as legal file names.
 Frequently digits and special characters are also
permitted, so names like 2, urgent!,
 Many file systems support names as long as 255
characters.
 Many operating systems support two-part file names,
with the two parts separated by a period.
 The part following the period is called the file
extension and usually indicates something about the
file.

CS Year III, 2023 Compiled by: Adane B.


33 File Naming…

CS Year III, 2023 Compiled by: Adane B.


34

CS Year III, 2023 Compiled by: Adane B.

You might also like