Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Unix Interview Questions and Answers

Ques 11. Brief about the initial process sequence while the system boots up.

Ans. While booting, special process called the 'swapper' or 'scheduler' is created with Process-ID 0. The swapper manages memory allocation for processes and influences CPU allocation. The swapper inturn creates 3 children:
the process dispatcher,
vhand and
dbflush
with IDs 1,2 and 3 respectively.
This is done by executing the file /etc/init. Process dispatcher gives birth to the shell. Unix keeps track of all the processes in an internal data structure called the Process Table (listing command is ps -el).

Is it helpful? Add Comment View Comments
Ques 12. What are various IDs associated with a process?
Ans. Unix identifies each process with a unique integer called ProcessID. The process that executes the request for creation of a process is called the 'parent process' whose PID is 'Parent Process ID'. Every process is associated with a particular user called the 'owner' who has privileges over the process. The identification for the user is 'UserID'. Owner is the user who executes the process. Process also has 'Effective User ID' which determines the access privileges for accessing resources like files.
getpid() -process id
getppid() -parent process id
getuid() -user id
geteuid() -effective user id
Is it helpful? Add Comment View Comments
Ques 13. Explain fork() system call.
Ans. The `fork()' used to create a new process from an existing process. The new process is called the child process, and the existing process is called the parent. We can tell which is which by checking the return value from `fork()'. The parent gets the child's pid returned to him, but the child gets 0 returned to him.
Is it helpful? Add Comment View Comments
Ques 14. Predict the output of the following program code</P><!--webbot bot="Include" U-Include="../_private/tbl_gglapck.htm" TAG="BODY" startspan --><!--webbot bot="Include" i-checksum="224" endspan --><P class="answers">main()
{
fork();
printf("Hello World!");
}
Ans. Hello World!Hello World!
Explanation:
The fork creates a child that is a duplicate of the parent process. The child begins from the fork().All the statements after the call to fork() will be executed twice.(once by the parent process and other by child). The statement before fork() is executed only by the parent process.
Is it helpful? Add Comment View Comments
Ques 15. Predict the output of the following program code
main()
{
fork(); fork(); fork();
printf("Hello World!");
}

Ans. "Hello World" will be printed 8 times.
Explanation:
2^n times where n is the number of calls to fork()
Is it helpful? Add Comment View Comments
{
fork();
printf("Hello World!");
}
5) Predict the output of the following program code
main()
{
fork(); fork(); fork();
printf("Hello World!");
}

" />

Most helpful rated by users:

©2017 WithoutBook