WHAT IS A COMPUTER FILE?
File is defined as collection of related data that is stored on the secondary storage devices . user stores his or her data inform of a file. Computers understand only physical memory areas where a user understands to access files only by its names. Data in file could be image, text, video, audio, etc.
On generally cutting edge working frameworks, indexes are ordered into one-dimensional exhibits of bytes. The configuration of a record is characterized by its substance since a document is singularly a holder for information, despite the fact that, on a few stages the organization is as a rule demonstrated by its file name growth, detailing the tenets for how the bytes must be arranged and translated astronomically.
File is actually a physical memory area for an operating system to store the data but for user it is a logical place. Any file in computer system has two parts first is name and extension. An extension indicates application from which file is to be opened. For example .c file then OS understands it should opened in turbo c.
ATTRIBUTES OF FILE
Name is used to identify file and this attribute is specified by creator of a file .
Operating system assigns a unique identifier to a file.
This attribute specifies what kind of file is it. For example HTML file.
Location refers to the place where file is stored on hard disk/
Size means amount of information contained in the file.
OPERATIONS ON FILE
- CREATION OF A FILE
To create a file there should be space in memory and there must an entry for new file in directory.
- WRITING DATA ON A FILE
Once file is created user can write data on a file. While performing write operation on a file a system call is made which information which needs to be written in file and the name of that file. The system finds out the directory entry is done. It is necessary to store a pointer to the end of the current file. Using this pointer, the address of next block can be easily calculated.
Read operation reads data from a file. A system call is made which specifies the name of a file and location of the next block of the file where information should be written. Again the directory is searched where file is located.
TYPES OF A FILE
- SIMPLE FILE: this is normal type of a file which contain user information.
- BASIC FILE: these files are used for storing information of a file system
- CHARACTER SPECIAL FILE: these files are related to peripheral and used to model serial I\O devices.
- BLOCK SPECIAL FILE: these types of a file are used to model disks.
FILE ACCESS METHODS
- SEQUENTIAL ACESS
This is simplest scheme among. When attempt is made to read file read head sequentially seeks blocks.
- DIRECT ACCESS
Direct access files allows the block size to be separately defined for each file.