Disk scheduling algorithms
The operating system performs a disk scheduling process to schedule the I/O requests that arrive at the disk.
Disk scheduling is important since-
1. Many I/O requests may arrive from different processes, and the disk controller can only serve one
I/O request at a time. As a result, other I/O requests need to wait in the waiting queue and get
scheduled.
2. The operating system needs to manage the hardware efficiently.
3. To reduce seek time.
Key Terms Associated with Disk Scheduling
When discussing disk scheduling in operating systems, several key terms are commonly used to describe
various aspects of the process. Here are some important terms associated with disk scheduling:
1. Seek Time: The time it takes for the disk arm to position itself over the desired track. Seek time is a
significant component of the total time it takes to access data on a disk.
2. Rotational Latency: The time it takes for the desired disk sector to rotate under the disk head after
the head is positioned over the correct track. It is influenced by the rotational speed of the disk.
3. Transfer Time: The time it takes to transfer data between the disk and the computer's memory. It is
determined by the data transfer rate of the disk.
4. Disk Access Time: The sum of seek time, rotational latency, and transfer time. It represents the total
time required to access a specific piece of data on the disk.
5. Disk Scheduling Algorithm: A method or strategy used by the operating system to determine the
order in which I/O requests are serviced. Common algorithms include FCFS (First-Come-First-
Serve), SSTF (Shortest Seek Time First), SCAN, C-SCAN, LOOK, and C-LOOK.
6. Request Queue: A queue that holds pending I/O requests for the disk. The disk scheduling algorithm
selects requests from this queue to determine the order in which they are processed.
7. Head Movement: The physical movement of the disk arm as it seeks to position the read/write heads
over the desired track. Minimizing head movement is a key goal of disk scheduling algorithms.
8. Elevator Algorithm: A disk scheduling algorithm that works like an elevator, servicing requests in
one direction until reaching the end of the disk and then reversing direction. Also known as SCAN or
C-SCAN.
9. Cylinder: The concentric circular tracks on the disk surface where data is stored. The disk arm moves
to position the read/write heads over the desired cylinder to access data.
10. Starvation: A condition where a process or I/O request is consistently delayed or denied service by
the disk scheduling algorithm. Preventing starvation is a consideration in designing effective
scheduling algorithms.
11. Deadline Scheduling: A disk scheduling approach that assigns deadlines to I/O requests, and the
algorithm attempts to meet these deadlines to ensure timely delivery of data.
12. Track-to-Track Seek Time: The time it takes for the disk arm to move from one track to an adjacent
track. This is a measure of the efficiency of head movement between adjacent cylinders.
Importance of Disk Scheduling in Operating System
Disk scheduling is crucial in operating systems for several reasons, as it directly impacts the efficiency and
performance of I/O operations. Here are the key reasons highlighting the importance of disk scheduling:
• Optimizing Disk Access Time: Disk scheduling algorithms aim to reduce the seek time, rotational
latency, and transfer time collectively known as the disk access time. Efficient disk scheduling
ensures that data is retrieved with minimal delays, improving overall system performance.
• Enhancing Throughput: By minimizing the time spent on disk seeks and rotations, disk scheduling
contributes to higher throughput. Throughput is a measure of the number of I/O operations the system
can handle in a given time, and effective disk scheduling helps maximize this metric.
• Fair Resource Allocation: In multi-user or multi-tasking environments, multiple processes or users
may be contending for disk access. Disk scheduling ensures fair and equitable distribution of the disk
resource, preventing any single process from monopolizing disk access and leading to potential
system bottlenecks.
• Reducing Disk Head Movement: Disk scheduling algorithms work to minimize the movement of
the disk's read/write heads. By optimizing the order in which requests are serviced, these algorithms
decrease head movement, resulting in faster data retrieval and improved overall disk performance.
• Improving System Responsiveness: Disk scheduling directly influences the responsiveness of the
operating system. Processes requiring disk access, such as file read and write operations, experience
reduced waiting times, leading to a more responsive and user-friendly system.
Types of Disk Scheduling Algorithm in OS
The goal of the disk scheduling algorithm is-
1. Have a minimum average seek time.
2. Have minimum rotational latency.
3. Have high throughput.
FCFS scheduling algorithm
FCFS scheduling algorithm is the simplest disk scheduling algorithm. As the name suggests, it is a first-
come, first-serve algorithm. In this algorithm, the I/O requests are processed in the order they arrive in the
disk queue. Let us understand this algorithm using an example.
Example: Consider a disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65,
and 67. The read-write head is initially at cylinder number 53. We will now use the FCFS algorithm to serve
these I/O requests.
Input: I/O requests - { 98, 183, 37, 122, 14, 124, 65, 67 }
Initial head position - 53
Output: The following chart shows the sequence in which requests are served using the FCFS algorithm.
SSTF Scheduling Algorithm
The SSTF algorithm stands for the shortest seek time first algorithm. This algorithm selects the request
having the minimum distance from the current head position. Since distance increases with the number of
cylinders traversed by the head, the SSTF chooses the pending request closest to the current head position.
Let us understand this algorithm using an example.
Example: Consider a disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65,
67. The read-write head is initially at cylinder number 53. We will now use the SSTF algorithm to serve
these I/O requests.
Input: I/O requests - { 98, 183, 37, 122, 14, 124, 65, 67 }
Initial head position - 53
Output: The following chart shows the sequence in which requests are served using the SSTF algorithm.
SCAN Scheduling Algorithm
In the SCAN scheduling algorithm, the disk arm begins at one end of the disk and moves towards the other
end, servicing requests as it reaches each cylinder until it gets to the other end of the disk. As soon as it
reaches the other end, the direction of head movement is reversed, and servicing continues. The head moves
back and forth across the disk, continuously servicing requests. Let us understand this algorithm using an
example.
Example: Consider a disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65,
67. The read-write head is initially at cylinder number 53. We will now use the SCAN algorithm to serve
these I/O requests.
Input: I/O requests - { 98, 183, 37, 122, 14, 124, 65, 67 }
Initial head position - 53
Direction - towards the larger number of cylinders
Output: The following chart shows the sequence in which requests are served using the SCAN algorithm.
C-SCAN Scheduling Algorithm
The C-SCAN (Circular Scan) scheduling algorithm is a variant of the SCAN scheduling algorithm designed
to provide a more uniform wait time. Like SCAN, C-SCAN moves the head from one end of the disk to the
other, servicing requests along the way. However, when the head reaches the other end, it immediately returns
to the beginning of the disk without servicing any requests on the return trip. Let us understand this algorithm
using an example.
Example: Consider a disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65,
67. The read-write head is initially at cylinder number 53. We will now use the C-SCAN algorithm to serve
these I/O requests.
Input: I/O requests - { 98, 183, 37, 122, 14, 124, 65, 67 }
Initial head position - 53
Direction - towards the larger number of cylinders
Output: The following chart shows the sequence in which requests are served using the C-SCAN
algorithm.
LOOK Scheduling Algorithm
The LOOK scheduling algorithm is identical to the SCAN disk scheduling algorithm, except that, instead of
traveling to the end of the disk, the head goes till the last request to be handled and then reverses the head
from there and processes the requests in the opposite direction. As a result, the extra time caused by unneeded
overhead to the disk end is avoided. Let us understand this algorithm using an example.
Example: Consider a disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65,
and 67. The read-write head is initially at cylinder number 53. We will now use the LOOK algorithm to
serve these I/O requests.
Input: I/O requests - { 98, 183, 37, 122, 14, 124, 65, 67 }
Initial head position - 53
Direction - towards the larger number of cylinders
Output: The following chart shows the sequence in which requests are served using the LOOK algorithm.
C-LOOK Scheduling Algorithm
The C-LOOK scheduling algorithm is similar to the C-SCAN scheduling algorithm, except that the head
does not move to the end of the disk in the C-LOOK algorithm. It goes until the last request is processed in
one end and then reverses its direction and does not process any request. It stops at the last request in the
opposite direction and continues the process until all requests are served. Let us understand this algorithm
using an example.
Example: Consider a disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65,
and 67. The read-write head is initially at cylinder number 53. We will now use the C-LOOK algorithm to
serve these I/O requests.
Input: I/O requests - { 98, 183, 37, 122, 14, 124, 65, 67 }
Initial head position - 53
Direction - towards the larger number of cylinders
Output: The following chart shows the sequence in which requests are served using the C-LOOK
algorithm.
Input/Output (I/O) Devices
An I/O device is a hardware component that enables a computer system to communicate with the external
environment by allowing data to be input into the system and output from the system.
• Input devices send data to the computer
• Output devices receive data from the computer
Types of I/O Devices
Based on how data is transferred, I/O devices are mainly classified into:
1. Block Devices
• A block device transfers data in fixed-size blocks.
• Data is read/written in chunks (blocks) rather than individually.
• Supports random access (you can access any block directly).
Examples:
• Hard disks
• USB drives
• SSDs
• Digital cameras
Key Features:
• High data transfer efficiency
• Used for storage devices
• Managed using file systems
2. Character Devices
• A character device transfers data one character (byte) at a time.
• Data is processed as a stream of characters.
• Usually supports sequential access only.
Examples:
• Keyboard
• Mouse
• Serial ports
• Sound cards
• Printers
Key Features:
• No buffering into blocks
• Simpler structure
• Used for real-time data transfer
Input/Output (I/O) Management in Operating System
I/O Management in an Operating System is responsible for handling communication between the CPU and
external devices such as keyboard, mouse, disks, and monitor.
It ensures efficient data transfer using device drivers and device controllers.
1. Device Drivers
Device drivers are software components integrated into the operating system that control specific
hardware devices.
• They act as a bridge between OS and hardware
• Convert high-level OS commands → low-level device instructions
• Each device (printer, keyboard, disk) has its own driver
Example: A printer driver converts a print command into signals the printer understands.
2. Device Controller
A device controller is a hardware unit that manages a particular device.
• Acts as an interface between device and device driver
• Receives commands from CPU via driver
• Controls actual hardware operations
Examples:
• Disk Controller → manages hard disks
• USB Controller → manages mouse, keyboard, printer
• Graphics Adapter → controls display (monitor)
Types of I/O Operations
a) Synchronous I/O
• CPU waits until the I/O operation completes
• CPU remains idle during waiting
Example: Reading a file where CPU pauses until data is received
b) Asynchronous I/O
• I/O operations occur parallel to CPU execution
• CPU continues doing other tasks
Example: Downloading a file while working on another program
Working
1. User interacts with device
(e.g., typing on keyboard or clicking mouse)
2. The request goes to the Operating System
3. The OS uses the Device Driver (software)
→ to interpret the request
4. The Device Driver communicates with Device Controller (hardware)
5. The Device Controller operates the device
→ performs input/output task
6. Data is transferred back to the CPU
7. CPU processes data and sends output (e.g., display on monitor)
File Allocation Methods
The file system is the most visible part of an operating system. Files are stored on disks, and whenever files are
created or expanded, disk space must be allocated to them. To manage this efficiently, the operating system keeps
track of which disk blocks are free and which are already allocated.
An allocation method defines how disk blocks are assigned to a file. Since disk blocks are of fixed size, new
blocks are allocated whenever a file is created or its size increases due to writing operations. The goal is to allocate
disk space in a way that ensures efficient utilization and allows fast file access.
Types of File Allocation Methods in Operating System
• Contiguous File Allocation
• Linked File Allocation
• Indexed File Allocation
1. Contiguous File Allocation
In this method, disk blocks are allocated to a file in a continuous sequence.
👉 If a file starts at block x, it will occupy:
x, x+1, x+2, x+3, … (if free)
Example
If file [Link] starts at block 2 and needs 4 blocks, it will be stored in:
2, 3, 4, 5
Directory Table
The operating system stores:
• File name
• Starting block
• Length (number of blocks)
From the figure:
• [Link] → start = 1, length = 4 → blocks: 1, 2, 3, 4
• [Link] → start = 7, length = 3 → blocks: 7, 8, 9
Advantages
• Easy sequential access (blocks are in order)
• Supports random access (like an array)
• Fast performance due to low seek time
Disadvantages
• Internal fragmentation (unused space inside a block)
• External fragmentation (free space not continuous)
• File cannot grow easily
• Poor memory utilization
2. Linked File Allocation
In this method, disk blocks are stored like a linked list.
👉 Each block contains:
• Data
• Pointer to the next block
Blocks can be anywhere on the disk (not contiguous).
Example (from figure)
File [Link] is stored as:
4 → 8 → 10 → 11 → 2 → 3
• Each block points to the next
• Last block (3) has no pointer
Directory Table
Stores:
• File name
• Starting block
• Ending block
Advantages
• No external fragmentation
• File can grow easily
• Better space utilization
Disadvantages
• No random access (must follow pointers step by step)
• Slower due to more seek time
• Extra memory needed for pointers
3. Indexed File Allocation
This method uses a special block called an index block.
👉 The index block:
• Stores addresses of all blocks of the file
• Does NOT store actual file data
Working (from figure)
• File [Link] has index block 8
• Block 8 contains pointers to blocks: 5, 4, 2, 6, 7
Directory stores:
• File name
• Index block address
Problem
If a file is very large, one index block may not be enough.
Solutions
1. Linked Scheme
o Index blocks are linked together
2. Multilevel Index
o Index blocks are arranged in levels (like paging)
3. Inode
o Stores file details + direct and indirect block pointers
Advantages
• No external fragmentation
• Supports random access
• Efficient and flexible
Disadvantages
• Complex method
• Requires extra memory for index blocks
• High pointer overhead
• Single index block may not be enough for large files
File System Implementation
A file is a collection of related information. The file system resides on secondary storage and
provides efficient and convenient access to the disk by allowing data to be stored, located,
and retrieved.
File system implementation in an operating system refers to how the file system manages the
storage and retrieval of data on a physical storage device such as a hard drive, solid-state
drive, or flash drive. The file system implementation includes several components, including:
1. File System Structure: The file system structure refers to how the files and
directories are organized and stored on the physical storage device. This includes
the layout of file systems data structures such as the directory structure, file
allocation table, and inodes.
2. File Allocation: The file allocation mechanism determines how files are
allocated on the storage device. This can include allocation techniques such as
contiguous allocation, linked allocation, indexed allocation, or a combination of
these techniques.
3. Data Retrieval: The file system implementation determines how the data is read
from and written to the physical storage device. This includes strategies such as
buffering and caching to optimize file I/O performance.
4. Security and Permissions: The file system implementation includes features
for managing file security and permissions. This includes access control lists
(ACLs), file permissions, and ownership management.
5. Recovery and Fault Tolerance: The file system implementation includes
features for recovering from system failures and maintaining data integrity. This
includes techniques such as journaling and file system snapshots.
File system implementation is a critical aspect of an operating system as it directly impacts
the performance, reliability, and security of the system. Different operating systems use
different file system implementations based on the specific needs of the system and the
intended use cases. Some common file systems used in operating systems include NTFS and
FAT in Windows, and ext4 and XFS in Linux.
The file system is organized into many layers:
1. I/O Control level – Device drivers act as an interface between devices and OS,
they help to transfer data between disk and main memory. It takes block number
as input and as output, it gives low-level hardware-specific instruction.
2. 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.
3. File organization Module – It has information about files, the location of files
and their logical and physical blocks. Physical blocks do not match with logical
numbers of logical blocks numbered from 0 to N. It also has a free space that
tracks unallocated blocks.
4. Logical file system – It manages metadata information about a file i.e includes
all details about a file except the actual contents of the file. It also maintains via
file control blocks. File control block (FCB) has information about a file – owner,
size, permissions, and location of file contents.
Advantages
1. Duplication of code is minimized.
2. Each file system can have its own logical file system.
3. File system implementation in an operating system provides several advantages,
including:
4. Efficient Data Storage: File system implementation ensures efficient data
storage on a physical storage device. It provides a structured way of organizing
files and directories, which makes it easy to find and access files.
5. Data Security: File system implementation includes features for managing file
security and permissions. This ensures that sensitive data is protected from
unauthorized access.
6. Data Recovery: The file system implementation includes features for
recovering from system failures and maintaining data integrity. This helps to
prevent data loss and ensures that data can be recovered in the event of a system
failure.
7. Improved Performance: File system implementation includes techniques such
as buffering and caching to optimize file I/O performance. This results in faster
access to data and improved overall system performance.
8. Scalability: File system implementation can be designed to be scalable, making
it possible to store and retrieve large amounts of data efficiently.
9. Flexibility: Different file system implementations can be designed to meet
specific needs and use cases. This allows developers to choose the best file system
implementation for their specific requirements.
10. Cross-Platform Compatibility: Many file system implementations are cross-
platform compatible, which means they can be used on different operating
systems. This makes it easy to transfer files between different systems.
Directory structures
Directory structures in an operating system provide a hierarchical organization for storing and managing files
and directories. They typically start with a root directory and allow for efficient data access, organization,
and navigation, simplifying file management and access control. Directory structures are essential for modern
computing environments.
A directory can be thought of as a folder. It is a collection of files on the storage device. In our computers,
we always store various files like songs, images, videos, etc. All these files are stored in some directory. In
this article, we shall see directory structures in os.
There are several logical structures of a directory, these are given below.
• Single level directory
• Two-level directory
• Tree structure or hierarchical directory
• Acyclic graph directory
Single-Level Directory Structure
It is the simplest directory structure. In a single-level directory, there is only one directory in the system,
meaning there is only one folder, and all the files are stored in that single directory. There is no way to
segregate important files from non-important files.
Implementation of a single-level directory is the simplest. However, there are various disadvantages of it.
The pictorial representation of a single-level directory is given below. There is only one directory ( root
directory), and all the files are stored in the same directory. Here f1, f2, f3, f4, f5 represent the five different
files. Practically it can be thought of as a structure where all the files are stored in the same folder.
Advantages of single-level directory
• The main advantage of a single-level directory is that it is very simple to implement.
• Since all the files are present in the same directory, in case the number of files is less, then
searching for a particular file is faster and easier.
• Simple operations like file creation, search, deletion, and updating are possible with a single-level
directory structure.
• The single-level directory is easier to understand in practical life.
Disadvantages of single-level directory
• In case we want to organise the files in some groups, it is not possible to do so since we cannot
create subdirectories.
• Two file names cannot be the same. In case two files are given the same name, the previous one is
overridden.
• If the number of files is very large, searching a particular file is very inefficient.
• Segregation of important and unimportant files is not possible.
• The single-level directory is not useful for multi-user systems.
Two-Level Directory Structure
We saw how the single-level directory proves to be inefficient if multiple users are accessing the system. If
two different users wanted to create a file with the same name (say [Link]), it was not allowed in a single
level directory.
In a two-level directory structure, there is a master node that has a separate directory for each user. Each user
can store the files in that directory. It can be practically thought of as a folder that contains many folders,
each for a particular user, and now each user can store files in the allocated directory just like a single level
directory.
The pictorial representation of a two-level directory is shown below. For every user, there is a separate
directory. At the next level, every directory stores the files just like a single-level directory. Although not
very efficient, the two-level directory is better than a single-level directory structure.
Advantages of two-level directory
• Searching is very easy.
• There can be two files with the same name in two different user directories. Since they are not in
the same directory, the same name can be used.
• Grouping is easier.
• A user cannot enter another user’s directory without permission.
• Implementation is easy.
Disadvantages of two-level directory
• One user cannot share a file with another user.
• Even though it allows multiple users, still a user cannot keep two same type files in a user directory.
• It does not allow users to create subdirectories.
Tree-Structured Directory Structure
This type of directory is used in our PCs. The biggest disadvantage of a two-level directory was that one
could not create sub-directories in a directory. The tree-structured directory solved this problem. In a tree-
structured directory, there is a root directory at the peak. The root directory contains directories for each
user. The users can, however, create subdirectories inside their directory and also store the files.
This is how things work on our PCs. We can store some files inside a folder and also create multiple folders
inside a folder.
The pictorial representation of a tree-structured directory is shown below. The root directory is highly
secured, and only the system administrator can access it. We can see how there can be subdirectories inside
the user directories. A user cannot modify the root directory data. Also, a user cannot access another user's
directory.
Advantages of tree-structured directory
• Highly scalable compared to the previous two types of directories.
• Allows subdirectories inside a directory.
• Searching is easy.
• Allows grouping.
• Segregation of important and unimportant files is easy.
Disadvantages of tree-structured directory
• As one user cannot enter another user’s directory, this restricts sharing of files.
• Too many subdirectories may make the search complicated.
• Users cannot modify the root directory’s data.
• Files might have to be saved in multiple directories in case all of them do not fit into one.
Acyclic Graph Directory Structure
Suppose there is a file [Link]. Out of the three types of directories we studied above, none of them provide
the flexibility to access the file [Link] from multiple directories, i.e., we cannot access a particular file or
subdirectory from two or more directories. The file or the subdirectory can be accessed only by the directory
it is present inside.
The solution to this problem is presented by the acyclic-graph directory. In this type of directory, we can
access a file or a subdirectory from multiple directories. Hence files can be shared between directories. It is
designed in such a way that multiple directories point to a particular directory or file with the help of links.
A practical example of this is a doc file shared between two users. If any of the users makes a change in the
file, the change is reflected for both the users.
Below is the pictorial representation of the acyclic-graph directory.
Advantages of acyclic- graph directory
• Allows sharing of files or subdirectories from more than one directory.
• Searching is very easy.
• Provides more flexibility to the users.
Disadvantages of acyclic-graph directory
• Harder to implement in comparison to the previous three.
• Since the files are accessed from multiple directories, deleting a file may cause some errors if the
user is not cautious.
• If the files are linked by a hard link, then it is necessary to delete all the references to that file to
permanently delete the file.
File Access Methods in Operating System
File access methods define how data is read from and written to files. Choosing the right method improves
system performance and efficiency.
Types of File Access Methods
• Sequential Access
• Direct Access
• Indexed Sequential Access
1. Sequential Access Method
In this method, records are accessed one after another in order.
To access R8, the system must pass through R6 → R7 → R8
Operations
• Read Next → Read next record
• Write Next → Add record at the end
• Rewind → Move pointer to start
Advantages
• Simple and easy
• Low cost
• Good for sequential processing (e.g., backups)
Disadvantages
• No random access
• Slow for searching
• Not suitable for real-time systems
2. Direct Access Method (Random Access)
In this method, files are divided into blocks, and any block can be accessed directly.
Operations
• Read n → Read nth block
• Write n → Write nth block
• Goto n → Jump to nth block
Advantages
• Fast access
• Supports random access
• Suitable for databases and real-time systems
Disadvantages
• Fragmentation issues
• Complex space management
• Not ideal for variable-length records
3. Indexed Sequential Access Method
This method uses an index to allow both sequential and direct access.
How It Works
Suppose we want to find records of B
First, search the Index Table
Find B → Block 5
Go directly to Block 5
Read the records of B
This avoids scanning the entire file.
First search the index, then directly access the required block.
Advantages
• Supports both sequential and random access
• Faster searching using index
• Efficient for large files
Disadvantages
• Extra memory required for index
• More complex
• Large files may need multi-level indexing
Quick Comparison
Method Access Type Speed Complexity
Sequential Linear only Slow Simple
Direct Random Fast Medium
Indexed Both Faster Complex
File System
A file system provides a mechanism for online storage and access to data and programs for both the
operating system and users.
It consists of two main parts:
1. Collection of Files – Each file stores related data.
2. Directory Structure – Organizes files and provides information about them.
File Concept
A file is a collection of related information stored on secondary storage (like hard disk).
• It is the smallest unit of logical storage.
• Data must be stored inside a file to be written to secondary storage.
Basic Terminology
1. Field
• The smallest unit of data.
• Contains a single value.
• Example: Name, Date, Sensor reading.
• Defined by data type and length.
2. Record
• A collection of related fields.
• Treated as a single unit.
• Example: Employee record (Name, ID, Salary, etc.).
3. File
• A collection of similar records.
• Treated as one unit by users and programs.
• Identified by a name.
4. Database
• A collection of related data.
• May contain multiple files.
• Example: Organization or project data.
File Attributes
Each file has the following attributes:
• Name – Human-readable file name.
• Identifier – Unique number used internally by the system.
• Type – Specifies file type (text, binary, etc.).
• Location – Indicates where the file is stored.
• Size – Current (and sometimes maximum) file size.
• Protection – Access permissions (read, write, execute).
• Time, Date, User ID – Tracks creation, modification, and usage.
File Operations
1. Create
• Allocate space in the file system.
• Add a new entry in the directory with file details.
2. Write
• Specify file name and data to write.
• System locates the file and writes data using a write pointer.
• Pointer updates after writing.
3. Read
• Specify file name and memory location.
• System reads data using a read pointer.
• Pointer updates after reading.
4. Reposition (Seek)
• Move the file pointer to a specific location.
• No actual data transfer occurs.
5. Delete
• Locate file in directory.
• Remove directory entry.
• Free allocated space.
6. Truncate
• Delete file contents but keep attributes.
• File size becomes zero.
• Space is released.