0% found this document useful (0 votes)
22 views5 pages

File Attributes, Operations, and Access Methods

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)
22 views5 pages

File Attributes, Operations, and Access Methods

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

Os U4

Saturday, January 3, 2026 12:41 AM

1. Illustrate File Attributes and File Operations (6 Marks)


File Attributes
File attributes describe the properties of a file stored in the file system.
The operating system maintains these attributes for file management and protection.
Common File Attributes are:
• Name – Name of the file.
• Identifier – Unique number to identify the file.
• Type – Indicates the type of file (text, binary, etc.).
• Location – Pointer to the location of the file on storage.
• Size – Current size of the file.
• Protection – Access permissions (read, write, execute).
• Time and Date – Creation, modification, and access time.
• Owner/User ID – Identifies the owner of the file.

File Operations
File operations are the actions performed on files by the operating system.
Important File Operations are:
• Create – Creates a new file.
• Open – Opens a file for reading or writing.
• Read – Reads data from a file.
• Write – Writes data into a file.
• Close – Closes an open file.
• Delete – Removes a file from storage.
• Seek – Changes the file pointer position.

Conclusion
File attributes help the operating system identify and manage files, while file operations allow users
and programs to access and manipulate file data efficiently.

2. Explain in detail File Access Method and its Types (6


Marks)
File Access Method
A file access method defines the way in which data is read from or written to a file.
The operating system provides different access methods based on how data is stored and used.

Types of File Access Methods


1. Sequential Access
In sequential access, data is accessed one record after another in order.
This is the simplest access method.
Characteristics:
• Records are processed in sequence
• File pointer moves automatically
• Used in tape storage
Example:
Reading a text file from beginning to end.

2. Direct (Random) Access


In direct access, data can be accessed directly without reading previous records.

New Section 1 Page 1


In direct access, data can be accessed directly without reading previous records.
Each record has a unique address.
Characteristics:
• Faster access
• Used in disk storage
• Supports random access
Example:
Accessing a specific record in a database.

3. Indexed Access
Indexed access uses an index to locate records quickly.
The index contains key values and pointers to data blocks.
Characteristics:
• Combines sequential and direct access
• Faster searching
• Requires extra storage for index
Example:
Library catalog system.

Conclusion
Different file access methods are used to improve efficiency and speed of file operations based on
application needs

3 (a) Explain Directory Structure (6 Marks)


A directory structure is used by the operating system to organize files on secondary storage.
A directory contains information about files such as name, location, size, and type.
The directory structure helps in:
• Easy file access
• File organization
• Protection and sharing of files

Types of Directory Structure


• Single-Level Directory
All files are stored in a single directory.
Simple but causes name conflicts.
• Two-Level Directory
Separate directory for each user.
Avoids name conflicts but limited sharing.
• Tree-Structured Directory
Directories are arranged in a hierarchical structure.
Supports subdirectories and better organization.
• Acyclic Graph Directory
Allows sharing of files and directories.
Uses links but avoids cycles.
• General Graph Directory
Allows cycles and sharing.
More flexible but complex to manage.

3 (b) Differentiate between the Levels in Directory Structure


(6 Marks)
Directory Level Description
Single-Level One directory for all files
Two-Level One directory per user

New Section 1 Page 2


Two-Level One directory per user
Tree Structure Hierarchical structure with subdirectories
Acyclic Graph Shared files without cycles
General Graph Shared files with cycles

Conclusion
Directory structures help the operating system to organize files efficiently, provide easy access, and
support file sharing and protection.

4. Describe Three Basic Disk Space Allocation Methods (6


Marks)
Disk space allocation methods define how files are stored on disk.
The operating system uses different methods to allocate disk blocks to files.

1. Contiguous Allocation
In contiguous allocation, all blocks of a file are stored in continuous locations on the disk.
Features:
• Simple to implement
• Fast access
• Causes external fragmentation
Example:
File stored in blocks 10–15.

2. Linked Allocation
In linked allocation, file blocks are linked together using pointers.
Blocks may be stored anywhere on disk.
Features:
• No external fragmentation
• Slower access due to pointer traversal
• Pointer space overhead
Example:
Block 5 → Block 12 → Block 20.

3. Indexed Allocation
In indexed allocation, an index block contains addresses of all file blocks.
File blocks can be accessed directly using the index.
Features:
• Supports direct access
• No external fragmentation
• Extra space required for index block
Example:
Index block points to file blocks.

Conclusion
Each disk allocation method has its own advantages and limitations, and the OS selects them based
on performance and storage needs.

5. Explain Free Space Management (6 Marks)


Free space management is a technique used by the operating system to keep track of free (unused)

New Section 1 Page 3


Free space management is a technique used by the operating system to keep track of free (unused)
disk blocks.
It helps the OS to allocate and deallocate disk space efficiently when files are created or deleted.

Need for Free Space Management


• To know which disk blocks are free
• To allocate space to new files
• To improve disk utilization

Methods of Free Space Management


1. Bit Vector (Bitmap)
Each disk block is represented by one bit.
• 0 → free block
• 1 → allocated block
This method is simple and efficient.

2. Linked List
All free disk blocks are linked together.
The OS follows the list to find free blocks.

3. Grouping
Free blocks are grouped together and stored in a single block.
Reduces the number of disk I/O operations.

4. Counting
Stores the starting address of free blocks and the count of free blocks.
Useful when many free blocks are continuous.

Conclusion
Free space management helps the operating system use disk space efficiently and supports fast
allocation of storage

6 (a) Draw the neat diagram of Magnetic Disk (3 Marks)


Neat Diagram (Draw this in exam)

Disk Platter
(Tracks &
Sectors)


Read / Write
Head
|
Disk Arm

Label these in exam:


• Disk platter
• Tracks
• Sectors
• Read/Write head
• Disk arm

New Section 1 Page 4


• Disk arm

6 (b) Explain the working of Magnetic Disk (3 Marks)


A magnetic disk is a secondary storage device used to store data permanently.
Data is stored on the disk surface in the form of tracks and sectors.
Working
• The disk platter rotates at high speed
• The read/write head moves over the disk surface
• Data is read or written by magnetizing disk surface
• Each access involves seek time, rotational latency, and transfer time

Conclusion
Magnetic disks provide large storage capacity with moderate access speed, and are widely used in
computer systems

7. Describe Different Types of Disk Attachment (6 Marks)


Disk attachment refers to the way secondary storage devices are connected to a computer system.
Different disk attachment methods are used based on performance and usage.

1. Host-Attached Storage
In this type, disks are directly attached to the computer system.
The operating system manages the disk using local I/O ports.
Example: Internal hard disk connected to a PC.

2. Network-Attached Storage (NAS)


In NAS, storage devices are connected through a network.
Files are accessed using network protocols.
Example: File servers used in offices.

3. Storage Area Network (SAN)


SAN connects storage devices using a high-speed network.
It provides block-level storage and high performance.
Example: Storage used in data centers.

4. Direct-Attached Storage (DAS)


Storage devices are attached directly without a network.
Simple and cost-effective.
Example: External hard drives.

Conclusion
Different disk attachment methods are used to meet performance, scalability, and storage needs of
systems

New Section 1 Page 5

You might also like