Operating System Interview Questions Q1.Explain the Meaning of Kernal
Total Page:16
File Type:pdf, Size:1020Kb
Operating system interview questions Q1.Explain the meaning of Kernal. Answer The kernel is the essential center of a computer operating system, the core that provides basic services for all other parts of the operating system. As a basic component of an operating system, a kernel provides the lowest-level abstraction layer for the resources. The kernel's primary purpose is to manage the computer's resources and allow other programs to run and use the resources like the CPU, memory and the I/O devices in the computer. The facilities provides by the kernel are : Memory management The kernel has full access to the system's memory and must allow processes to access safely this memory as they require it. Device management To perform useful functions, processes need access to the peripherals connected to the computer, which are controlled by the kernel through device drivers System calls To actually perform useful work, a process must be able to access the services provided by the kernel. Types of Kernel: Monolithic kernels Every part which is to be accessed by most programs which cannot be put in a library is in the kernel space: Device drivers Scheduler Memory handling File systems Network stacks Microkernls In Microkernels, parts which really require to be in a privileged mode are in kernel space: -Inter-Process Communication, -Basic scheduling -Basic memory handling -Basic I/O primitives Due to this, some critical parts like below run in user space: The complete scheduler Memory handling File systems Network stacks Q2.Explain the meaning of Kernel. Kernel is the core module of an operating system. It is the kernel that loads first and retain in main memory of the computer system. It provides all essential operations /services those are needed by applications. Kernel takes the responsibility of managing the memory, task, disk and process. Q3.What is a command interpreter? Answer The part of an Operating System that interprets commands and carries them out. A command interpreter is the part of a computer operating system that understands and executes commands that are entered interactively by a human being or from a program. In some operating systems, the command interpreter is called the shell. The BIOS is looking for the files needed to load in case of Windows is the Command.com. The required files are Command.com, IO.sys, and Msdos.sys to get Windows started. They reside in the Root of the C Drive. Q4.What is a daemon? In Unix and some other operating systems, a daemon is a computer program that runs in the background, It is not under the direct control of a user. They are usually initiated as background processes. Daemons have names that end with the letter "d". E.g. syslogd, sshd In a Unix, the parent process of a daemon is usually the init process (PID=1). Processes usually become daemons by forking a child process and then having their parent process immediately exit, thus causing init to adopt the child process. Q5.Explain the basic functions of process management. Answer The basic functions of the OS wrt the process management are : Allocating resources to processes, enabling processes to share and exchange information, protecting the resources of each process from other processes and enabling synchronisation among processes. Q6.What is a named pipe? Answer A connection used to transfer data between separate processes, usually on separate computers. Its a pipe that an application opens by name in order to write data into or read data from the pipe. They are placed in the /dev directory and are treated as special files. Using a named pipe facilitates interprocess communications. Q7.What is pre-emptive and non-preemptive scheduling? Answer Tasks are usually assigned with priorities. At times it is necessary to run a certain task that has a higher priority before another task although it is running. Therefore, the running task is interrupted for some time and resumed later when the priority task has finished its execution. This is called preemptive scheduling. Eg: Round robin In non-preemptive scheduling, a running task is executed till completion. It cannot be interrupted. Eg First In First Out Q8.What is a semaphore? Answer A semaphore is a variable. There are 2 types of semaphores: Binary semaphores Counting semaphores Binary semaphores have 2 methods associated with it. (up, down / lock, unlock) Binary semaphores can take only 2 values (0/1). They are used to acquire locks. When a resource is available, the process in charge set the semaphore to 1 else 0. Counting Semaphore may have value to be greater than one, typically used to allocate resources from a pool of identical resources. Q9.What is difference between binary semaphore and mutex? The differences between binary semaphore and mutex are: Mutex is used exclusively for mutual exclusion. Both mutual exclusion and synchronization can be used by binary. A task that took mutex can only give mutex. From an ISR a mutex can not be given. Recursive taking of mutual exclusion semaphores is possible. This means that a task that holds before finally releasing a semaphore, can take the semaphore more than once. Options for making the task which takes as DELETE_SAFE are provided by Mutex, which means the task deletion is not possible when holding the mutex. Q10.Explain the meaning of mutex. Answer A mutex and the binary semaphore are essentially the same. Both can take values: 0 or 1. However, there is a significant difference between them that makes mutexes more efficient than binary semaphores. A mutex can be unlocked only by the thread that locked it. Thus a mutex has an owner concept. What are the different types of memory? The memory types are: SIMM - Single-Line Memory Modules: Used to store single row of chips which are soldered onto Printed Circuit Board. DIMM – Dual-Line Memory Modules: Used to store two rows of chips which are soldered onto printed circuit board and enables to contain two times memory than SIMM DRAM – Dynamic Random Access Memory: It holds data for short time period and will be refreshed periodically. SDRAM - Static RAM – Holds data and refreshing does not required. It is faster than DRAM. Flash Memory: A non volatile, rewritable and solid state memory which performs the functions of both RAM and hard disk combined. Data is retained in the memory, in case of power loss. It is ideal for printers, cellular phones, digital cameras, pagers. Shadow RAM: Allows the moving of selected parts of BIOS code that is available in ROM to the faster RAM. Q11.Explain the meaning of virtual memory. Answer Virtual memory is an approach to make use of the secondary storage devices as an extension of the primary storage of the computer. It is the process of increasing the apparent size of a computer's RAM by using a section of the hard disk storage as an extension of RAM. Logically-assigned memory that may or may not exist physically. Through the use of paging and the swap area, more memory can be referenced and allocated than actually exists on the system, thus giving the appearance of a larger main memory than actually exists. Q12.What is RTOS? A certain capability within a specified time constraint is guaranteed by an operating system called „real time operating system‟. For example, certain object availability for a robot when it is assembled is ensured by a real time operating system. For making an object available within a designated time, the operating system would terminate with a failure. This is called a „hard‟ real time operating system. The assembly line will be continued for functioning, but the output of production might be lower as the objects appearance is failed in a designated time, which causes the robot to be temporarily unproductive. This is called „soft‟ real time operating system. Some of the real time operating systems qualities can be valuated by operating systems such as Microsoft‟s Windows 2000, IBM‟s OS/390 up to some extent. It means that, if an operating system does not qualify certain characteristics of the operating system enables to be considered as a solution to a certain real time application problem. There is a requirement of real time operating system in small embedded systems which are bundled as part of micro devices. The requirements of real time operating systems are considered for some kernels. Since device drivers also needed for a suitable solution, a real time operating system is larger than just a kernel. Q13.What is the difference between hard real-time and soft real-time OS? Critical task completion on time is guaranteed by a hard real time system. The tasks needed for delays in the system are to be bounded by retrieving the stored data at the time which takes the operating system to complete any request. A critical task obtains a priority over other tasks and maintaining that priority until the completion of the task. This is performed by a soft real time system. The system kernel delays need to be bounded as in the case of hard real time system Q14.What type of scheduling is there in RTOS? The tasks of real time operating system have 3 states namely, „running‟, ‟ready‟, „blocked‟. Only one task per CPU is being performed at a given point of time. In systems that are simpler, the list is usually short, two or three tasks at the most. The designing of scheduler is the real key. Usually to minimize the worst-case length of time spent in the scheduler‟s critical section, the data structure of the ready list in the scheduler is designed.