File Types in Operating System

There are several types of files supported by many operating systems. For example, a Windows-based operating system supports the following types of files:

And UNIX-based operating systems support the following types of files:

Because "regular files" are available as a file type in both Windows and Unix systems, let us first briefly describe them. Then we'll talk about "directories," which are available in both Windows and Unix-based operating systems. The "character special files" and "block special files" will then be discussed.

Regular Files

Regular files contain user information. Generally, regular files are either ASCII files or binary files. These two types of files are described below.

  • ASCII Files: ASCII files basically consist of lines of text. The big plus point or advantage of ASCII files is that they can be displayed and printed as is, and they can also be edited using any text editor such as Notepad, Wordpad, Notepad+, etc.
  • Binary Files: The binary files listed on the printer produce random garbage. Generally, binary files have some internal structure that is only known to the programs that use them. Technically, binary files are just a sequence of bytes, and the OS will only execute a file if it has the proper format.

Directories

Directories are the system files that are used to maintain the structure of the file system.

To keep track of files, file systems typically use directories. Directories are files in and of themselves in many systems.

The following sections will teach you about directories in the operating system:

The "hierarchical directory systems" and the "directory operations" are the two sections that are covered in the next two articles. whereas all others are described in this article. So let's start with "single-level directory systems."

Single-Level Directory Systems

The simplest form of the directory system is a directory that contains all of the files, also known as the root directory. This system was common in earlier PCs because there was only one user.

The world's first supercomputer, the CDC 6600, also had only a single directory for all files and was used by multiple users concurrently.

This system was created to keep every software design as simple as possible. The diagram below depicts an example of this system.

single level directory system

Having only one directory in a system with multiple users may result in different users accidentally using the same names for their files.

Two-Level Directory Systems

Two-level directory systems are used to avoid the problems caused by the single-level directory system, as we have learned in the previous section.

In two-level directory systems, give each user a private directory. So, in this two-level directory system, the names chosen by one user don't affect the names chosen by another user, and having the same name in two or more directories doesn't cause any problems.

The figure given below shows this system:

two level directory systems

Path Names

When the file system is organized as a directory tree, a method for specifying the names of the files is required, and this method must be discovered. As a result, the file names are typically specified using one of the two methods that are listed below:

Absolute Path Name

The path from the top-level directory all the way down to the file is what the "absolute path name" refers to. As an example, the path

usr/codescracker/myfile

means that the root directory has a subdirectory called usr, which has another subdirectory called codescracker, which has a file called myfile inside of it. The file is located within the codescracker directory.

On the Windows platform, the above-mentioned path name can be specified using the following format:

usr\codescracker\myfile

Relative Path Name

The relative path name is used in conjunction with the concept of the working directory or current directory.

A user can designate one directory as the current working directory, in which case all the path names not beginning at the root directory are taken relative to the working directory.

If the current working directory is /usr/codescracker, for example, the file whose absolute path is /usr/codescracker/myfile can now be called myfile.

Character Special Files

Character special files are mostly about I/O and are used to model serial input/output devices like printers, networks, and so on.

Block Special Files

Basically, block-specific files are used to model the disks.

Operating System Quiz


« Previous Topic Next Topic »

Follow/Like Us on Facebook




Subscribe Us on YouTube