Tuesday, September 17, 2013

Few Operating System Question - Answers for Fresher Level Interview


What is kernel? How it is different from shell?

Kernel is the core portion of the Operating system which gets loaded into the primary memory at the time of bootstrapping. It allocates the memory for the program, manages all the files, and gives response to the different system calls.
On the contrary shell acts as the interpreter between naïve user and kernel. It performs Command Line Interpretation that is it interprets the command typed in the prompt in a form that kernel understands. Kernel then allocates resources to the programs as represented by the commands.

How many types of files are there in any standard Unix family system?

From the Operating System aspect, Unix does not impose any internal file structure, but the differences arise when they are interpreted differently by the application software.
On this background, there are two types of files in Unix, and they are Normal or Ordinary Files and some Special Files.  Normal or Ordinary files are indicated with  “-“ in first position of the file permission string.
There are many special files like Directory files (indicated with “d”), Named  pipes (indicated with “p”), Socket files (indicated with “s”), Symbolic link (indicated with “l”) and Device files. Device files are of two types, character device files (indicated with “c”) and block device files (indicated with “b”).

What is the difference between Soft Linking and hard Linking in Unix?

If a file “foo” is hard linked with “bar”, then “bar” points to the content of “foo”. That is if content of the “foo” gets changed, content of ”bar” also gets changed. Vice versa is also true. As ”foo” and “bar” point to the same locations in the file structure, they share common inode number.
On the other hand if “foo” is soft linked with “dar” then dar becomes a completely different file which holds the path of the “foo”. Content of “dar” is actually nothing but the content of the file, path of which is there in “dar”.  Hence change in content of “foo” will obviously lead to change in content of “dar”. As “foo” and “bar” are two different files physically, their inode numbers will be different.
Now if “foo” get deleted, still the content of “foo” could be accessed  through “bar”, but “dar” will have no content because “dar” will try to show the content of “foo” which is not there at all in the file system.
Lastly, hard linking cannot pierce through current directory where as soft linking can span through entire directory structure.    

Hope you liked it

 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.