Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Chapter 6 - File System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 41

Chapter Six

File Management

Sli
de
1
File Organizations and Protection
Files & Directories
File naming, types, structure, access
File & Directory attributes & operations
Directory hierarchies
Single level, two level & hierarchical directory systems
Path Names
File systems in different OS
FAT-12, FAT-16, FAT-32, NTFS, ext

Sli
de
2
File is the way to store information in computer system.
File is a collection of related information stored on
secondary storage device.
File is a collection of bits, bytes, characters ,words,
lines or records.
File can be text, image, audio, or video file.

Sli
de
3
The data must survive after the termination of the process
using it.
It must be possible to store very large amount of data.

Multiple processes must be able to access data


concurrently.

Solution is to store those data in units called files on disks


& other media.

Sli
de
4
The data stored in a file must be persistent.

Files are managed by the OS.

How they are structured, used, protected &


implemented are major concerns

The part of the OS that deals with files is known as


the File System

Sli
de
5
It is one fundamental tasks of OS.
Managing files and directory on hard disk.
Allocating and de-allocating space on hard disk.

Sli
de
6
Name : human-readable form.
Identifier: a unique tag number within a file system
Type : Many operating systems support many types of files.
e.g text files, binary, and source files.
Location: Points to file location on device.
Size: space occupied by a file.
protection: controls the access rights of reading, writing,
and executing the file. who can access & who can’t access.
Time, date and user identification
Owner – current owner of file
Read only flag – can it be modified or not
Hidden flag – display or not when listed
Archive flag – to be backed up or not
Sli
de
7
The exact rules depends based on the OS.
However most of them allow files to be:
◦ 1-8 characters (outdated systems)
◦ Digits & several selected symbols
Modern ones supports up to 255 characters
Examples
◦ osslides,osslides1, osslides2, osslides-1, urgent!
Some file systems are case sensitive
DOS, Windows – Case insensitive
UNIX (ubuntu, Linux) – Case sensitive

Sli
de
8
Many OSs support two-part file systems. Parts are
separated by a period (.)
Example: <file name>.<extension>
test.txt, os.pdf, MyClass.java, prog.cpp
Extension indicates something about a file.
Not all OSs are aware of extensions.
◦ UNIX or Linux does not depend on the extension
◦ But some applications may depend on the extension

Sli
de
9
Sli
de
10
Sli
de
11
File type extension definition
Source code .c,.cpp,.java,etc Source code in various langauge

Executable .exe ready-to-run machine- language


program
object .obj,.o Compiled machine language
batch .sh Series of commands to be executed

text .txt,.doc documents


Word .wp, .rtf
processor
library .lib,.dll libraries of routines
Print, view .pdf
Archive .arc,.zip,.tar related files grouped into one file,
sometimes compressed.
Sli
de
Etc. 12
Text file: sequence of characters organized into lines.
Example .txt, .doc,.xls
Sources file: sequence of functions and subroutines.
Object file: sequence of bytes organized into block.
Executable file: contains an encoded sequence of instructions
that the system can execute directly.

Slide 13
Three major types
◦ Regular/Ordinary files – ones that contain user data either
in ASCII or binary form.
e.g; text, databases or executable program.
◦ Directories – are systems files which are used to maintain
the structure of the file system.
◦ These files contain list of file names and other information
related to these files.
◦ store both special and ordinary files
◦ Special files/Device files.
◦ These files represent physical device like disks, terminals,
printers, networks, tape drive etc.
Sli
de
14
Can be categorized as:
1. Sequential access. processing file one after the other.
Read all the data starting from the beginning
Used in early days with magnetic tapes
Example: simple text files, compilers access files
2. Random/Direct access
Can read data in a file out of order
Each record has its own address on the file.
Were possible with the introduction of magnetic disks.
Examples: Data bases
3. Index sequential access: In this access method, an index is built
for every file, with a direct pointer to different memory blocks.
In this method, the Index is searched sequentially, and its pointer can
access the file directly.
Sli
de
15
Different systems allow operations to store & retrieve data from files
◦ Create – create a new file with no data & set initial attributes
◦ Delete – remove the file from system freeing up disk space
◦ Open – before using a files must be open
◦ Read – after opening a file data can be read
◦ Write – after opening a file data can be written
◦ Append - after opening a file data can be written at the end of the
file
◦ Close – when all the access is finished file must be closed
◦ Seek – used in random access a file
◦ Get attributes – get the attributes of a file
◦ Set attributes – set the attributes of a file
◦ Rename – change the name or the extension of a file

Sli
de
16
Used to organize or keep track of files
Are also called folder.(in Windows)
Most OSs consider even directories as files
◦ DOS, UNIX, Linux call directories
◦ While MS-Windows call them as Folders

Sli
de
17
Directories - Single Level Systems
Simplest form of directory system where 1 directory
contains all the files
This single directory is called the root
Problems – in a multi-user systems users can't have files
with same name

Sli
de
18
To avoid the conflict, each user is given a separate
directory

Sli
de
19
Two Level directory structure is not enough when users want to
manage their own files
All most all the commercial OS supports multiple directory levels
However CD-ROM file system has a limit in number of levels in the
hierarchy

Sli
de
20
◦ Create – create a new directory
◦ Delete – delete an existing directory
◦ Opendir – open the directory for reading
◦ Readdir – read the contents of the directory
◦ Closedir – close the directory
◦ Rename – change the name of the directory
◦ Link – allow files to appear in more then one directory. Related
to file sharing
◦ Mounting- A mounted drive is a partition that's mapped to an
empty folder on another partition that has been formatted with
the NTFS file system. (in Windows)

Sli
de
21
When files are in a directory tree there should be a mechanism to locate/access
them.
Absolute path names
Path from the root directory to the file
/ME/NW/nw.ppt
Relative path names
Give relative to the current working directory
If currently in NW directory path name is of a file NW/nw.ppt
When you're specifying a relative pathname, the slash character is not
present at the beginning of the pathname.
If you are pointing to a directory in your pathname that is below your
current one, you can access it by specifying its name. For example, the
directory name:
docs/
refers to the directory docs located in the current directory.

Sli
de
22
File system is a standard for organizing data on a
storage device like a hard drive or a solid state drive. It
is applied when you format a drive or partition.
A computer file system is a way that manages how and
where data on a storage disk(hard disk drive) is stored,
accessed and managed.
File system provides the capability to create, modify,
and delete files, etc.

Sli
de
23
Actually came with Windows 95
Release Namely FAT-32
Max partition size 2TB
More than 4 partitions
File names up to 255 characters
Was backward compatible with FAT-16

Sli
de
24
NTFS – New Technology File System
Initially used in Windows NT
A single partition can be up to 264 bytes
File names can be up to 255 Unicode characters
File system security is inbuilt.
Better performance & more reliable.
Not backward compatible with FAT-16 or
FAT-32

Sli
de
25
Make use of I-nodes
Initially supported only 14 characters but later versions
support 255 characters
File system security is inbuilt.
Supports many file systems
V7
ext, ext2, ext3
NFS – Network File System
VFAT – UNIX version of FAT

Sli
de
26
Make use of File Allocation Table (FAT)
Use of 8+3 character file names
Attributes
◦ Read only, archived, hidden, system
2 versions
FAT-12
Max partition size 2MB
4 separate partitions
FAT-16
Max partition size 2GB
4 separate partitions
Sli
de
27
ext
Supports 14 characters
A single file can be up to 2GB
Later better versions were introduced such as ext2, ext3

Sli
de
28
Allocation methods defines how file is stored in a disk
blocks.
Three types of space allocation methods are:
◦ Contiguous Allocation
◦ Linked Allocation
◦ Indexed Allocation
Goal:
◦ efficient utilization of disk
◦ Fast access of a file

Sli
de
29
Blocks allocated for a file are one after the other.
Every file uses a contiguous address space on disk.
Here, the OS assigns disk address is in linear order.
Disadvantage:
◦ external fragmentation is the biggest issue.

Sli
de
30
Sli
de
31
Sli
de
32
Every file includes a list of links to disk blocks.
The directory contains a link or pointer in the first block of a
file.
there is no external fragmentation
This file allocation method is used for sequential access files.
Problem: direct/random access is not supported.
This method is not ideal for a direct access file.

Data

Slide 33
Sli
de
34
Sli
de
35
Sli
de
36
Provides solutions to problems of contiguous and
linked allocation.
Directory contains the addresses of index blocks of
files.
An index block is created having all pointers to files.
All files should have individual index blocks to store
the addresses for disk space.
Each file has its own index block which stores the
addresses of disk space occupied by the file.
All pointers of a file stored in one place.

Sli
de
37
Sli
de
38
Sli
de
39
Sli
de
40
end

Sli
de
41

You might also like