Professional Documents
Culture Documents
FILES MANAGEMENT
Files
Directories
Secondary storage management
File
A file is a collection of similar records.
The file is treated as a single entity by users and applications and
File management
The way in which an operating system organizes , structures ,
File Management
All computer applications need to store and retrieve information.
FILE SYSTEM
Long term file storage
File Names
Files are an abstraction
mechanism.
Many operating systems support
two-part file names
file extension usually indicates
Unix
long file names (255 bytes)
include special characters
case sensitive (myshell.c !=
Myshell.c)
MS-DOS
6
file name = 8 chars, ., 3-char
File Structure
Unstructured:
The os does not know or care what is in the file
All it sees are bytes.
Any meaning must be imposed by user-level programs.
Both UNIX and Windows use this approach
File Types
Regular files
are the ones that contain user
information.
Directories
are system files for maintaining the
structure of the file system.
Character special files
are related to input/output and used
to model serial I/O devices such as
terminals, printers, and networks.
Block special files
8
are used to model disks.
Regular Files
ASCII files
ASCII files consist of lines of text
They can be displayed and printed as is
They can be edited with any text editor
Easy to connect the output of one program to
the input of another
binary files
They are not ASCII files
Executable, archive, etc
They have some internal structure known to
programs that use them
Regular Files
Executable
10
Archive
File Access
Sequential access
read all bytes/records from the beginning
cannot jump around, could rewind or back up
convenient when medium was magnetic tape
Random access
bytes/records read in any order
essential for data base systems
read can be
move file marker (seek), then read or
read and search
11
File Operations
Any file system provides not only a means to store data organized as files,
but a collection of functions that can be performed on files.
Typical operations include the following:
Create: A new file is defined and positioned within the structure of files.
Delete: A file is removed from the file structure and destroyed.
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.
Read: A process reads all or a portion of the data in a file.
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.
Some other operations
Append, Seek, Get attributes, Set Attributes, Rename, Lock
12
File Attributes
File attributes :- name ,type, location, size, protection, time, data,
13
File Attributes
14
CHAPTER SIX
FILES MANAGEMENT
Files
Directories
Secondary storage
management
15
Directories
16
Directory system
Single level
Two level
Hierarchic
al
17
Path Names
Absolute path name:
Unix:
/usr/home/desu/teaching/lec22.ppt
Windows: C:\Users\tedo\Desktop\Chapter6
new
../teaching/lec22.ppt.txt
18
19
Directory Operations
Create
Delete
Opendir
Closedir
Readdir
Rename
Link
Unlink
20
CHAPTER SIX
FILES MANAGEMENT
Files
Directories
Secondary storage
management
21
22
Secondary Storage
Management
23
Contiguous Allocation
24
Contiguous Allocation
Advantages:
it is simple to implement
the read performance is excellent because the
once medias
25
26
i-nodes
keeping track of which blocks belong to which
30
i-nodes
31
Teowdos A
READING ASSIGNMENT
Directory disk allocation
Inode file structure
32
byte file:
n consecutive bytes of disk space are allocated
the file is split up into a number of (not
Block Size
Having a large allocation unit, such as a
cylinder
every file, even a 1-byte file, ties up an entire
cylinder
using a small allocation unit
each file will consist of many blocks
reading each block normally requires a seek and
a rotational delay
reading a file consisting of many small blocks will be slow
34
Block Size
Small blocks are bad for performance but good for
35
36
37
FAT-12/16
Block (also called cluster), multiple of 512
bytes
FAT-12: 12-bit block addresses, 512-byte
blocks
largest partition: 4096 x 512 = 2MB. OK for
floppy
For disks, MS allowed blocks of 1KB, 2KB,
FAT-32
Win95 2nd Edition / Win98 / Win ME
Really FAT-28: 28-bit block addresses
Potentially 228 x 215 per partition, but in
reality only 241 = 2TB
FAT itself now occupies a large RAM:
40
NTFS
Designed from scratch
Not compatible with Win95 / Win98
Usually 4KB blocks (clusters)
Blocks referred to by 64-bit numbers
Main data structure: Master File Table
41
(MFT)
Each MFT entry describes a file or
directory
MFT entry = 1KB
MFT is a file, can be anywhere on disk
Block runs
Idea: blocks of a file often sequential on
disk
A run is a set of consecutive blocks that
belong to the same file
No need to keep pointer to each block:
Enough to keep start/length of each run
42
MFT
43
THE
END
THE END
44