Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

2_Week8 Lecture Note File Systems

The document outlines the course CSC314: Introduction to Operating Systems I, taught by Dr. U. C. Ogude at the University of Lagos, detailing the course structure, key topics, and learning outcomes. It covers essential concepts related to file systems, including file types, attributes, operations, and organization, as well as directory structures and file management techniques. The course utilizes the textbook 'Understanding Operating Systems' and includes references to additional literature for further study.

Uploaded by

Abdullahi Ishola
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

2_Week8 Lecture Note File Systems

The document outlines the course CSC314: Introduction to Operating Systems I, taught by Dr. U. C. Ogude at the University of Lagos, detailing the course structure, key topics, and learning outcomes. It covers essential concepts related to file systems, including file types, attributes, operations, and organization, as well as directory structures and file management techniques. The course utilizes the textbook 'Understanding Operating Systems' and includes references to additional literature for further study.

Uploaded by

Abdullahi Ishola
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 38

CSC314: Introduction to

Operating Systems I

Course Instructor
Dr. U. C. Ogude

Department of Computer Sciences


University of Lagos
Course Outline
Week 7: Device Management: Principles of I/O Devices, Device
Controllers, Interrupt

Week 8: File Systems: File Naming, File Structure, File type and
Directories

Week 9: Introduction to Protection and Security

Week 10: Network Operating Systems

Week 11: Concurrency

 Week 12: Second Continuous Assessment

Week 13: Examination


Course Material
TEXT BOOK
“Understanding Operating
Systems”, Sixth Edition,
Course Technology, Cengage Learning,
20 Channel Center Street Boston,
MA 02210 USA.

by

Ann McIver McHoes and Ida M. Flynn

Use lecture notes/slides as study


guide
References
Abraham Silberschatz, Peter Baer Galvin and Greg Gagne, “Operating System
Concepts”, 9th Edition, John Wiley and Sons Inc., 2013.

William Stallings, “Operating Systems – Internals and Design Principles”, 7th


Edition, Prentice Hall, 2011.

Andrew S. Tanenbaum, “Modern Operating Systems”, Second Edition, Addison


Wesley, 2001.

Charles Crowley, “Operating Systems: A Design-Oriented Approach”, Tata


McGraw Hill Education”, 1996.

D M Dhamdhere, “Operating Systems: A Concept-Based Approach”, Second


Edition, Tata McGraw-Hill Education, 2007.

http://nptel.ac.in/.
Week 8:
File Systems
Presentation Outline
Concept of File Systems
File Types and Attributes

File Structure and Directories

Sequential Arrangement of Contents of Files

File Operations

File System Architecture and File Organisation


Learning outcomes for study session:

At the end of this study session, you should be

able to:
Understand the concept of file systems

Understand File Structure and Directories

Know the Operations perform on Files

Understand File System Architecture and Organisation


File Systems
A file is a container for data
A file is a resource for recording data discretely in a
computer storage device

A file is a collection of related information defined by its


creator.

Commonly, files represent programs (both source and object


forms) and data.
Types of data:
Numeric
Character (including symbols)
Binary (Boolean)
File Systems Cont.
The operating system is responsible for the following activities in

connections with file systems:

 File creation and deletion.

 Directory creation and deletion.

 Support of primitives for manipulating files and directories.

 Mapping files onto secondary storage.

 File backup on stable (nonvolatile) storage media.


File Systems Issues
Important to the user:

Persistence — data stays around between power cycles and


crashes

Ease of use — can easily find, examine, modify, etc. data

Efficiency — uses disk space well

Speed — can get to data quickly

Protection — others can’t corrupt (or sometimes even see) my


data
Sequential Arrangement of Contents of Files
Four terms are in common use when discussing files:
A field is a basic element of data and contains a single value e.g. Surname

A record is a collection of fields that can be treated as one unit by an


application e.g. Employee record

A file is a collection of similar records. The file is treated as a single entity


by the application and can be referenced by name

A database is a collection of one or more types of files. Data in a


database are related e.g. Unilag students, and the relationship is such that
the database can be used by different applications
File Attributes
Computer files are organized in a file system which keeps track of where the files are,
and enables people to access them
On most operating systems, files are organized into 1-dimensional arrays of bytes
The format of the file is defined by its content, specifying how the bytes must be
organized and interpreted meaningfully
Files have certain attributes:
Name – only information kept in human-readable form.
Type – needed for systems that support different 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 – data for protection, security, and usage
monitoring.
Information about files are kept in the directory structure, which is maintained on the
disk.
Files and File Systems
A file management system is a set of system software that provides services to

users and applications in the use of files.

Typically, the only way that a user or application may access files is through the

file management system.

This relieves the user or programmer of the necessity of developing special-purpose

software for each application.

The file management system provides a consistent, well-defined means of

controlling its most important asset.


Files and File Systems Cont.
The following are the objectives for a file management system:
To meet the data management needs and requirements of the user, which
include storage of data and the ability to perform certain operations
To guarantee, to the extent possible, that the data in the file are valid
To optimize performance, both from the system point of view in terms of
overall throughput and from the user’s point of view in terms of response
time
To provide I/O support for a variety of storage device types
To minimize or eliminate the potential for lost or destroyed data
To provide a standardized set of I/O interface routines to user processes
To provide I/O support for multiple users, in the case of multiple-user
systems
Files and File Systems Cont.
The file system permits users to create data collections, called files, with
desirable properties, such as:
Long-term existence:
Files are stored on disk or other secondary storage and do not disappear when
a user logs off.
Sharable between processes:
Files have names and can have associated access permissions that permit
controlled sharing.
Structure:
Depending on the file system, a file can have an internal structure that is
convenient for particular applications.
In addition, files can be organized into hierarchical or more complex structures
to reflect the relationships among files.
File Operations
A file system provides not only a means to store data organized
as files, but a collection of functions that can be performed on files.

Information about files are kept in the directory structure, which is


maintained on the disk

Some of the basic operations on files include:

Create: A new file is defined and positioned within the structure of


files.

Delete: A file is removed from the file structure and destroyed.

Read: A process reads all or a portion of the data in a file.


File Operations Cont.
Write: A process updates a file, either by adding new data that

expands the size of the file or by changing the values of existing

data items in the file.

Open: An existing file is declared to be “opened” by a process,

allowing the process to perform functions on the file.

Close: The file is closed with respect to a process, so that the

process no longer may perform functions on the file, until the

process opens the file again.


File Types – Name.extension
File System
Architecture
File Management
Techniques
File Organization
The term file organization is used to refer to the logical
structuring of the records as determined by the way in which they
are accessed.

The physical organization of the file on secondary storage depends


on the blocking strategy and the file allocation strategy.

In choosing a file organization, several criteria are important:

Short access time

Ease of update

Economy of storage

Simple maintenance

Reliability
Types of File Organization
There are five basic File organizations.

Most structures used in actual systems either fall into


one of these categories or can be implemented with a
combination of these organizations.

Pile Organization
Least complicated. Data is collected in the order in which they
arrive.

Data is simply accumulated and saved. Records may have


different fields, or similar fields in different orders.

Thus, each field should be self-describing, including a field name


Types of File Organization Cont.
Sequential File Organization
Most common. A fixed format is used for records.

All records are of the same length, consisting of the same number
of fixed-length fields in a particular order.

Because the length and position of each field are known (file
attributes), only the values of fields need to be stored in the field.

One particular field, usually the first field in each record, is


referred to as the key field.

The key field uniquely identifies the record.


Types of File Organization Cont.
The indexed sequential file

It maintains the key characteristic of the sequential file: records


are organized in sequence based on a key field.

Two features are added: an index to the file to support random


access, and an overflow file (used mostly for errors and duplicates).

The index provides a lookup capability to reach quickly the vicinity


of a desired record.

In the simplest indexed sequential structure, a single level of


indexing is used.
Types of File Organization Cont.
The indexed file

Employs multiple indexes, one for each type of field that may be
the subject of a search.

Records are accessed only through their indexes.

Two types of indexes are used.

An exhaustive index contains one entry for every record in the
main file. The index itself is organized as a sequential file for ease
of searching.

A partial index contains entries to records where the field of


interest exists.
Types of File Organization Cont.
The direct or hashed file

The direct, or hashed, file exploits the capability found on disks to


access directly any block of a known address.

As with sequential and indexed sequential files, a key field is


required in each record.

However, there is no concept of sequential ordering here. The key


value is hashed.
File System Organization
Directory Structure
A collection of nodes containing information about all files.

Directory

Files
F1 F2 F4
F3
Fn

 Both the directory structure and the files reside on disk.


 Backups of these two structures are kept on tapes.
Information in a Device
Directory
Name

Type

Address

Current length

Maximum length

Date last accessed (for archival)

Date last updated (for dump)

Owner ID (who pays)

Protection information
Operations Performed on
Directory
To understand the requirements for a file structure, it is helpful

to consider the types of operations that may be performed on

the directory:

Search: When a user or application references a file, the directory


must be searched to find the entry corresponding to that file.

Create file: When a new file is created, an entry must be added to


the directory.

Delete file: When a file is deleted, an entry must be removed


from the directory.
Operations Performed on Directory
Cont.
List directory: All or a portion of the directory may be requested.

Generally, this request is made by a user and results in a listing of

all files owned by that user, plus some of the attributes of each file

(e.g., type, access control information, usage information)

Updated directory: Because some of file attributes are stored in

the directory, a change in one of these attributes requires a change

in the corresponding directory entry


Organize the Directory (Logically) to
Obtain
Directories are organized logically to achieve:
Efficiency – locating a file quickly.

Naming – convenient to users.

 Two users can have same name for different files.

 The same file can have several different names.

Grouping – logical grouping of files by properties, (e.g., all Java


programs, all games, …)
Single-Level Directory
A single directory for all users.

 Naming problem
 Grouping problem
Two-Level Directory
Separate directory for each user.

 Must reference a path name, hence no


requirement for unique names
 Efficient searching
 No grouping capability
Tree-Structured
Directories
Tree-Structured Directories
Cont.
Efficient searching

Grouping Capability

Current directory (working directory)


 cd /spell/mail/prog
 type list
Tree-Structured Directories Cont.
Absolute or relative path name
Creating a new file is done in current directory.
Delete a file
rm <file-name>
Creating a new subdirectory is done in current directory.
mkdir <dir-name>
Example: if in current directory /spell/mail
mkdir count

mail

prog copy prt exp count

• Deleting “mail”  deleting the entire subtree rooted by “mail”.


File Sharing
Sharing of files on multi-user systems is desirable

Sharing may be done through a protection scheme

User IDs identify users, allowing permissions and protections to be

per-user

Group IDs allow users to be in groups, permitting group access

rights

On distributed systems, files may be shared across a network

Network File System (NFS) is a common distributed file-sharing

method

You might also like