Interviewer And Interviewee Guide

Fresh Unix System Calls Interview Questions & Answers:

2. The very first process created by the Kernel in UNIX is?

When the kernel begins to run, it starts by setting up a
number of internal lists, or tables.After initializing its
tables, the kernel creates three dummy processes; sched,
vhand and bdflush (with process IDs 0, 2 and 3
respectively). Finally the kernel creates a third process
init which pid 1. init starts up as a dummy process, then
achieves independence and runs as the first true process on
the system.

3. Explain What are the Unix system calls for I/O?

open(pathname,flag,mode) - open file
creat(pathname,mode) - create file
close(filedes) - close an open file
read(filedes,buffer,bytes) - read data from an open file
write(filedes,buffer,bytes) - write data to an open file
lseek(filedes,offset,from) - position an open file
dup(filedes) - duplicate an existing file descriptor
dup2(oldfd,newfd) - duplicate to a desired file descriptor
fcntl(filedes,cmd,arg) - change properties of an open file
ioctl(filedes,request,arg) - change the behaviour of an open
file
The difference between fcntl anf ioctl is that the former is
intended for any open file,
while the latter is for device-specific operations.

4. Explain the mount and unmount system calls?

mount is the command used to know which devices are
loaded.it means devices like floppy drive,cd drive.if we
give mount command it will display which device is mounted.
unmount is the command used to disable the device.if we
give umount and the path of the device then it will umount
the device.
In windows we wont have this concept.because those are
installed.

5. What is the difference between command and utility in Unix?

both the command and utility are give the same priority but
to give the diff between them we have only a major diff and
it is
utilites in unix will say how the commands are been
implimenting
command will come under the utilites
they are mainly 5 utilies in unix operating system and they
are
1.file processing utilites
2.disk processing utilites
3.process utilites
4.network utilites
5.text processing utilites

6. Explain c program to implement the Unix or Linux command to implement
ls -l >output.txt?

read the files in current directory using opendir and
readdir system calls. readdir will return filenames in the
directory. For each entry returned by readdir system call,
use stat system call to read statistics of the file. Stat
system call will give all the info about the file as that
of ls -l command.

7. How to protect a process from others to kill?

by using signal handler block the signal for SIGKILL so that kill-9 will be handled.

Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.