Question-1 Writes short notes on file types and file access
- Regular files are the ones that contain user information.
- Regular file, as a randomly accessible sequence of bytes, has no other predefined internal structure.
- Application programs are responsible for understanding the structure and content of any specific regular file.
- Directories are system files for maintaining the structure of the file system.
- To keep track of files, file systems normally have directories or folder.
- ASCII file consists of line of text.
- Advantage of ASCII files is that they can be displayed & printed as it is & they can be edited with ordinary text editor.
- If number of programs use ASCII files for input and output, it is easy to connect the output of one program to the input of another.
- C/C++/Perl/HTML files are all examples of ASCII files.
- Binary files contain formatted information that only certain applications or processors can understand.
- Binary files must be run on the appropriate software or processor before humans can read them.
- Executable files, compiled programs, spreadsheets, compressed files, and graphic (image) files are all examples of binary files.
- Under Linux and UNIX each and every hardware device is treated as a file. A device file allows to accesses hardware devices so that end users do not need to get technical details about hardware.
- In short, a device file (also called as a special file) is an interface for a device driver that appears in a file system as if it were an ordinary file.
- This allows software to interact with the device driver using standard input/output system calls, which simplifies many tasks.
Character Special Files
- It is a type of device file which talks to devices in a character by character (1 byte at a time).
- Character Special files are related to input/output and use to model serial I/O devices, such as terminals, printers, and networks
Block Special Files
- It is a type of device file which talks to devices 1 block at a time (1 block = 512 bytes to 32KB).
- Block special files are used to model disks, DVD/CD ROM, and memory regions etc.
File Access Methods
- Sequential File Access
- In Sequential access, process could read all the bytes or records from a file in order, starting at the beginning, but could not skip around and read them out of order.
- Sequential files could be rewound, however, so they could be read as often as needed.
- These files were convenient when the storage medium was magnetic tape or CD-ROM.
- Random File Access
- Files whose bytes or records can be read in any order are called random access files.
- Random access files are essentials for many applications, for example, data base systems.
- If an airline customer calls up and wants to reserve a seat on a particular flight, the reservation program must be able to access the record for that flight without having to read the records for thousands of other flights.