Operating System Basic Interview Questions and Answers
Q1: What is an Operating System?
An operating system is a program that acts as an intermediary between the user and the computer hardware. The purpose of an OS is to provide a convenient environment in which user can execute programs in a convenient and efficient manner
Q2: What are the different Operating Systems?
- Batched operating systems
- Multi-programmed operating systems
- Timesharing operating systems
- Distributed operating systems
- Real-time operating systems
Q3: What are the basic functions of an Operating System?
Operating system controls and coordinates the use of the hardware among the various applications programs for various uses. Operating system acts as resource allocator and manager. Also operating system is control program which controls the user programs to prevent errors and improper use of the computer. It is especially concerned with the operation and control of I/O devices.
Q4: What is Kernel?
Kernel is the core and essential part of computer operating system that provides basic services for all parts of OS.
Q5: What is difference between Micro Kernel and Macro Kernel?
Micro kernel is a kernel which run services those are minimal for operating system performance. In this kernel all other operations are performed by processor.
Macro Kernel is a combination of micro and monolithic kernel. In monolithic kernel all operating system code is in single executable image.
Q6: What is Dead Lock?
Deadlock is a situation or condition where the two processes are waiting for each other to complete so that they can start. This result both the processes to hang.
Q7: What is a Process?
A program in execution is called a process.
Processes are of two types:
1. Operating system processes
2. User processes
Q8: What are the states of a Process?
Q9: What is Starvation and Aging?
Starvation is Resource management problem where a process does not get the resources it needs for a long time because the resources are being allocated to other processes.
Aging is a technique to avoid starvation in a scheduling system.
Q10: What is a Thread?
A thread is a program line under execution. Thread sometimes called a light-weight process, is a basic unit of CPU utilization; it comprises a thread id, a program counter, a register set, and a stack
Q11: What is Process Synchronization?
A situation, where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called race condition. To guard against the race condition we need to ensure that only one process at a time can be manipulating the same data. The technique we use for this is called process synchronization.
Q12: What is Virtual Memory?
Virtual memory is hardware technique where the system appears to have more memory that it actually does. This is done by time-sharing, the physical memory and storage parts of the memory one disk when they are not actively being used.
Q13: What is fragmentation? Tell about different types of fragmentation?
When many of free blocks are too small to satisfy any request then fragmentation occurs. External fragmentation and internal fragmentation are two types of fragmentation. External Fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used. Internal fragmentation is the space wasted inside of allocated memory blocks because of restriction on the allowed sizes of allocated blocks.
Q14: What are necessary conditions for dead lock?
- Mutual exclusion (where at least one resource is non-sharable)
- Hold and wait (where a process holds one resource and waits for other resource)
- No preemption (where the resources can’t be preempted)
- Circular wait (where p[i] is waiting for p[j] to release a resource. i= 1,2,
j=if (i!=n) then i+1
else 1 )
Q15: What is Cache Memory?
Cache memory is random access memory (RAM) that a computer microprocessor can access more quickly than it can access regular RAM. As the microprocessor processes data, it looks first in the cache memory and if it finds the data there (from a previous reading of data), it does not have to do the more time-consuming reading of data from larger memory.[/box
Q16: Differentiate between Complier and Interpreter?
An interpreter reads one instruction at a time and carries out the actions implied by that instruction. It does not perform any translation. But a compiler translates the entire instructions
Q17: What is Throughput, Turnaround Time, Waiting Time and Response Time?
Throughput: number of processes that complete their execution per time unit
Turnaround Time:amount of time to execute a particular process
Waiting Time: amount of time a process has been waiting in the ready queue
Response Time: amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)
Q18: What is Memory-Management Unit (MMU)?
Hardware Device that maps virtual to physical address. In MMU scheme, the value in the relocation register is added to every address generated by a user process at the time it is sent to memory.
- The user program deals with logical addresses; it never sees the real physical addresses
Q19: What is a Real-Time System?
A real time process is a process that must respond to the events within a certain time period. A real time operating system is an operating system that can run real time processes successfully
Q20: Difference between Primary Storage and Secondary Storage?
Primary memory is the main memory (Hard disk, RAM) where the operating system resides.
Secondary memory can be external devices like CD, floppy magnetic discs etc. secondary storage cannot be directly accessed by the CPU and is also external memory storage.