Unix Interview Questions and Answers
1.Q: What functions does a kernel have?
A: The kernel of an operating system is that part that has a direct communication with the computer hardware components and it is doing this by the aid of device drivers which are included in the kernel. The kernel includes some services that are used by the programs and it manages the memory, computer access, errors and interrupts and computer resources.
2.Q: What is the meaning of a COM?
A: COM means Component Object Model and refers to a platform from Microsoft that is used for software for activating cross-application communication and to make dynamic objects in various supported programming languages. COM is viewed as an umbrella term for these technologies: ActiveX, OLE, COM+ or DCOM.
3.Q: Is the Process different before the swap than after the swap or is identical?
A: The difference is that before swapping the process has the original form and is found in the primary memory. In this case the process will not occupy all the regions and some empty slots will remain, but the kernel will ignore them during the swapping process. The process will be found in the second memory or swap device after the swapping. There will not be empty slots that existed prior to assigning, just occupied region slots. During the next swapping in the main memory the empty slots from the regions are detected and the main memory will be assigned by the Kernel of the Process Memory Map.
4.Q: What is the meaning of an Expansion swap?
A: The Expansion swap is used when a process needs more memory than was allocated and for this to happen the Kernel will look in the swap device for space to be reserved. There will not be physical memory allocated, just adjustments will be made in the address translation mapping for the new virtual address space. In the end the Kernel will assign memory by swapping the process in the main memory.
5.Q: What is needed for the work of a swapper?
A: At first the swapper will detect sleeping processes and if they are not to be found will search ready-to-run processes, a swapper has high scheduling priority. But the swapper has to become core-resident for a minimum time of 2 seconds prior swapping out and this is a big requirement if it has to work the ready-to-run process; also 2 seconds is the minimum residing time required for swapping in the process. This is a requirement that must be fulfilled, otherwise the swapper will initiate it’s wait state for that event and it will be awaked by the Kernel immediately.
6.Q:What is the meaning of the term nice value?
A: The increments or decrements of a process priority will be handled a nice value, which is returned by using nice() system call. The representative equation for nice value is: Priority=(“recent CPU usage “/constant)+(base-priority)+(nice value).Nice value can be given just by the administrator and the call nice() is meant to function only for the running process. Nice value found in different processes can’t affect each other.
7.Q:What meaning does Fork swap have?
A: When parent process is calling fork() it means it will create a child process and in the case that memory is too low the child process will be met in the swap device in the read-to-run state. It will go back to the user state with no parent process swapping and it reach the main memory when the memory will free.
8.Q:What does the kernel do when the swapping out of the process from the main memory is happening?
A: The following things are done by the Kernel after the swapping out from the main memory: it decrements the Reference Count of every process region and when the Reference Count is zero the region is swapped out from the main memory. Other things that are done: space in the swap device is given for the swapping process, another swapping process becomes locked during the current swapping operation and the region address from the region tables is saved.
9.Q:What are the phases required for a shell to process a command?
A: The command line processing by the shell has multiple pahses. After the key finishes the command line the following well defined phases take place:
a)parsing-the command line gets broke up into words by the shell and if it’s not quoted, delimiters and spaces are used. If space or tab is found repeated in a consecutive way, they are replaced with just one single space.
b)variable evaluation – all the words that have $ in front of them will be evaluated as variables if they are not escaped or quoted.
c)command substitution- if a command has quotes the shell will execute it and the standard output of the command will be replaced in the command line.
d)wild-card interpretation- the command line will be scanned by the shell to find wild-cards (?, *, [ or { characters) and the words found to contains wild-cards will get replaced with filenames according to the pattern under the form of a list, which will become the command’s arguments.
e)PATH evaluation- the PATH variable is searched for determining the directory sequence that may contain the command.
10.Q:In what way does Unix represent the devices?
A: In Unix devices are represented with files and they are found in the /dev directory. So files and devices will be accessed in a similar way. “block special file” is referring to a device file that is a disk file and “character special file” is a device file that has the characteristics of a keyboard.
11.Q: How can we explain the mount or unmount system calls?
A: The mount system call is used for attaching one file system to another and when the mounting happens a directory tree splits in a branch in other tree. Two arguments are taken: the mount point and a file system that mounts. So when we put a CD-ROM in the system the file system corresponding to that CD-ROM will mount automatically to -/dev/cdrom. Unmounting means detaching the file system.
12. Q:What is the meaning of links and symbolic links in UNIX?
A: In Unix links point to different files, a directory in Unix lists file names and the inodes that correspond to them. An inode can be a part of a directory entry and point to a file and this forms a hard link. In hard link formation, i-numbers from two entries are pointing to the same inode. Symbolic links or soft links encapsulate other file or directory reference links like a path (absolute or relative). For symbolic link creation, use this command: Ln –s target link_name. In this command “target” will be the path and the name of the link is “link_name”.
13. Q:In what way can static and dynamic library be different?
A: The difference between these two is that dynamic library will load during program execution and the static library will load at program compilation. The dynamic library has the advantage of using less RAM.
14.Q:What is the meaning of LILO?
A: Linux Loader or LILO is a code, a bootstrap program. With LILO the PC BIOS is loaded in the main memory when we start the PC and the following tasks are performed: the Linux kernel is located, the compatible programs are found and loaded into memory, the Kernel is shared. LILO is compatible with different kernel images or boot routines and this is why LILO is also known as boot manager.
15.Q:What is the real difference from soft link to hard link?
A: Hard link
When we copy a file we have two files that occupy the disk spaces: the original and the copy. In Unix we can have multiple names for a single copy of a file, the file has multiple names or links but an identical inode. We can say that this is a hard link. If we make changes in the file, they will also appear in the link file, this is a protection mechanism against deleting it. The link is a backup. For making a hard link use this command: hard link>>ln-backup.sh.restore.sh
Soft link
The soft link is not a backup, the link contains just the patch to the file so if the file is deleted we will not be able to access it. It is also named symbolic link. They are similar to windows shortcuts, the file and the link in this case have separate inods. The command for a soft link is: soft link>>ln-s.
16.Q: Which are the ID’s that associate with processes?
A: There is an integer that identifies each Unix process: ProcessID. “Parent process” is a process used to make a request for process creation. The PID (Process ID) of “parent process” is “Parent Process ID”. An association of each process with a specific user named “owner” is made and this user has rights on the process. The user is identified with “UserID”.
17.Q: What is the meaning of a zombie in Unix?
A: When fork happens and the child terminates prior to the parent the information regarding the child is maintained by the kernel if the parent may need it later. The call “wait()” can be made by the parent and during the time between the child finishing and the parent invoking”wait()”, the child is a “zombie” indicated by the Z status.
18.Q: Which states do we find for processes in Unix?
A: The states of a process change in Unix depending on circumstances:
a)running-this indicates that the process runs or is ready to do it.
b)waiting- this indicates a waiting state for events or resources.
c)stopped- this indicates the stopping of the process, very often because of signal receiving.
d)zombie- this says that the process died but it still exists on the process table.
19.Q: How are the processes killed?
A: For killing processes we will use a kill command and for identifying what process we have to finish the PID is taken as an argument using the command “ps”.
20.Q:How do we describe a Map?
A: The array that encapsulates the free swap device addresses that can receive resources and how many resources are available is known as a Map. By default the Map has just one entry. The Map is seen by the kernel as a set of disk blocks, the kernel make the update of information when resources are freed or allocated.
21.Q: What is the role of FIFO?
A: FIFO means first-in-first-out and is a file that is used for reading data. It is also known as “named pipe”. Data is read only once, for the purpose of being written. It is used as a communication process between a producer and a consumer.
22.Q: How is background process execution advantageous?
A: The main purpose of using background processes is for being able to use another process in the same time without the need of closing the original process or terminate it. For this we must add a background symbol which is “&”. For instance: cp*.*../backup&.
23.Q: When do we use the “ps” command?
A: This command is used to show us the status of a process or all the processes that are currently active. The PID or the Process Identification Number will be printed on the screen along with the estimated time of the process execution and many others.
24.Q: What is the explanation of the root file system?
A: The root file system is very important for the execution of /dev, /bin, and/etc. At the system start the only accessible files are those from the root file system. The boot strap is for verifying all files for consistency and attaching them to the root systems.
25.Q: What is the meaning of low-level I/O?
A: The low-level I/O is the entry in the OS, then programs makes read and write operations for any size of files, the kernel transforms them into sizes good for peripherals and manages the operations for optimizing performance.
For more Unix interview questions, please read below link.
thanks a lot who ever has posted this …
thanks a lot who ever has posted this …
great questions for interview , I have also shared questions collected from my friends and colleagues here Top 30 Unix Command Interview Questions asked in IB . hope it would be useful to you guys.
This is a nice set of questions
Thanks good post……….:)