LINUX INTERVIEW QUESTIONS
1)Difference between Process and Thread?
a)Process is a program in execution.
Thread means a segment of process.
b)Process is a heavy weight process.
Thread is a light weight process.
c)The process takes more time to terminate.
The thread takes less time to terminate.
d)It takes more time for creation.
It takes less time for creation.
e)Process consume more resources.
Thread consume fewer resources.
f)The process is mostly isolated.
Threads share memory.
g)It does not share data.
Threads share data with each other.
--------------------------------------------------------------------------------------------------------
2)Difference between Semaphore and Mutex?
a)Semaphore is used to synchronize between multiple processes.
Mutex is used to synchronize between multiple threads.
b)It is a type of signaling mechanism.
It is a locking mechanism.
c)Semaphore is just an integer variable.
Mutex is just an object.
d)Types of semaphore are counting semaphore and binary semaphore.
Mutex has no subtypes.
e)Semaphore value is modified using wait() and signal() operation.
Mutex object is locked (or) unlocked.
-----------------------------------------------------------------------------------------------------------
3)What is Critical section of code?
1)When more than one processes access a same code segment that segment is
known as Critical section.
2)Critical Section contains shared variables (or) resources which are needed to
be synchronized to maintain consistency of data variable.
-----------------------------------------------------------------------------------------------------------
4)What is Memory Management?
Memory Management is the process of controlling and coordinating computer
memory, assigning portions known as blocks to various running programs to
optimize the overall performance of the system.
---------------------------------------------------------------------------------------------------------
5)What is Paging?
a)Paging is a memory management scheme that eliminates the need for contiguous
allocation of Physical memory.
b)Paging is a storage mechanism that allows OS to retrieve processes from the
secondary storage into the main memory in the form of pages.
------------------------------------------------------------------------------------------------------------
6)What are Frames?
1)The Physical Address Space(Memory) is conceptually divided into a number of
fixed size blocks called frames.
2)Physical addresses are generated by Memory Management Unit.
Note: Logical address does not exist Physically but Physical address do exist.
---------------------------------------------------------------------------------------------------------------
7)What are Pages?
1)The Logical Address Space is also splitted into fixed-size blocks called pages.
2)Logical addresses are generated by Central Processing Unit.
----------------------------------------------------------------------------------------------------------------
8)What is Page Fault?
1)A Page Fault occurs when a program attempts to access a block of memory that
is not stored in the physical memory (or) RAM.
2)Page Fault occurs when page is not in main memory.
------------------------------------------------------------------------------------------------------------------
9)What is meant by Buffer?
Memory area that stores data while they are transferred between two devices is called Buffer.
------------------------------------------------------------------------------------------------------------------
10)What is a Swap Space?
1)Swap Space is a certain amount of space used by Linux to temporarily hold some
programs that are running concurrently.This happens when RAM does not have
enough memory to hold all programs that are executing.
2)swap space management is done using virtual memory.
---------------------------------------------------------------------------------------------------------------------
11)What is IPC?What are the Various Schemes Available?
1)Inter Process Communication is used to pass information between two (or) more
processes.
2)One process want to communicate with another process we need to follow IPC
mechanism.
3)Schemes are Pipes,FIFOs,Message Queue,Shared Memory,Semaphores.
-----------------------------------------------------------------------------------------------------------------------
12)What is deadlock?
1)In an operating system, a deadlock is a situation which occurs when a process enters
a waiting state because a resource requested by it is being held by another waiting
process,which in turn is waiting for another resource. If a process is unable to change
its state indefinitely because the resources requested by it are being used by other
waiting process,then the system is said to be in a deadlock.
2)Process1 is locked R1 resource and waiting for R2 resource availability where as
Process2 locked R2 resource waiting for R1 resource availability.This situation is
called as Deadlock.
----------------------------------------------------------------------------------------------------------------------
13)What is Real-Time use of Dead Lock ?
1)Traffic Grid Lock is an everyday example of Dead Lock.
2)When two trains are coming toward each other on same track and there is only one track,
none of the trains can move once they are in front of each other .
----------------------------------------------------------------------------------------------------------------------
14)How to avoid Dead Lock ?
We can Prevent Dead Lock by eliminating the below four conditions
1)Mutual Exclusion
2)Hold and Wait
3)No Preemption
4)Circular Wait
-----------------------------------------------------------------------------------------------------------------------
15)What is Cache memory?
1)Cache Memory is used by the central processing unit of a computer to reduce the
average time to access memory.
2)The cache is a smaller, faster memory which stores copies of the data from the
most frequently used main memory locations.
3) As long as most memory accesses are cached memory locations, the average latency
of memory accesses will be closer to the cache latency than to the latency of main
memory.
------------------------------------------------------------------------------------------------------------------
16)What is Context Switching ?
1)Transferring the control from one process to other process requires saving the state
of the old process and loading the saved state for new process. This is known as
context switching.
2)Loading and Unloading of PCBs is called context switching.
------------------------------------------------------------------------------------------------------------------
17)What is I-Node Number?
Each file is given a unique name by the operating system which is called as the I-Node.
1)An inode is an entry in the table,containing information about a file including :
a)File Type,Permissions,UID,GID
b)The Link count
c)The File's Size and Various Time Stamps
d)Pointers to the files data blocks on disk
e)Other data about the file
--------------------------------------------------------------------------------------------------------------------
18)What is Daemon?
1)It is long lived.Often, a Daemon is created at system startup and runs until the system
is shutdown.
2)It runs in the background and has no controlling terminal.So,some of the signals are
ignored.(SIGINT,SIGSTOP,SIGHUP).
3)The purpose of Daemons are to handle periodic requests and then forward the requests
to appropriate programs for execution.
---------------------------------------------------------------------------------------------------------------------
19)What are the different types of Scheduling Policies?
1)FIFO(First In First Out)/FCFS(First Come First Serve)
2)Round Robin Scheduling
3)SJF(Shortest Job First)
4)Priority Based Scheduling
5)Multi Level Feedback Queues Scheduling
6)SRTF(Shortest Remaining Time First)
7)LRTF(Longest Remaining Time First)
8)Highest Response Ratio Next(HRRN)
9)Multilevel Queue Scheduling
---------------------------------------------------------------------------------------------------------------------
20)Explain FIFO Scheduling Algorithm?
1)FIFO is also Known as FCFS.
2)Simplest Scheduling Algorithm that Schedules according to arrival times of Processes.
3)FIFO assigns the CPU based on order of Requests.
4)FCFS is a Non-Preemptive Scheduling Algorithm.
5)Non-Preemptive:A Process Keeps running on a CPU until it is blocked (or) terminated.
-----------------------------------------------------------------------------------------------------------------------
21)Explain Round-Robin Scheduling Algorithm?
1)Round Robin Periodically releases the CPU from long-running Jobs.
2)Based on timer interrupts so short jobs can get a fair share of CPU time.
3)Preemptive:A process can be forced to leave its running state and replaced by
another running process.
4)Time-Slice:Interval between Timer Interrupts
5)If Time Slice is too long--Scheduling degrades to FIFO.
6)If Time Slice is too short--Through Put suffers--Context Switching cost dominates
-----------------------------------------------------------------------------------------------------------------------
22)Difference between FCFS and Round Robin?
1)FCFS not Suitable for Time Sharing Systems
Round Robin Scheduling Suitable for Time Sharing Systems
2)It is Non-Preemptive.
It is Preemptive.
3)It uses a FIFO Queue.
It uses FIFO Circular Queue.
-----------------------------------------------------------------------------------------------------------------------
23)Explain about Kernel ?
1)It is the core component of Operating System,interacts directly with hardware,provides
low level services to upper layer components.
2)It is responsible for handling all system processes.
3)All processes of memory and hardware initialization are carried out in kernel space.
4)All the Services of the Operating System are called Kernel Services.
----------------------------------------------------------------------------------------------------------------------
24)What are the types of kernel in Linux ?
The types of kernel in Linux are
1)Monolithic Kernel
2)Micro Kernel
3)Hybrid Kernel
---------------------------------------------------------------------------------------------------------------------
25)What are the components of a Kernel ?
The Components of a Kernel are
1)Process Management
2)Device Management
3)Memory Management
4)Interrupt Handler
5)Hardware Device Drivers
6)File system Drivers
7)Network Management
8)Synchronization and Communication
-----------------------------------------------------------------------------------------------------------------------
26)What is Shell?
1)Shell is Command language interpreter takes commands from the user and executes
Kernel's functions.
2)Shell is a Application,not a Service.
Note: Applications are Optional,Services are Mandatory.
-------------------------------------------------------------------------------------------------------------------
27)What is Multiprocessing ?
Multiple applications running simultaneously (or) concurrently are called as
Multiprocessing.
-------------------------------------------------------------------------------------------------------------------
28)What is Response Time?
1)The Time gap between process is created and the first instruction of the process
started executing that time gap is called Response Time.
2)Response Time less is a good environment.
--------------------------------------------------------------------------------------------------------------------
29)What is Starvation Time?
1)The Process in it's lifecycle how much of time it is starvated without executing by
the cpu that time is called as Starvation Time.
2)Starvation Time less is a good environment.
---------------------------------------------------------------------------------------------------------------------
30)What is TurnAround Time ?
1)The Time gap between process creation to the process completion is called as
TurnAround Time.
2)TurnAround Time less is a good environment.
-----------------------------------------------------------------------------------------------------------------------
31)What is Through Put ?
1)No of Processes completed per unit of Time is called as Through Put.
2)Through Put more is a good environment.
-----------------------------------------------------------------------------------------------------------------------
32)What is Running State ?
If a Process is executed by cpu then the process go to Running State.
---------------------------------------------------------------------------------------------------------------------
33)What is Ready State ?
If a Process is ready for execution but not executing by the cpu then the
process go to Ready State.
-------------------------------------------------------------------------------------------------------------------
34)What is Wait State ?
If a Process is waiting for external event to finish then the process is treated as
Wait State Process.
----------------------------------------------------------------------------------------------------------------------
35)What is Dealy State?
If a Process intentionally goes to the delay using sleep function,then the process
goes to Delayed State.
-----------------------------------------------------------------------------------------------------------------------
36)What is Suspend State ?
If a Process is Suspended because of some signal then the process go to Suspend state.
----------------------------------------------------------------------------------------------------------------------
37)What is Orphan Process ?
If Parent Completes its Process before Child Process then Child becomes Orphan.
---------------------------------------------------------------------------------------------------------------------
38)What is Zombie Process ?
If Child Completes its Process before Parent Process then Child becomes Zombie
(Dead Process).
-----------------------------------------------------------------------------------------------------------------------
39)What are the Booting Steps of Linux OS ?
1) BIOS :
a)BIOS Stands for Basic Input/Output System.
b)Performs Some System Integrity Checks.
c)It is Present in ROM.
d)Searches,loads, and executes the boot loader program.
e)It looks for boot loader in floppy,cd-rom (or) hard drive.
f)Once the boot loader program is detected and loaded into the memory,
BIOS gives the control to it.
2) MBR :
a)MBR stands for Master Boot Record.
b)This MBR is located in the Starting Sector of the bootable device.
c)MBR is less than 512 bytes in size.
d)Windows --- NT Loader
Linux --- LILO Loader
3)GRUB:
a)GRUB stands for Grand Unified Boot Loader.
b)It Loads the OS from hardisk to RAM.
c)If you have Multiple kernel images installed on your system,you
can choose which one to be executed.
d)It has the Knowledge of file system.
e)Universal Loader,Loader will Display.
4) Kernel :
a)It will load the kernel from hardisk to RAM.
b)Kernel executes the init program.
c)All the services started Executed.
5) Init :
a)Kernel will create the process.
b)Process Start running.
c)Process id is one.
d)Init will initiate Run Level Program(Minor Services).
6)Run Level Programs:
a)When the Linux System is booting up,you might see various services getting
Started.
b)Following are the available Run levels
1) 0 - Halt
2) 1 - Single User Mode
3) 2 - Multi User
4) 3 - Full Multi User Mode
5) 4 - Unused
6) 5 - X11
7) 6 - Reboot
------------------------------------------------------------------------------------------------------------------------
40)Difference between Nice and ReNice ?
1)Nice for modificaton of Scheduling Priority (or) Run a Program with modified
Scheduling Priority (or) Create a Process with Modified Scheduling Priority.
2)ReNice for modification of Scheduling Priority of Running Process (or) is a
Command to change the Priority of Running Process.
-----------------------------------------------------------------------------------------------------------------------
41)What is Scheduling ?
It is a Method of Selecting the Sequence of the Process in Simple Words chooses the
Process which has to be executed first in the CPU.
----------------------------------------------------------------------------------------------------------------------
42)Explain about PCB ?
1)PCB Stands for Process Control Block.
2)A Process Operations are Controlled with the help of PCB can be considered as brain
of the process,which contains all the information regarding to a process such as process id,
priority,state,present working state and contents of CPU register.
3)It is a Kernel based data structure which uses three kind of functions which are scheduling,
dispatching,Context save.
------------------------------------------------------------------------------------------------------------------------
43)What is umask ?
1)The user-file creation mode mask (umask) is use to determine the file permission
for newly created files.
2)It can be used to control the default file permission for new files.
3)It is a four digit octal number.
-----------------------------------------------------------------------------------------------------------------------
44)Difference between Hard Link and Soft Link ?
1)Hard Link is the direct reference to the file.
Soft Link is the reference by name which means it points to a file by file name.
2)A file can be accessed through many different names known as Hard Link.
A file can be accessed through different references pointing to that file is known
as Soft Link.
3)Command : ln filename1 filename2
Command : ln -s filename1 filename2
4)Inode Numbers are same.
Inode Numbers are Different.
5)Both files are regular.
One is Regular other is Link .
6)If we delete the Original file we can get the data from the link file.
If we delete the Original file we can not get the data.
7)File Size are same.
File Size is different.
---------------------------------------------------------------------------------------------------------------------
45)Difference between stat,fstat,lstat ?
1) These functions returns information about a file.
2)All are system calls.
3)Whenever the file name is a symbolic link,stat() returns the attributes (or)inode
information about the target file associated with the Link.Where as the lstat()
return the attributes of the link.fstat() is identical to stat(),except that the file
to be stat-ed is specified by the file descriptor.
4)For stat() and lstat() if we give regular file it will give regular file information.
For but stat() if we give link file it will give original file information but lstat()
gives link file information.
---------------------------------------------------------------------------------------------------------------------
46)Who is responsible for data transfer between Processes ?
a) The Kernel is responsible for data transfer between Processes.
b)The Kernel provides facilities such as 1)Signals
2)PIPE
3)FIFO
4)Message Queue
5)Shared Memory
6)Semaphore
------------------------------------------------------------------------------------------------------------------------
47)What is the Purpose of IPC Mechanisms ?
a)Data Transfer
b)Sharing Data
c)Event Notification
d)Resource Sharing
e)Process Control
----------------------------------------------------------------------------------------------------------------------
48)Explain about PIPE ?
a)Pipes Provide a Unidirectional Inter Process Communication Channel.
b)It is Unstructured data stream.
c)A pipe has a READ end and WRITE end.
d)Data Written to the write end of a pipe can be read from the read end of the pipe.
e)A pipe is created using a pipe(2) system call which contains a new pipe and returns two file
descriptors,one referring to the read end of the pipe,the other referring to the write end.
f)Pipe is used mainly for communication of related processes that means communication between
a parent and a child process.
g)Pipes have a limited capacity,a pipe is simply a buffer maintained in kernel memory(65536).
------------------------------------------------------------------------------------------------------------------------
49)What are the Disadvantages of PIPE ?
a)They are half-duplex.
b)Data flows in one direction.
c)If multiple processes writes data the reader cannot determine the boundaries.
d)If multiple readers are present a writer cannot direct data to specific reader.
-------------------------------------------------------------------------------------------------------------------------
50)Explain fork() system call ?
a)The fork system call is used to create a new processes.
b)The newly created process is the child process.
c)The process which calls fork and creates a new process is the parent process.
d)The child and parent processes executed concurrently.
e)It is used for creating child processes for a parent process.
f)Fork is called onces and returns twice.
g)It will return 0 to the newly created process(child) and process id of the child to the
calling process(Parent)
h)The child process gets copy of parents data,stack and heap segment.The code segment
is common for both.
---------------------------------------------------------------------------------------------------------------------
51)Explain about FIFO ?
a)FIFO is also called as Named Pipe.
b)It is used for communication between unrelated processes
c)FIFO stands for First in First Out.
d)FIFO has a write end and a read end,and data is read from the pipe in the same order
as it is written
e)We can create a fifo file in two ways
i)Through Command ii)Through Function
f)mkfifo --Library Function
mknod -- system call
g)Shell commands to pass data from one shell pipe to another without creating temporary
files.
h)By client server applications for sending data between clients and server.
---------------------------------------------------------------------------------------------------------------------
52)What are Limitations of FIFO ?
a)When process writing data into FIFO,reading process must and should be available.
b)No addressing mechanism.
c)If multiple reading processes are there in that case when writing process writes the
data there is no guarantee that who is going to receive it.
---------------------------------------------------------------------------------------------------------------------
53)Explain about Message Queue ?
a)Message queues can be used to pass messages between Processes.
b)Message queue are a linked list of messages stored with in the kernel.
c)They are identified by a message queue Identifier.
d)Message queues are somewhat like pipes,but differ in two important respects.
e)First,message boundaries are preserved,so that readers and writers communicate in units
of messages,rather than via un delimited byte stream.
f)Second,each message includes an integer type field,and it is possible to select messages by
type, rather than reading them in the order in which they are written.
-----------------------------------------------------------------------------------------------------------------------
54)What are the functions used in Message Queue ?
a)msgget() is useful for creating as well as opening the existing message queue.
b)msgsnd() is useful for transferring the message into the message queue
.
c)msgrcv() is useful for receiving the message from message queue.
d)msgctl() is useful for doing some control operations on the message queue.
-----------------------------------------------------------------------------------------------------------------------
55)What are disadvantages of Message Queue ?
a) It is called as Slowest IPC.
b)Message queues are connectionless,and the kernel doesn't maintain a count of the number
of processes referring to the queue as is done with pipes,FIFOs,and sockets.
----------------------------------------------------------------------------------------------------------------------
56)Explain about Shared Memory ?
a)It allows two (or) more processes to share a given region of memory.
b) It is the Fastest IPC mechanism.
c)Semaphores are used to synchronize shared memory access.
----------------------------------------------------------------------------------------------------------------------
57)What are the functions used in Shared Memory ?
a)shmget() is useful for creating as well as opening the shared memory segment.
b)shmat() is useful for attaching the shared memory segment to our process.so that process
can do the transactions.
c)shmdt() is useful for detaching the shared memory segments from our process.
d)shmctl() is useful for doing some control operations.
------------------------------------------------------------------------------------------------------------------------
58)What is PID ?
a)PID is process id.
b)The process manager recognises processes by an identification numbers and not with
names,this process identification number is called PID of a process.
c)A process is an executing instance of a program
d)Each process is guaranteed a unique PID,which is always a non negative integer.
------------------------------------------------------------------------------------------------------------------------
59)What do you meant by Multi Threading ?
1)Multi Threading is Multi Tasking,but enables the processing of multiple threads at one time,
rather than multiple processes.
2)For Example,a Multi Threaded Operating system may run several background tasks,such as
logging file changes,indexing data and managing windows at same time
--------------------------------------------------------------------------------------------------------------------------
60)What are drawbacks of Threading ?
1)Complex Debugging and Testing Processes.
2)Result is sometimes Unpredictable.
3)Overhead Switching of context
4)Increased Potential for deadlock occurrence.
5)Increased Difficulty level in writing a program.
-------------------------------------------------------------------------------------------------------------------------
61)Difference between getpid() and getppid() in Linux ?
Both getpid() and getppid() are inbuilt functions of unistd.h library
1)Syntax : a)pid_t getpid(void);
b)pid_t getppid(void);
2) a)It will give the process id.
b)It will give its parent process id.
3)Returns the PID of the calling process.
Returns the PID of the parent of the calling process.
--------------------------------------------------------------------------------------------------------------------------
62)Difference between signal() and sigaction() in Linux ?
Both are system calls
1)Signal returns the previous signal disposition on success.
Sigaction changes the disposition of a signal.
2)signal() function is simple
sigaction() function is complex
------------------------------------------------------------------------------------------------------------------------
63)What are the File Permissions in Linux ?
Permissions are associated with every file,and are useful for security.
1)There are three categories of users:
a)User (U)
b)Group (G)
c)Others (O)
2)There are three types of of access permissions:
a)Read (R)
b) Write (W)
c)Execute (E)
--------------------------------------------------------------------------------------------------------------------------
64)What are the Linux commands you Know ?
1)pwd - print working directory
The command is used to print the name of the current working directory.
2)cd - change directory
The command changes directories to specified directory
3)ls - list the files
The command lists the directory contents
4)cat
The command is used for displaying and create files
5)rm
The command is used to delete files
6)mv
The command is used to rename file (or) group of files as well as directories.
7)wc
The command counts lines,words,and character depending on option.
8)mkdir
The command creates a directory.
9)rmdir
The command removes a directory.
10)cp
The command copies information from one file to another.
11)head
The command will display the first 10 lines of a line.
12)tail
The command will display the last 10 of a file.
13)ps
The command display the current process status of the system.
---------------------------------------------------------------------------------------------------------------------
1)Difference between Process and Thread?
a)Process is a program in execution.
Thread means a segment of process.
b)Process is a heavy weight process.
Thread is a light weight process.
c)The process takes more time to terminate.
The thread takes less time to terminate.
d)It takes more time for creation.
It takes less time for creation.
e)Process consume more resources.
Thread consume fewer resources.
f)The process is mostly isolated.
Threads share memory.
g)It does not share data.
Threads share data with each other.
--------------------------------------------------------------------------------------------------------
2)Difference between Semaphore and Mutex?
a)Semaphore is used to synchronize between multiple processes.
Mutex is used to synchronize between multiple threads.
b)It is a type of signaling mechanism.
It is a locking mechanism.
c)Semaphore is just an integer variable.
Mutex is just an object.
d)Types of semaphore are counting semaphore and binary semaphore.
Mutex has no subtypes.
e)Semaphore value is modified using wait() and signal() operation.
Mutex object is locked (or) unlocked.
-----------------------------------------------------------------------------------------------------------
3)What is Critical section of code?
1)When more than one processes access a same code segment that segment is
known as Critical section.
2)Critical Section contains shared variables (or) resources which are needed to
be synchronized to maintain consistency of data variable.
-----------------------------------------------------------------------------------------------------------
4)What is Memory Management?
Memory Management is the process of controlling and coordinating computer
memory, assigning portions known as blocks to various running programs to
optimize the overall performance of the system.
---------------------------------------------------------------------------------------------------------
5)What is Paging?
a)Paging is a memory management scheme that eliminates the need for contiguous
allocation of Physical memory.
b)Paging is a storage mechanism that allows OS to retrieve processes from the
secondary storage into the main memory in the form of pages.
------------------------------------------------------------------------------------------------------------
6)What are Frames?
1)The Physical Address Space(Memory) is conceptually divided into a number of
fixed size blocks called frames.
2)Physical addresses are generated by Memory Management Unit.
Note: Logical address does not exist Physically but Physical address do exist.
---------------------------------------------------------------------------------------------------------------
7)What are Pages?
1)The Logical Address Space is also splitted into fixed-size blocks called pages.
2)Logical addresses are generated by Central Processing Unit.
----------------------------------------------------------------------------------------------------------------
8)What is Page Fault?
1)A Page Fault occurs when a program attempts to access a block of memory that
is not stored in the physical memory (or) RAM.
2)Page Fault occurs when page is not in main memory.
------------------------------------------------------------------------------------------------------------------
9)What is meant by Buffer?
Memory area that stores data while they are transferred between two devices is called Buffer.
------------------------------------------------------------------------------------------------------------------
10)What is a Swap Space?
1)Swap Space is a certain amount of space used by Linux to temporarily hold some
programs that are running concurrently.This happens when RAM does not have
enough memory to hold all programs that are executing.
2)swap space management is done using virtual memory.
---------------------------------------------------------------------------------------------------------------------
11)What is IPC?What are the Various Schemes Available?
1)Inter Process Communication is used to pass information between two (or) more
processes.
2)One process want to communicate with another process we need to follow IPC
mechanism.
3)Schemes are Pipes,FIFOs,Message Queue,Shared Memory,Semaphores.
-----------------------------------------------------------------------------------------------------------------------
12)What is deadlock?
1)In an operating system, a deadlock is a situation which occurs when a process enters
a waiting state because a resource requested by it is being held by another waiting
process,which in turn is waiting for another resource. If a process is unable to change
its state indefinitely because the resources requested by it are being used by other
waiting process,then the system is said to be in a deadlock.
2)Process1 is locked R1 resource and waiting for R2 resource availability where as
Process2 locked R2 resource waiting for R1 resource availability.This situation is
called as Deadlock.
----------------------------------------------------------------------------------------------------------------------
13)What is Real-Time use of Dead Lock ?
1)Traffic Grid Lock is an everyday example of Dead Lock.
2)When two trains are coming toward each other on same track and there is only one track,
none of the trains can move once they are in front of each other .
----------------------------------------------------------------------------------------------------------------------
14)How to avoid Dead Lock ?
We can Prevent Dead Lock by eliminating the below four conditions
1)Mutual Exclusion
2)Hold and Wait
3)No Preemption
4)Circular Wait
-----------------------------------------------------------------------------------------------------------------------
15)What is Cache memory?
1)Cache Memory is used by the central processing unit of a computer to reduce the
average time to access memory.
2)The cache is a smaller, faster memory which stores copies of the data from the
most frequently used main memory locations.
3) As long as most memory accesses are cached memory locations, the average latency
of memory accesses will be closer to the cache latency than to the latency of main
memory.
------------------------------------------------------------------------------------------------------------------
16)What is Context Switching ?
1)Transferring the control from one process to other process requires saving the state
of the old process and loading the saved state for new process. This is known as
context switching.
2)Loading and Unloading of PCBs is called context switching.
------------------------------------------------------------------------------------------------------------------
17)What is I-Node Number?
Each file is given a unique name by the operating system which is called as the I-Node.
1)An inode is an entry in the table,containing information about a file including :
a)File Type,Permissions,UID,GID
b)The Link count
c)The File's Size and Various Time Stamps
d)Pointers to the files data blocks on disk
e)Other data about the file
--------------------------------------------------------------------------------------------------------------------
18)What is Daemon?
1)It is long lived.Often, a Daemon is created at system startup and runs until the system
is shutdown.
2)It runs in the background and has no controlling terminal.So,some of the signals are
ignored.(SIGINT,SIGSTOP,SIGHUP).
3)The purpose of Daemons are to handle periodic requests and then forward the requests
to appropriate programs for execution.
---------------------------------------------------------------------------------------------------------------------
19)What are the different types of Scheduling Policies?
1)FIFO(First In First Out)/FCFS(First Come First Serve)
2)Round Robin Scheduling
3)SJF(Shortest Job First)
4)Priority Based Scheduling
5)Multi Level Feedback Queues Scheduling
6)SRTF(Shortest Remaining Time First)
7)LRTF(Longest Remaining Time First)
8)Highest Response Ratio Next(HRRN)
9)Multilevel Queue Scheduling
---------------------------------------------------------------------------------------------------------------------
20)Explain FIFO Scheduling Algorithm?
1)FIFO is also Known as FCFS.
2)Simplest Scheduling Algorithm that Schedules according to arrival times of Processes.
3)FIFO assigns the CPU based on order of Requests.
4)FCFS is a Non-Preemptive Scheduling Algorithm.
5)Non-Preemptive:A Process Keeps running on a CPU until it is blocked (or) terminated.
-----------------------------------------------------------------------------------------------------------------------
21)Explain Round-Robin Scheduling Algorithm?
1)Round Robin Periodically releases the CPU from long-running Jobs.
2)Based on timer interrupts so short jobs can get a fair share of CPU time.
3)Preemptive:A process can be forced to leave its running state and replaced by
another running process.
4)Time-Slice:Interval between Timer Interrupts
5)If Time Slice is too long--Scheduling degrades to FIFO.
6)If Time Slice is too short--Through Put suffers--Context Switching cost dominates
-----------------------------------------------------------------------------------------------------------------------
22)Difference between FCFS and Round Robin?
1)FCFS not Suitable for Time Sharing Systems
Round Robin Scheduling Suitable for Time Sharing Systems
2)It is Non-Preemptive.
It is Preemptive.
3)It uses a FIFO Queue.
It uses FIFO Circular Queue.
-----------------------------------------------------------------------------------------------------------------------
23)Explain about Kernel ?
1)It is the core component of Operating System,interacts directly with hardware,provides
low level services to upper layer components.
2)It is responsible for handling all system processes.
3)All processes of memory and hardware initialization are carried out in kernel space.
4)All the Services of the Operating System are called Kernel Services.
----------------------------------------------------------------------------------------------------------------------
24)What are the types of kernel in Linux ?
The types of kernel in Linux are
1)Monolithic Kernel
2)Micro Kernel
3)Hybrid Kernel
---------------------------------------------------------------------------------------------------------------------
25)What are the components of a Kernel ?
The Components of a Kernel are
1)Process Management
2)Device Management
3)Memory Management
4)Interrupt Handler
5)Hardware Device Drivers
6)File system Drivers
7)Network Management
8)Synchronization and Communication
-----------------------------------------------------------------------------------------------------------------------
26)What is Shell?
1)Shell is Command language interpreter takes commands from the user and executes
Kernel's functions.
2)Shell is a Application,not a Service.
Note: Applications are Optional,Services are Mandatory.
-------------------------------------------------------------------------------------------------------------------
27)What is Multiprocessing ?
Multiple applications running simultaneously (or) concurrently are called as
Multiprocessing.
-------------------------------------------------------------------------------------------------------------------
28)What is Response Time?
1)The Time gap between process is created and the first instruction of the process
started executing that time gap is called Response Time.
2)Response Time less is a good environment.
--------------------------------------------------------------------------------------------------------------------
29)What is Starvation Time?
1)The Process in it's lifecycle how much of time it is starvated without executing by
the cpu that time is called as Starvation Time.
2)Starvation Time less is a good environment.
---------------------------------------------------------------------------------------------------------------------
30)What is TurnAround Time ?
1)The Time gap between process creation to the process completion is called as
TurnAround Time.
2)TurnAround Time less is a good environment.
-----------------------------------------------------------------------------------------------------------------------
31)What is Through Put ?
1)No of Processes completed per unit of Time is called as Through Put.
2)Through Put more is a good environment.
-----------------------------------------------------------------------------------------------------------------------
32)What is Running State ?
If a Process is executed by cpu then the process go to Running State.
---------------------------------------------------------------------------------------------------------------------
33)What is Ready State ?
If a Process is ready for execution but not executing by the cpu then the
process go to Ready State.
-------------------------------------------------------------------------------------------------------------------
34)What is Wait State ?
If a Process is waiting for external event to finish then the process is treated as
Wait State Process.
----------------------------------------------------------------------------------------------------------------------
35)What is Dealy State?
If a Process intentionally goes to the delay using sleep function,then the process
goes to Delayed State.
-----------------------------------------------------------------------------------------------------------------------
36)What is Suspend State ?
If a Process is Suspended because of some signal then the process go to Suspend state.
----------------------------------------------------------------------------------------------------------------------
37)What is Orphan Process ?
If Parent Completes its Process before Child Process then Child becomes Orphan.
---------------------------------------------------------------------------------------------------------------------
38)What is Zombie Process ?
If Child Completes its Process before Parent Process then Child becomes Zombie
(Dead Process).
-----------------------------------------------------------------------------------------------------------------------
39)What are the Booting Steps of Linux OS ?
1) BIOS :
a)BIOS Stands for Basic Input/Output System.
b)Performs Some System Integrity Checks.
c)It is Present in ROM.
d)Searches,loads, and executes the boot loader program.
e)It looks for boot loader in floppy,cd-rom (or) hard drive.
f)Once the boot loader program is detected and loaded into the memory,
BIOS gives the control to it.
2) MBR :
a)MBR stands for Master Boot Record.
b)This MBR is located in the Starting Sector of the bootable device.
c)MBR is less than 512 bytes in size.
d)Windows --- NT Loader
Linux --- LILO Loader
3)GRUB:
a)GRUB stands for Grand Unified Boot Loader.
b)It Loads the OS from hardisk to RAM.
c)If you have Multiple kernel images installed on your system,you
can choose which one to be executed.
d)It has the Knowledge of file system.
e)Universal Loader,Loader will Display.
4) Kernel :
a)It will load the kernel from hardisk to RAM.
b)Kernel executes the init program.
c)All the services started Executed.
5) Init :
a)Kernel will create the process.
b)Process Start running.
c)Process id is one.
d)Init will initiate Run Level Program(Minor Services).
6)Run Level Programs:
a)When the Linux System is booting up,you might see various services getting
Started.
b)Following are the available Run levels
1) 0 - Halt
2) 1 - Single User Mode
3) 2 - Multi User
4) 3 - Full Multi User Mode
5) 4 - Unused
6) 5 - X11
7) 6 - Reboot
------------------------------------------------------------------------------------------------------------------------
40)Difference between Nice and ReNice ?
1)Nice for modificaton of Scheduling Priority (or) Run a Program with modified
Scheduling Priority (or) Create a Process with Modified Scheduling Priority.
2)ReNice for modification of Scheduling Priority of Running Process (or) is a
Command to change the Priority of Running Process.
-----------------------------------------------------------------------------------------------------------------------
41)What is Scheduling ?
It is a Method of Selecting the Sequence of the Process in Simple Words chooses the
Process which has to be executed first in the CPU.
----------------------------------------------------------------------------------------------------------------------
42)Explain about PCB ?
1)PCB Stands for Process Control Block.
2)A Process Operations are Controlled with the help of PCB can be considered as brain
of the process,which contains all the information regarding to a process such as process id,
priority,state,present working state and contents of CPU register.
3)It is a Kernel based data structure which uses three kind of functions which are scheduling,
dispatching,Context save.
------------------------------------------------------------------------------------------------------------------------
43)What is umask ?
1)The user-file creation mode mask (umask) is use to determine the file permission
for newly created files.
2)It can be used to control the default file permission for new files.
3)It is a four digit octal number.
-----------------------------------------------------------------------------------------------------------------------
44)Difference between Hard Link and Soft Link ?
1)Hard Link is the direct reference to the file.
Soft Link is the reference by name which means it points to a file by file name.
2)A file can be accessed through many different names known as Hard Link.
A file can be accessed through different references pointing to that file is known
as Soft Link.
3)Command : ln filename1 filename2
Command : ln -s filename1 filename2
4)Inode Numbers are same.
Inode Numbers are Different.
5)Both files are regular.
One is Regular other is Link .
6)If we delete the Original file we can get the data from the link file.
If we delete the Original file we can not get the data.
7)File Size are same.
File Size is different.
---------------------------------------------------------------------------------------------------------------------
45)Difference between stat,fstat,lstat ?
1) These functions returns information about a file.
2)All are system calls.
3)Whenever the file name is a symbolic link,stat() returns the attributes (or)inode
information about the target file associated with the Link.Where as the lstat()
return the attributes of the link.fstat() is identical to stat(),except that the file
to be stat-ed is specified by the file descriptor.
4)For stat() and lstat() if we give regular file it will give regular file information.
For but stat() if we give link file it will give original file information but lstat()
gives link file information.
---------------------------------------------------------------------------------------------------------------------
46)Who is responsible for data transfer between Processes ?
a) The Kernel is responsible for data transfer between Processes.
b)The Kernel provides facilities such as 1)Signals
2)PIPE
3)FIFO
4)Message Queue
5)Shared Memory
6)Semaphore
------------------------------------------------------------------------------------------------------------------------
47)What is the Purpose of IPC Mechanisms ?
a)Data Transfer
b)Sharing Data
c)Event Notification
d)Resource Sharing
e)Process Control
----------------------------------------------------------------------------------------------------------------------
48)Explain about PIPE ?
a)Pipes Provide a Unidirectional Inter Process Communication Channel.
b)It is Unstructured data stream.
c)A pipe has a READ end and WRITE end.
d)Data Written to the write end of a pipe can be read from the read end of the pipe.
e)A pipe is created using a pipe(2) system call which contains a new pipe and returns two file
descriptors,one referring to the read end of the pipe,the other referring to the write end.
f)Pipe is used mainly for communication of related processes that means communication between
a parent and a child process.
g)Pipes have a limited capacity,a pipe is simply a buffer maintained in kernel memory(65536).
------------------------------------------------------------------------------------------------------------------------
49)What are the Disadvantages of PIPE ?
a)They are half-duplex.
b)Data flows in one direction.
c)If multiple processes writes data the reader cannot determine the boundaries.
d)If multiple readers are present a writer cannot direct data to specific reader.
-------------------------------------------------------------------------------------------------------------------------
50)Explain fork() system call ?
a)The fork system call is used to create a new processes.
b)The newly created process is the child process.
c)The process which calls fork and creates a new process is the parent process.
d)The child and parent processes executed concurrently.
e)It is used for creating child processes for a parent process.
f)Fork is called onces and returns twice.
g)It will return 0 to the newly created process(child) and process id of the child to the
calling process(Parent)
h)The child process gets copy of parents data,stack and heap segment.The code segment
is common for both.
---------------------------------------------------------------------------------------------------------------------
51)Explain about FIFO ?
a)FIFO is also called as Named Pipe.
b)It is used for communication between unrelated processes
c)FIFO stands for First in First Out.
d)FIFO has a write end and a read end,and data is read from the pipe in the same order
as it is written
e)We can create a fifo file in two ways
i)Through Command ii)Through Function
f)mkfifo --Library Function
mknod -- system call
g)Shell commands to pass data from one shell pipe to another without creating temporary
files.
h)By client server applications for sending data between clients and server.
---------------------------------------------------------------------------------------------------------------------
52)What are Limitations of FIFO ?
a)When process writing data into FIFO,reading process must and should be available.
b)No addressing mechanism.
c)If multiple reading processes are there in that case when writing process writes the
data there is no guarantee that who is going to receive it.
---------------------------------------------------------------------------------------------------------------------
53)Explain about Message Queue ?
a)Message queues can be used to pass messages between Processes.
b)Message queue are a linked list of messages stored with in the kernel.
c)They are identified by a message queue Identifier.
d)Message queues are somewhat like pipes,but differ in two important respects.
e)First,message boundaries are preserved,so that readers and writers communicate in units
of messages,rather than via un delimited byte stream.
f)Second,each message includes an integer type field,and it is possible to select messages by
type, rather than reading them in the order in which they are written.
-----------------------------------------------------------------------------------------------------------------------
54)What are the functions used in Message Queue ?
a)msgget() is useful for creating as well as opening the existing message queue.
b)msgsnd() is useful for transferring the message into the message queue
.
c)msgrcv() is useful for receiving the message from message queue.
d)msgctl() is useful for doing some control operations on the message queue.
-----------------------------------------------------------------------------------------------------------------------
55)What are disadvantages of Message Queue ?
a) It is called as Slowest IPC.
b)Message queues are connectionless,and the kernel doesn't maintain a count of the number
of processes referring to the queue as is done with pipes,FIFOs,and sockets.
----------------------------------------------------------------------------------------------------------------------
56)Explain about Shared Memory ?
a)It allows two (or) more processes to share a given region of memory.
b) It is the Fastest IPC mechanism.
c)Semaphores are used to synchronize shared memory access.
----------------------------------------------------------------------------------------------------------------------
57)What are the functions used in Shared Memory ?
a)shmget() is useful for creating as well as opening the shared memory segment.
b)shmat() is useful for attaching the shared memory segment to our process.so that process
can do the transactions.
c)shmdt() is useful for detaching the shared memory segments from our process.
d)shmctl() is useful for doing some control operations.
------------------------------------------------------------------------------------------------------------------------
58)What is PID ?
a)PID is process id.
b)The process manager recognises processes by an identification numbers and not with
names,this process identification number is called PID of a process.
c)A process is an executing instance of a program
d)Each process is guaranteed a unique PID,which is always a non negative integer.
------------------------------------------------------------------------------------------------------------------------
59)What do you meant by Multi Threading ?
1)Multi Threading is Multi Tasking,but enables the processing of multiple threads at one time,
rather than multiple processes.
2)For Example,a Multi Threaded Operating system may run several background tasks,such as
logging file changes,indexing data and managing windows at same time
--------------------------------------------------------------------------------------------------------------------------
60)What are drawbacks of Threading ?
1)Complex Debugging and Testing Processes.
2)Result is sometimes Unpredictable.
3)Overhead Switching of context
4)Increased Potential for deadlock occurrence.
5)Increased Difficulty level in writing a program.
-------------------------------------------------------------------------------------------------------------------------
61)Difference between getpid() and getppid() in Linux ?
Both getpid() and getppid() are inbuilt functions of unistd.h library
1)Syntax : a)pid_t getpid(void);
b)pid_t getppid(void);
2) a)It will give the process id.
b)It will give its parent process id.
3)Returns the PID of the calling process.
Returns the PID of the parent of the calling process.
--------------------------------------------------------------------------------------------------------------------------
62)Difference between signal() and sigaction() in Linux ?
Both are system calls
1)Signal returns the previous signal disposition on success.
Sigaction changes the disposition of a signal.
2)signal() function is simple
sigaction() function is complex
------------------------------------------------------------------------------------------------------------------------
63)What are the File Permissions in Linux ?
Permissions are associated with every file,and are useful for security.
1)There are three categories of users:
a)User (U)
b)Group (G)
c)Others (O)
2)There are three types of of access permissions:
a)Read (R)
b) Write (W)
c)Execute (E)
--------------------------------------------------------------------------------------------------------------------------
64)What are the Linux commands you Know ?
1)pwd - print working directory
The command is used to print the name of the current working directory.
2)cd - change directory
The command changes directories to specified directory
3)ls - list the files
The command lists the directory contents
4)cat
The command is used for displaying and create files
5)rm
The command is used to delete files
6)mv
The command is used to rename file (or) group of files as well as directories.
7)wc
The command counts lines,words,and character depending on option.
8)mkdir
The command creates a directory.
9)rmdir
The command removes a directory.
10)cp
The command copies information from one file to another.
11)head
The command will display the first 10 lines of a line.
12)tail
The command will display the last 10 of a file.
13)ps
The command display the current process status of the system.
---------------------------------------------------------------------------------------------------------------------