cs file management ref
TRANSCRIPT
-
8/13/2019 CS File Management Ref
1/23
Computer Systems
-
8/13/2019 CS File Management Ref
2/23
Content
Understand
What is a file and a filesystem?
File Attributes File Operations
What is a directory?
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 2Restricted Aricent Group 2011
Filesystem implementation
Overview of UNIX and DOS
-
8/13/2019 CS File Management Ref
3/23
Files
The computer manipulates and stores information.
The information is stored either in main memory or secondary storage
i.e. disks in the form of files.
Consider an analogy of attendance register used by professor in the college fortaking attendance. Each professor takes attendance in his individual attendance
register for his session.
The attendance register is a file which contains information about the attendance
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 3Restricted Aricent Group 2011
o eac s u en .
In the analogy, it is clear that any organized information stored persistently is a
file.
A file is a logical unit to store any organized information e.g. telephone
directory, to store a video etc.
-
8/13/2019 CS File Management Ref
4/23
The OS allows users to manage files with filesystem.
A Filesystem is a logical arrangement of files.
To uniquely identify an attendance register, each attendance register is given aname to access it easily.
Similarly each file is given a name for a user to uniquely identify it.
Since each professor is having his own attendance register for his session for aparticular batch of students, the attendance registers are organized in a specificorder when submitted in a office to access it efficiently.
The attendance registers from all professors taking session for a batch i.e.
File System
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 4Restricted Aricent Group 2011
B.Tech.2n year, Electronics branch are kept together under Electronics branchcategory ,which is same as files related to a particular computer application arekept in a directory.
The directory stores all files related in a logical way e.g. files belonging to a specificcomputer application.
For the entire batch of B.Tech ,all files are kept under B.Tech.category which isagain a directory on top of branch wise category (directory).
In the analogy it clearly states files and directories are logically arranged in ahierarchical order.
-
8/13/2019 CS File Management Ref
5/23
File System
Courses
B.Tech. M.Tech. MBA
Electronics IT IT Marketing Finance
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 5Restricted Aricent Group 2011
2nd year 2nd year Ist year 1st year2nd year 1st year
-
8/13/2019 CS File Management Ref
6/23
-
8/13/2019 CS File Management Ref
7/23
File Operations
The files are used for storing the information.
The file information is stored in inode for UNIX and in file control block (FCB)
for MS-DOS.
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 7Restricted Aricent Group 2011
-
8/13/2019 CS File Management Ref
8/23
The files are associated with different operations for storing and retrieval of
information from a file.
Consider the same analogy of attendance register ,the attendance register must be
opened for taking attendance of student.
The professor writes as well as reads from register.
The professor close the register.
He deletes the name of the student from his attendance re ister if an student et his
File Operations
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 8Restricted Aricent Group 2011
admission cancelled.
He adds the name of the new student ,who takes new admission in his class.
Files are also associated with similar types of operation.
User performs various operations e.g.open,read,write,close.
-
8/13/2019 CS File Management Ref
9/23
File related system calls
The system calls related to files are as follows:
Create
The file is created with no data.
Open
The file is opened before the file is accessed.
Read
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 9Restricted Aricent Group 2011
.
Write
Date are written to the specific position in a file .
Close
The file is not needed so it is closed, which releases the space occupied by the file.
What are the other operations which user can perform on a file and the
related system calls?
-
8/13/2019 CS File Management Ref
10/23
Directories
File system organize files in directories.
The directories are arranged in a hierarchical order.
The topmost directory is called as a root directory.
/
B C D
Root Directory
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 10Restricted Aricent Group 2011
FE G IH J
K L
MFile
-
8/13/2019 CS File Management Ref
11/23
Directories
When files are organized hierarchically, some way is needed for
specifying file names.
There are two methods:
Absolute path name
It consist of the path from the root directory to the file.
For example: The path /B/E/K/M means that root directory contains a
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 11Restricted Aricent Group 2011
, ,
subdirectory K,which contains file M.
Relative path name
The pathnames are taken relative to the working directory.
A user can designate one directory as the current working directory.
For example: If the current working directory is K then to access file M ,where
the absolute pathname is /B/E/K/M ,the relative pathname is M.
If the current working directory is E,the relative pathname is K/M
-
8/13/2019 CS File Management Ref
12/23
File System
File system organizes the files on disk.
There are different filesystem in different OS.
FAT: old windows and MS-DOS standard
NFS : windows current standard
FFS : UNIX standard
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 12Restricted Aricent Group 2011
-
8/13/2019 CS File Management Ref
13/23
File System Layout
MBR
Entire disk
Partition Table Disk Partition
Restricted Aricent Group 2011The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 13Restricted Aricent Group 2011
Boot Block Super Block Free Space
Management
I-nodes Root
Directory
Files and
Directories
-
8/13/2019 CS File Management Ref
14/23
File System Implementation
File Systems are stored on disks.
Disks are divided up into multiple partition with independent file systems on
each partition.
Master Boot Record (MBR)
It is used to boot the computer and is sector 0 on the disk.
When the computer is booted, the BIOS reads in and executes the MBR.
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 14Restricted Aricent Group 2011
The MBR program reads the first block called the boot block . Partition table
It has the starting and ending address of each partition.
Boot Block
The program (bootstrap loader) in the boot block loads the OS contained in the
partition. In UNIX it is known as boot block and in Windows it is called partition
boot sector.
-
8/13/2019 CS File Management Ref
15/23
File System Implementation
Superblock
It has information about the filesystem which is read into memory when computer is
booted .
The information is as follows:
Block size
How much data a block can hold.
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 15Restricted Aricent Group 2011
For example: The attendance register page is a block and the size of a page in attendance
register is same as block size.
Free blocks
Used blocks
In UNIX it is called as superblock and in windows the information of superblock isstored in master file table.
What other information a superblock has for filesystem so that files are managed
effectively and efficiently?
-
8/13/2019 CS File Management Ref
16/23
-
8/13/2019 CS File Management Ref
17/23
MS-DOS
The files and directories are arranged in a hierarchical directory system.
Disk block is some multiple of 512 bytes.
It has a 32-byte directory entry which contains the
filename,attributes,creation date and time, starting block and file size.
Restricted Aricent Group 2011The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 17Restricted Aricent Group 2011
File name
Extension Attributes
Time
Reserved
Date First Block
Number Size
8 3 1 10 2 2 2 4
-
8/13/2019 CS File Management Ref
18/23
MS-DOS
It use FAT (File Allocation Table) for allocating blocks on disk.
MS-DOS keeps track of file blocks via FAT in main memory.
The directory entry contains the number of the first file block.
Each file is a linked list of disk blocks.
The disk blocks may or may not be contiguous.
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 18Restricted Aricent Group 2011
-
8/13/2019 CS File Management Ref
19/23
UNIX
The files and directories are arranged in a hierarchical directory system.
A UNIX directory entry contains one entry for each file in that directory.
A directory entry contains only two fields the file name(14 bytes) and the
inode number for that file(2 bytes).
Bytes(2) Bytes(14)
Restricted Aricent Group 2011The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 19Restricted Aricent Group 2011
i-node number File name
Directory entry
-
8/13/2019 CS File Management Ref
20/23
-
8/13/2019 CS File Management Ref
21/23
References
Chapter 10,11,OS Principles ,Silberschatz,Galvin,Gagne
Chapter 6,Modern Operating Systems,Tanenbaum
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 21Restricted Aricent Group 2011
-
8/13/2019 CS File Management Ref
22/23
Aricent Group makes no representations or warranties with respect to
contents of these slides and the same are being provided as is. The
content/materials in the slides are of a general nature and are not intended to address the specific circumstances of any particular
individual or entity. The material may provide links to internet sites (for
the convenience of users) over which Aricent Group has no control and
Disclaimer
The contents here are for Aricent Group internal training purposes only and do not carry any commercial value 22Restricted Aricent Group 2011
for which Aricent Group assumes no responsibility for the availability orcontent of these external sites. While the attempt has been to
acknowledge sources of materials wherever traceable to an individual or
an institution; any materials not specifically acknowledged is purely
unintentional
-
8/13/2019 CS File Management Ref
23/23
an ou