0% found this document useful (0 votes)
34 views14 pages

CH6 1

The document discusses file management in operating systems. It defines what a file is and describes file attributes like name, size, location etc. It also explains different file types, file structures, and common file operations like creating, reading, writing and deleting files.

Uploaded by

tester
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views14 pages

CH6 1

The document discusses file management in operating systems. It defines what a file is and describes file attributes like name, size, location etc. It also explains different file types, file structures, and common file operations like creating, reading, writing and deleting files.

Uploaded by

tester
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Operating System

Chapter 6
File Management
MRS A.S.KHANDAGALE

1
2
File
• A file is a collection of correlated information which is recorded on
secondary or non-volatile storage like magnetic disks, optical disks,
and tapes.
• It is a method of data collection that is used as a medium for giving
input and receiving output from that program.
• In general, a file is a sequence of bits, bytes, or records whose meaning
is defined by the file creator and user.

3
• Files are mapped by the operating system onto the physical devices.
• The information in a file is defined by its creator ,Many different types of
information may be stored in a file: source programs,object
programs,executable programs,numeric data,text,payroll records,graphic
images,sound recordings and so on.
• A file has certain defined structure according its type.
• A text file is a sequence of characters organized into lines; a source file is a
sequence of subroutines and functions ,each of which is further organized as
declarations followed by executable statements.
• An object file is sequence of bytes organized into blocks understandable by
the system,s linker
• An executable file is a series of code sections that the loader can bring into
memory and execute
4
Objectives for File Management System

• To meet the data management needs and requirements of the user


which include storage of data and the ability to perform the mentioned
operations.
• To provide I/O support for variety of storage device types.
• To minimize the potential for lost or destroyed data

5
File Attributes

A file has a name and data. Moreover, it also stores meta information like file creation date
and time, current size, last modified date, etc. All this information is called the attributes of a
file system.
Here, are some important File attributes used in OS:
Name:- This denotes the symbolic name of the file. The file name is the only attribute
that is readable by humans easily.
Identifier:-This denotes the file name for the system. It is usually a number and
uniquely identifies a file in the file system.
Type:-If there are different types of files in the system, then the type attribute denotes
the type of file.
Location:-This points to the device that a particular file is stored on and also the
location of the file on the device.
Size:- This attribute defines the size of the file in bytes,words or blocks. It may also
specify the maximum allowed file size.
Protection:-The protection attribute contains protection information for the file such
as who can read or write on the file.
Time, date and security:- It is used for protection, security, and also used for monitoring6
Operations on Files
• The operations that can performed on a file are −
Creating a file
To create a file, there should be space in the file system. Then the entry for the
new file must be made in the directory. This entry should contain information
about the file such as its name, its location etc.
Reading a file
To read from a file, the system call should specify the name and location of the
file. There should be a read pointer at the location where the read should take
place. After the read process is done, the read pointer should be updated.
Writing a file
To write into a file, the system call should specify the name of the file and the
contents that need to be written. There should be a write pointer at the location
where the write should take place. After the write process is done, the write
pointer should be updated. 7
Deleting a file
The file should be found in the directory to delete it. After that all the file
space is deleted so it can be reused by other files.
Repositioning in a file
This is also known as file seek. To reposition a file, the current file value is
set to the appropriate entry. This does not require any actual I/O operations.
Truncating a file
This deletes the data from the file without destroying all its attributes. Only
the file length is reset to zero and the file contents are erased. The rest of
the attributes remain the same.
Other common operations include appending new information to the end of an
existing file and renaming an existing file
8
File Types
• To operate on the file in reasonable way an operating system uses the
type of file.
• File names given in easy human convenient manner.
• The file name is split into two parts a name of file and extension.
• For example “student.xls” the file name is student and it is created in
MS-Excel application
• The system uses the extension to indicate the type of the file and the
type of operations that can be done on that file.
• Only a file with .com,.exe or .bat extension can be executed,for
instance.
9
File Types
File Type Usual extension Function
Executable exe, com, bin or ready-to-run machine- language program
none
Object obj, o complied, machine language, not linked
Source code c. p, pas, 177, asm, source code in various languages
a
Batch bat, sh Series of commands to be executed
Text txt, doc textual data documents

Word processor doc,docs, tex, rrf, various word-processor formats


etc.
Library lib, h,dll libraries of routines

Print or View Ps,gif,pdf,dvi Ascii or binary file in a format or printing and viewing

Archive arc, zip, tar related files grouped into one file, sometimes compressed.
Multimedia Avi,mp3,mpeg Binary file containing audio or video information 10
11
File Structure
File can be structured in any of the several ways
The 3 common possibilities are
1) Byte sequence
2) Record Sequence
3) Tree

12
1)Stream of Bytes (a)
OS consider a file to be unstructured and as stream of bytes
2)Records (b)
A file is a sequence of fixed length record.For example Employee
records
3)Tree of records
A file contains tree of records not necessarily all the same length
Records can be of variable length
Each record has an associated key,The record retrieval is based on the
key

13
Thank You

14

You might also like