Answer:: How Are Devices Represented in Unix?
Answer:: How Are Devices Represented in Unix?
Answer :
All devices are represented by files called special files that are located in/dev directory.
Thus, device files and other files are named and accessed in the same way. A 'regular
file' is just an ordinary data file in the disk. A 'block special file' represents a device with
characteristics similar to a disk (data transfer in terms of blocks). A 'character special
file' represents a device with characteristics similar to a keyboard (data transfer is by
stream of bits in sequential order).
What Is 'inode'?
Answer :
All UNIX files have its description stored in a structure called 'inode'. The inode contains
info about the file-size, its location, time of last access, time of last modification,
permission and so on. Directories are also represented as files and have an associated
inode. In addition to descriptions about the file, the inode contains pointers to the data
blocks of the file. If the file is large, inode has indirect pointer to a block of pointers to
additional data blocks (this further aggregates for larger files). A block is typically 8k.
Inode consists of the following fields:
o File owner identifier
o File type
o File access permissions
o File access times
o Number of links
o File size
o Location of the file data
What Is A Fifo?
Answer :
FIFO are otherwise called as 'named pipes'. FIFO (first-in-first-out) is a special file which
is said to be data transient. Once data is read from named pipe, it cannot be read again.
Also, data can be read only in the order written. It is used in interprocess
communication where a process writes to one end of the pipe (producer) and the other
reads from the other end (consumer).
What Is A Shell?
Answer :
A shell is an interactive user interface to an operating system services that allows an
user to enter commands as character strings or through a graphical user interface. The
shell converts them to system calls to the OS or forks off a process to execute the
command. System call results and other information from the OS are presented to the
user through an interactive interface. Commonly used shells are sh,csh,ks etc.
Brief About The Initial Process Sequence While The System Boots Up?
Answer :
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:
o the process dispatcher,
o vhand and
o 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).
What Are Various Ids Associated With A Process?
Answer :
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.
o getpid() -process id
o getppid() -parent process id
o getuid() -user id
o geteuid() -effective user id