Operating System Interview Questions and Answers
Question - 51 : - What differences are there between a semaphore wait signal and a condition variable wait signal?
Answer - 51 : - Semaphore wait signal:
- They can be used anywhere except in a monitor.
- The wait() function does not always blocks its caller.
- The signal() function increments the semaphore counter and can release a process.
- If the signal() releases a process, the released and the caller both continue.
Condition Variable wait signal:
- It can only be used in monitors.
- The wait() function always blocks its caller.
- The signal() can either release a process or it is lost as if it never occurred.
- On signal() releasing a process either the caller or the released continues but not both at the same time.
Question - 52 : - Why is the context switch overhead of a user-level threading as compared to the overhead for processes? Explain.
Answer - 52 : - This is due to the reason that a context switch implementation is done by the kernel. During this process the state information is copied between the processor and the PCB (process control block) or the TCB (thread control block). Since the kernel does not know anything about user-level threads, technically it is not possible for it to be a user level thread context switch. The user level scheduler can do some limited state copying on the behalf of a thread prior to the control being handed to that thread. But this copying of state information is smaller compared to that of a kernel-level process. Also the process does not involve going into the kernel mode with the help of a system call.
Question - 53 : - State the advantages of segmented paging over pure segmentation?
Answer - 53 : - In broad terms paging is a memory management technique that allows a physical address space of a process to be non-contiguous.
Segmented paging has a certain set of advantages over pure segmentation such as:
- Segmented paging does not have any source of external fragmentation.
- Since a segment existence is not restricted to a contiguous memory range it can be easily grown and does not have to adjust into a physical memory medium.
- With segmented paging the addition of an offset and a base is simpler as it is only an append operation instead of it being a full addition operation.
Question - 54 : - When does the Belady's anomaly occur?
Answer - 54 : - The Belady's anomaly is a situation in which the number of page faults increases when additional physical memory is added to a system. This anomaly arises in some algorithms that implement virtual memory. The virtual memory allows programs larger than the physical memory space to execute. An algorithm suffers from this problem when it cannot guarantee that a page will be kept when a small number of frames are available. An optimal algorithm would not suffer from this problem as it replaces the page not to be used for the longest time. The anomaly occurs when the page replacement algorithm will remove a page that will be needed in the immediate future. An optimal algorithm will not select such a page that will be required immediately. This anomaly is also stated to be unbounded.
Question - 55 : - What complications does concurrent processing add to an operating system?
Answer - 55 : - There are various complications of concurrent processing such as:
- A time sharing method must be implemented to allow multiple processes to have an access to the system. This will involve the preemption of processes that do not give up CPU on their own i.e. more than one process may be executing kernel code simultaneously.
- The amount of resources that a process can use and the operations that it may perform must be limited. The system resources and the processes must be protected from each other.
- Kernel must be designed to prevent deadlocks between the various processes, i.e. Cyclic waiting or hold and waiting must not occur.
- Effective memory management techniques must be used to better utilize the limited resources.
Question - 56 : - How can a VFS layer allow multiple file systems support?
Answer - 56 : - The VFS layer also known as the virtual file system functions in many ways similar to object oriented programming techniques. It acts like an abstraction layer on top of a more specific file system. The VFS layer enables the OS to make system calls independent of the file system type used. Any file system that is used gives its function calls used and the data structures to the layer of VFS. The VFS layer translates a system call into the correct specific functions for the targeted file system. The program that is used for calling does not have a file system specific code also the system call structures used in upper levels are file system independent. The VFS layer translation translates the non-file system specific calls into a file system specific operation.
Question - 57 : - What are the pros and cons of using circuit switching?
Answer - 57 : - The primary advantage of using circuit switching is that it ensures the availability of resources. That is it reserves the network resources required for a specific transfer prior to the transmission taking place. By doing so it ensures that no packet would be dropped and the required quality of service is met.
The disadvantage of using circuit switching is that it requires a round trip message to setup a reservation. By doing so as it provisions the resources ahead of the transmission it might lead to the suboptimal use of resources.
Circuit switching can be implemented for applications that have constant demand for network resources for long periods of time.
Question - 58 : - What problems are faced during the implementation of a network-transparent system?
Answer - 58 : - A designer primarily faces two major problems while implementing a network-transparent system. They are as follows:
- The primary problem is to make all the processors and storage devices to appear transparent on the network. This implies that the distributed system should appear as a single centralized system to the users using the network.
There are two solutions to it:
- The Andrews files system
- The NFS system.
- Both these file systems (distributed) appear as a single file system to the user whereas in reality it may be distributed over the network.
- The secondary issue is regarding the user mobility. The designer would want any user to connect to the entire system overall rather than to a particular machine.
Question - 59 : - Explain the layers of a Windows XP system.
Answer - 59 : - The layers of Windows XP system boot-up is as follows:
- A situation of operating system portability is created by the hardware abstraction layer by hiding hardware differences from the operating systems upper layers. A virtual machine interface is provided by the hardware abstraction layer to be used by the kernel dispatcher and the device drivers.
- The foundation provided by the kernel layer is used by the executive functions and the user mode sub systems. The kernel would always remain in memory and cannot be preempted. The functions of the kernel are thread scheduling, interrupt and exception handling etc.
- The executive layer is responsible for providing services to be used by all subsystems. These can be object manager, process manager, i/o manager etc.
Question - 60 : - Explain the booting process of a Windows XP system.
Answer - 60 : - he steps involved are as follows:
- As the computer is powered on, the BIOS begins execution from ROM, it loads and executes the bootstrap loader.
- The NTLDR program is loaded from the root directory of the system disk and determines which boot disk contains the operating system.
- NTLDR loads the HAL library, kernel and system hive. The system hive indicates the required boot drivers and loads them one by one.
- Kernel execution begins by initializing the system and creating two processes: the system process containing all internal worker threads and the first user-mode initialization process: SMSS.
- SMSS further initializes the system by establishing paging files and loading device drivers.
- SMSS creates two processes: WINLOGON, which brings up the rest of the system and CSRSS, the Win32 subsystem process.