Operating System Long Questions and AnswersHere in this section of Operating System Long Questions and Answers,We have listed out some of the important Long Questions with Answers on Directory operations which will help students to answer it correctly in their University Written Exam.

Lists of Long Descriptive type Questions that may be asked in Written Exams.

  • (1) Explain various directory operations in brief.

Question-1Explain various directory operations in brief.

System calls, which are allowed for managing directories exhibit more variation from system to system.

Following are common directory operations.

Create

  • A directory is created. It is empty except for dot and dot dot, which are put there automatically by the system.

Delete

  • A directory is deleted. Only an empty directory can be deleted. A directory containing only dot and dotdot is considered as an empty directory.

Opendir

  • Directories can be read. For example, to list all the files in a directory, a listing program opens the directory to read out the names of all the files it contains. Before a directory can be read, it must be opened, analogous to opening and reading a file.

Closedir

  • When a directory has been read, it should be closed to free up internal table space.

Readdir

  • This call returns the next entry in an open directory. Formerly, it was possible to read directories using the usual read system call, but that approach has the disadvantage of
  • forcing the programmer to know and deal with the internal structure of directories. In contrast, readdir always returns one entry in a standard format, no matter which of the possible directory structure is being used.

Rename

  • In many respects, directories are just like files and can be renamed the same way files can be

Link

  • Linking is a technique that allows a file to appear in more than one directory. This system call specifies an existing file and a path name, and creates a link from the existing file to the name specified by the path. In this way, the same file may appear in multiple directories. A link of this kind, which increments the counter in the file’s inode (to keep track of the number of directory entries containing the file), is sometimes called a hard link.

Unlink

  • A directory entry is removed. If the file being unlinked is only present in one directory (the normal case), it is removed from the file system. If it is present in multiple
  • directories, only the path name specified is removed. The others remain. In UNIX, the system call for deleting files (discussed earlier) is, in fact, unlink.
Share with : Share on Linkedin Share on Twitter Share on WhatsApp Share on Facebook