Thursday 4 October 2012

UNIX Interview Questions-8


71. For which kind of fault the page is checked first?
Ans: The page is first checked for the validity fault, as soon as it is found that the page is invalid (valid bit is clear), the validity fault handler returns immediately, and the process incur the validity page fault. Kernel handles the validity fault and the process will incur the protection fault if any one is present.

72. In what way the protection fault handler concludes?
Ans: After finishing the execution of the fault handler, it sets the modify and protection bits and clears the copy on write bit. It recalculates the process-priority and checks for signals.

73. How the Kernel handles both the page stealer and the fault handler?
Ans: The page stealer and the fault handler thrash because of the shortage of the memory. If the sum of the working sets of all processes is greater that the physical memory then the fault handler will usually sleep because it cannot allocate pages for a process. This results in the reduction of the system throughput because Kernel spends too much time in overhead, rearranging the memory in the frantic pace.

74. Explain different types of Unix systems.
Ans: The most widely used are: 
1. System V (AT&T)
 2. AIX (IBM) 
3. BSD (Berkeley) 
4. Solaris (Sun) 
5. Xenix ( A PC version of Unix)

75. Explain kernal and shell.
Ans: Kernel: It carries out basic operating system functions such as allocating memory, accessing files and handling communications. Shell:A shell provides the user interface to the kernal.
There are 3 major shells :
 1. C-shell
 2. Bourne shell
 3. Korn shell

76. What is ex and vi ?
Ans: ex is Unix line editor and vi is the standard Unix screen editor.

77. Which are typical system directories below the root directory?
Ans: (1) /bin: contains many programs which will be executed by users
 (2) /etc : files used by administrator 
(3) /dev: hardware devices
 (4) /lib: system libraries 
(5) /usr: application software
 (6) /home: home directories for different systems.

78. Construct pipes to execute the following jobs?
Ans:
1. Output of who should be displayed on the screen with value of total number of users who have logged in displayed at the bottom of the list.
2. Output of ls should be displayed on the screen and from this output the lines containing the word ‘poem’ should be counted and the count should be stored in a file.
3. Contents of file1 and file2 should be displayed on the screen and this output should be appended in a file.
From output of ls the lines containing ‘poem’ should be displayed on the screen along with the count.
4. Name of cities should be accepted from the keyboard . This list should be combined with the list present in a file. This combined list should be sorted and the sorted list should be stored in a file ‘newcity’.
5. All files present in a directory dir1 should be deleted any error while deleting should be stored in a file ‘errorlog’.

79.Explain the following commands?
$ ls > file1
$ banner hi-fi > message
$ cat par.3 par.4 par.5 >> report
$ cat file1>file1
$ date ; who
$ date ; who > logfile
$ (date ; who) > logfile

80. What is the significance of the “tee” command?
Ans: It reads the standard input and sends it to the standard output while redirecting a copy of what it has read to the file specified by the user.

No comments:

Post a Comment