Need for File System (or Data Storage)
Concept of File
Files are logical units of information created by processes. It's a container structured as a sequence of bytes.
Files are used to create an abstraction. It is to hide from the user the details of how and where the information is stored.
File Naming
Most of the file systems support names as long as 255 characters. Note that Unix distinguishes between upper and lower cases but MS-DOS don't.
File names basically consists of 2 parts: name and extension, both separated by a period.
Eg: fun.doc
The extensions and the name are for the convenience of the user and are not enforced by the OS. (Note:the kernel does not interpret the contents of a file, to the kernal it's just bytes) But certain applications and compilers insist the files they deal with are in a specific format.
Eg: In unix, a file name john.txt could be anything and doesn't convey any actual information to the computer.
It's not the case in Windows, windows take extensions seriously. Some of the Linux variants allow Users to register extensions with OS and assign programs to that extension.
File Types
The most common types of files are:
Regular files are of 2 types:
Note:
Every OS must recognize at least one type of file: it's own executable file.
Unix architecture
- A process can only utilize a limited amount of memory space, it's – virtual address space. The size of virtual address space is limited. For storing huge amounts of information a file system implemented on a storage device is necessary.
- When a process terminates, the information within it's address space is lost. To retain information we need file system.
- When information needs to be accessed by multiple processes (or applications) we need a file system. Because for a particular process it's address space is protected and is accessible only by that process.
Concept of File
Files are logical units of information created by processes. It's a container structured as a sequence of bytes.
Files are used to create an abstraction. It is to hide from the user the details of how and where the information is stored.
File Naming
Most of the file systems support names as long as 255 characters. Note that Unix distinguishes between upper and lower cases but MS-DOS don't.
File names basically consists of 2 parts: name and extension, both separated by a period.
Eg: fun.doc
The extensions and the name are for the convenience of the user and are not enforced by the OS. (Note:the kernel does not interpret the contents of a file, to the kernal it's just bytes) But certain applications and compilers insist the files they deal with are in a specific format.
Eg: In unix, a file name john.txt could be anything and doesn't convey any actual information to the computer.
It's not the case in Windows, windows take extensions seriously. Some of the Linux variants allow Users to register extensions with OS and assign programs to that extension.
File Types
The most common types of files are:
- Regular files
- The most common type of file. It could be text or binary, unix doesn't make any distinction between the two. The interpretation of the contents of a regular file is left to the application that is processing the file. Denoted as: -
- Directories
- It's a file that contains a list of file names and pointers to it's location. Denoted as: d
- Character special files
- It's a file that is used for unbuffered I/O access (in variable-size units) to devices. Eg: terminal, modem. Though it acts as a interface for a device driver, it appears in a file system as if it were an ordinary file. Denoted as: c
- Block special files
- It's a file that is used for buffered I/O access (in fixed-size units) to devices. Eg: disk drives, CD-ROM. Denoted as: b
- Symbolic link files
- It's a type of file that points to another file. Notice that with symbolic links, the remaining file attributes are always “rwxrwxrwx” and are dummy values. The real file attributes are those of the file the symbolic link points to. Denoted as: l
- Pipe and named pipe
- It's a type of file that is used for communication between processes. It's also called as FIFO. Denoted as: p
- Socket
- It's a file that is used for network communication between processes. Denoted as: s
Regular files are of 2 types:
- ASCII files:
- These contain lines of text.
- They can be easily displayed and printed.
- Binary files:
- Impossible to understand if printed or displayed.
- They are understood only by programs that understand their internal structure. For eg: an archive is understood by programs like 7zip, winrar, tar, etc. because these files are created by programs like the same.
Note:
Every OS must recognize at least one type of file: it's own executable file.
Unix architecture
The Unix File system Layout
Let's not go into the hardware implementation details. View the Tutorial page for the list of Unix tutorials.
Click here to read File system part II
This comment has been removed by a blog administrator.
ReplyDelete