files1
files1
• Size
• Protection
• User ID
2 File Operations
The file ADT supports many common operations:
Creating a file
Writing a file
Reading a file
Repositioning within a file
Deleting a file
Truncating a file.
Information about currently open files is stored in an open file table, containing for
example:
File pointer - records the current position in the file, for the next read or write
access.
File-open count - How many times has the current file been opened Some
systems provide support for file locking.
A shared lock is for reading only.
A exclusive lock is for writing as well as reading.
An advisory lock is informational only, and not enforced. ( A "Keep Out" sign,
which may be ignored. )
A mandatory lock is enforced. ( A truly locked door. )
UNIX used advisory locks, and Windows uses mandatory locks.
3 File Types
Windows ( and some other systems ) use special file extensions to
indicate the type of each file:
Access Methods
1 Sequential Access
A sequential access file emulates magnetic tape operation, and generally
supports a few operations:
read next - read a record and advance the tape to the next position.
write next - write a record and advance the tape to the next position.
rewind
skip n records - May or may not be supported. N may be limited to
positive numbers, or may be limited to +/- 1.
2 Direct Access
Jump to any record and read that record. Operations supported include:
• read n - read record number n. ( Note an argument is now required. )
• write n - write record number n. ( Note an argument is now required. )
• jump to record n - could be 0 or the end of file.
• Query current record - used to return back to this record later.
• Sequential access can be easily emulated using direct access. The inverse is
complicated and inefficient.
3 Other Access Methods
An indexed access scheme can be easily built on top of a direct access system. Very
large files may require a multi-tiered indexing scheme, i.e. indexes of indexes.
KKR & KSR INSTITUTE OF TECHNOLOGY & SCIENCES
(Approved by AICTE, New Delhi, Affiliated to JNTUK Kakinada)
(Accredited by NAAC – ‘A’ Grade )
Department of Information Technology