These are the some of the important interview questions regarding operating systems

Explain the concept of semaphore?
A semaphore is a protected variable or abstract data type that provides a simple but useful abstraction for controlling access by multiple processes to a common resource in a parallel programming environment. Semaphore is a correct way which help operating system to share its source between processors

What is memory management?
Memory management is the act of managing computer memory. In its simpler forms, this involves providing ways to allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. The management of main memory is critical to the computer system.

What is virtual memory?
Virtual memory is a memory management technique developed for multitasking kernels. This technique virtualizes a computer architecture’s various hardware memory devices (such as RAM modules and disk storage drives), allowing a program to be designed as though:
there is only one hardware memory device and this “virtual” device acts like a RAM module.
The program has, by default, sole access to this virtual RAM module as the basis for a contiguous working memory (an address space).

What is paging, segmentation?
Paging
Primary memory is divided into small equal sized partitions (256, 512, 1K) called page frames.
Process are divided into same sized blocks called pages.
Only bring in the pages you are referencing and keep those you have recently referenced.
Need a page table to this management.
Paging suffers from internal fragmentation.

SegmentationSegmentation maps segments representing data structures, modules, etc. into variable partitions. Not all segments of a process again are loaded at a time, nor are they in contiguous memory blocks.

Internal and external fragmentation?
Fragmentation occurs in a dynamic memory allocation system when many of the free blocks are too small to satisfy any request.
External 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. If too much external fragmentation occurs, the amount of usable memory is drastically reduced. Total memory space exists to satisfy a request, but it is not contiguous.

Internal Fragmentation: Internal fragmentation is the space wasted inside of allocated memory blocks because of restriction on the allowed sizes of allocated blocks. Allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used.

Another Definition:
Internal Fragmentation is the area in a region or a page that is not used by the job occupying that region or page. This space is unavailable for use by the system until that job is finished and the page or region is released.

What is O.S? (operating system)
An operating system (OS) is software, consisting of programs and data, that runs on computers, manages computer hardware resources, and provides common services for execution of various application software.

Functions of O.S?
Main functions of an Operating System are:

  • – Resource Management,
  • – Data Management,
  • – Job (task) Management, and
  • – Standard means of communication between user and computer.

What is TLB or TLAB?
A translation lookaside buffer (TLB) is a CPU cache that memory management hardware uses to improve virtual address translation speed. All current desktop and server processors (such as x86) use a TLB to map virtual and physical address spaces, and it is ubiquitous in any hardware which utilizes virtual memory.

Multiprogramming, Multitasking, Multiprocessing?
The term Multitasking is used when more than one applications/programs/tasks are being run on a single processor. On the other hand, Multi-Processing is the ability to use more than one processor (CPU), on a single machine.

Disadvantages of using semaphores?
Semaphore: It’s a synchronization tool, it’s a variable which accepts non-negative integer values and except for initialization may be accessed and manipulated through two primitive functions wait() & signal().

Disadvantages :
1. Semaphores are unstructured.
2. Semaphores do not support data abstraction.

Alternative to Semaphores:
1. Critical region
2. Conditional critical region
3. Monitors
4. Message Passing

What is dead lock? When does it occur?
A deadlock is a situation where in two or more competing actions are each waiting for the other to finish, and thus neither ever does.

What are the major Conditions for occurring of deadlock?
Deadlock can arise if four conditions hold simultaneously.
Mutual exclusion: Only one process at a time can use a resource.
Hold and wait: A process holding at least one resource is waiting to acquire additional resources held by other processes.
No preemption: A resource can be released only voluntarily by the process holding it, after that process has completed its task.
Circular wait: There exists a set {P0, P1, ?, P0} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, ?, Pn?1 is waiting for a resource that is held by Pn, and P0 is waiting for a resource that is held by P0.