Question
File system
1. Explain
a File System.
Answer
a.
File system is a method for storing and
organizing computer files and the data they contain to make it easy to find and
access them.
b.
File systems may use a data storage device such
as a hard disk or CD-ROM.
c.
Involve maintaining the physical location of the
files.
d.
Provide access to data on a file server by
acting as clients for a network protocol.
Objectives of the File Management
2.
List six objectives of the file management in operating
system
Answer
a.
To minimize or eliminate the potential for lost
or destroyed data.
b.
To meet the data management needs and
requirements of the user which include storage of data and the ability to
perform the aforementioned operations.
c.
To guarantee, to the extent possible, that the
data in the file are valid.
d.
To provide I/O support for a variety of storage
device types.
e.
To provide a standardized set of I/O interface
routines to use processes.
f.
To optimize performance, both from the system
point of view in terms of overall throughput.
Fields, Record, File, and Database
3.
What is the Fields, Record, File, and Database?
Answer
Fields
·
Is a collection of similar records
·
Treated as a single entity
·
May implement access control mechanisms
Record
·
Collection of related fields
·
Treated as a unit
File
·
Have file names
·
Is a collection of similar records
·
Treated as a single entity
·
May implement access control mechanisms
Database
·
Collection of related data
·
Relationships exist among elements
·
Consists of one or more files
4.
List the basic function of File Management to control a
file.
Answer
a.
Create
b.
Delete
c.
Open
d.
Close
e.
Read
f.
Write
File structures
5.
Describe THREE (3) types of file structures
below:
a.
Structure (record sequence)
b.
Unstructured (byte sequence)
c.
Tree
Answer
a.
Structure (record sequence)
·
Collection of bytes treated as a unit.
·
Example: employee record.
·
Operations at the level of record (read_rec,
write_rec).
·
File is a collection of similar records.
·
OS can optimize operations on records.
b.
Unstructured (Byte sequence)
·
Read or write a number of byte.
·
Unstructured or linear.
·
Simplifies file management for the OS.
·
Applications can impose their own structure.
·
Used by LINUX, Windows, most modem OSes.
c.
Tree
·
Record of variable length.
·
Each has an associated key.
·
Record retrieval based on key.
·
Used on some data processing systems
(mainframes).
·
Mostly incorporated into modem databases.
6.
Draw the Example of Tree Structured Directory.
Answer
Method of Storing File
1.
Files are
allocated disk spaces by operating system. Operating systems deploy following
three main ways to allocate disk space to files. List and explain three types
of storing methods.
Answer
a. Contiguous Allocation
b. Linked Allocation
c. Indexed Allocation
Contiguous
Allocation
·
Each file occupies a contiguous address space on disk.
·
Assigned disk address is in linear order.
·
Easy to implement.
·
External fragmentation is a major issue with this type of allocation
technique.
Linked Allocation
·
Each file carries a list of links to disk blocks.
·
Directory contains link / pointer to first block of a file.
·
No external fragmentation
·
Effectively used in sequential access file.
·
Inefficient in case of direct access file.
Indexed Allocation
·
Provides solutions to problems of contiguous and linked allocation.
·
A index block is created having all pointers to files.
·
Each file has its own index block which stores the addresses of disk
space occupied by the file.
·
Directory contains the addresses of index blocks of files.
2.
What is the Index-Node?
Answer
- An i-node (index node) is
a control structure that contains the key information needed by the
operating system for a particular file
- Several file names may be associated
with a single i-node
Diagram of Contiguous Allocated Method
3.
Draw a diagram of storing file using contiguous
allocated method based on the file allocation in table 2.
Table 1
File name
|
Start block
|
Length
|
A
|
2
|
3
|
B
|
9
|
5
|
C
|
18
|
8
|
D
|
30
|
2
|
E
|
26
|
3
|
Answer
Linked List Allocated Using Index Method.
1.
Draw a diagram of storing file
using linked list allocated using index method.
Answer
Diagram of Linked List Allocation Method
1.
Draw a diagram of storing file
using linked list allocation method based on the file allocation in following
statement.
“A file (File B) of five blocks might start at block 1 and continue at
block 8, then block 3, then block 14 and finally block 28.”
Answer
Diagrams of Storing File Methods
1.
With aid diagrams explain the
methods of storing file below.
a. Contiguous Allocation
b. Linked Allocation
c. Indexed Allocation
Answer
Contiguous Allocation
·
Each file occupies a set of contiguous on the
disk
·
Simple – only starting location (block #) and
length (number of blocks) are required.
·
Suits sequential or direct access.
·
Fast (very little head movement) and easy to
recover in the event of system crash.
Linked Allocation
·
Each file is a linked list of disk blocks
·
Blocks may be scattered anywhere on the disk
·
Each node in list can be a fixed size physical
block or a contiguous collection of blocks.
·
Allocate as needed and then link together via
pointer.
Indexed Allocation
·
Bring
all pointers together into the index block
·
Need
index table
·
Support
sequential, direct and indexed access
·
Dynamic
access without external fragmentation, but have overhead of index block.
Caching Enhances File System Performance
1.
How caching enhances file system
performance?
Answer
a.
Small amount of fast memory
b.
Sits between normal main memory and CPU
c.
May be located on CPU chip or module
ReplyDeleteA file system is a method and structure wootingdoublemovement that an operating system uses to manage and organize data on storage devices, enabling users to create, retrieve, and store files efficiently.