1. Which memory allocation strategy selects the smallest free partition that is large enough to satisfy a process request?
That’s Best-Fit.
It searches the available free blocks and selects the smallest block that is large enough for the requested process.
Free blocks: 10KB 25KB 40KB 60KB
Request: 30KB
↓
Best-Fit → 40KB
The remaining space is:
40KB block
┌──────────────────────┐
│ Process = 30KB │ 10KB│
└──────────────────────┘
↑
leftover
The catch: Best-Fit can create many small external fragments over time.
It may look efficient for each individual allocation, but the leftover holes can become too small to satisfy future requests.
2. What is the primary drawback of Fixed Partitioning compared to Dynamic Partitioning?
The main drawback of Fixed Partitioning is internal fragmentation.
Memory is divided into fixed-size partitions before processes are loaded.
Memory
┌──────────────┐
│ Process 5 MB │
│ │ ← 3 MB wasted
│ Partition │
│ 8 MB │
└──────────────┘
If a 5 MB process is placed in an 8 MB partition, 3 MB inside that partition cannot be used by another process.
| Fixed Partitioning | Dynamic Partitioning | |
|---|---|---|
| Partition sizes | Fixed in advance | Created as needed |
| Main fragmentation | Internal | External |
| Flexibility | Low | High |
Dynamic partitioning reduces internal fragmentation because partitions are created according to process requirements, but it can produce external fragmentation.
3. Which of the following is a major limitation of Contiguous Memory Allocation?
A major limitation is external fragmentation.
A process must occupy one continuous region of physical memory.
Memory:
[Process A][FREE][Process B][FREE][FREE][Process C][FREE]
Total FREE = 30 KB
New process needs 25 KB
↓
No single 25 KB block exists
↓
Cannot allocate
Even though the total free memory may be sufficient, it is split into separate holes.
Solution: Compaction can move processes together:
Before:
[A][FREE][B][FREE][C][FREE]
After compaction:
[A][B][C][ FREE ]
However, compaction is expensive because processes must be relocated.
4. How does Non-Contiguous Memory Allocation (like Paging) eliminate external fragmentation?
Paging divides:
- Logical memory → pages
- Physical memory → frames
Pages and frames are the same size, so any page can be placed into any available frame.
Process:
[Page 0][Page 1][Page 2][Page 3]
RAM:
[Frame 7][Frame 2][Frame 9][Frame 1]
↑ ↑ ↑ ↑
P0 P1 P2 P3
The pages do not need to be physically adjacent.
Therefore, paging eliminates external fragmentation.
However, paging can still cause internal fragmentation, particularly in the last page of a process.
Process needs 10 KB
Page size = 4 KB
Pages needed = 3
Allocated = 12 KB
Wasted = 2 KB
↑
internal fragmentation
Paging also requires a page table to map pages to frames.
5. What is the primary purpose of a Translation Lookaside Buffer (TLB) in virtual memory?
The TLB is a small, high-speed cache that stores recent page-table translations.
Without a TLB:
CPU
↓
Virtual Address
↓
Page Table in RAM
↓
Physical Address
↓
Actual memory access
With a TLB:
CPU
↓
Virtual Address
↓
TLB
├── Hit → Physical Address → RAM
│ ↑
│ FAST
│
└── Miss → Page Table → Update TLB → RAM
The TLB reduces the time required for virtual-to-physical address translation.
It works well because programs tend to repeatedly access the same pages (locality).
6. At which stage of Address Binding are absolute physical addresses generated directly in the executable file?
Compile-time binding, but only when the final physical memory location is known at compile time.
Source Code
↓
Compiler
↓
Executable containing
absolute addresses
↓
Memory
There are three common stages:
| Binding | When address is determined |
|---|---|
| Compile time | During compilation |
| Load time | When program is loaded |
| Execution time | During execution |
Compile-time binding requires the program’s starting location to be known in advance. If that location changes, the program may need to be recompiled.
Execution-time binding allows a process to be relocated while running and requires hardware support such as an MMU.
Modern general-purpose operating systems commonly use run-time address translation, often combined with virtual memory.
7. What is the role of the Memory Management Unit (MMU) during program execution?
The MMU is hardware that translates virtual addresses generated by the CPU into physical addresses in memory.
CPU
│
│ Virtual Address
▼
MMU
│
│ Page table / TLB
▼
Physical Address
│
▼
RAM
For example:
Virtual address
│
▼
MMU
│
▼
Physical address
│
▼
RAM
The MMU is important because it provides:
- Virtual memory.
- Process memory isolation.
- Memory protection.
- Controlled memory sharing.
- Virtual-to-physical address translation.
8. What is the core concept of the Overlay Technique in memory management?
The Overlay Technique allows a program larger than available physical memory to run by keeping only the currently needed modules in memory.
Suppose a program contains modules A, B, and C that don’t need to be in memory simultaneously.
Memory:
┌─────────────────┐
│ Main Program │
├─────────────────┤
│ Overlay Area │
│ │
│ A │
└─────────────────┘
Later:
┌─────────────────┐
│ Main Program │
├─────────────────┤
│ Overlay Area │
│ │
│ B │
└─────────────────┘
B overwrites A because they don’t need to exist simultaneously.
This was useful before modern virtual memory became common.
Disadvantage: the programmer had to manually determine which modules could share the overlay area, making the technique complicated.
9. How does Copy-on-Write (COW) optimize process creation in operating systems?
Copy-on-Write allows the parent and child to initially share the same physical pages after fork().
The pages are marked so that writing causes a copy.
After fork():
Parent ──┐
├──> Shared Page A
Child ──┘
Parent writes Page A
↓
Page fault / protection fault
↓
OS copies Page A
↓
Parent → Private Page A
Child → Original Page A
Steps:
fork()creates the child.- Parent and child initially share physical pages.
- A process tries to modify a shared page.
- The OS creates a private copy of that page.
- The writing process modifies its copy.
This avoids copying the entire address space when most pages will never be modified.
10. What is the fundamental difference between the fork() and exec() system calls?
fork()creates a new child process.exec()replaces the current process’s program image with another program.
fork():
Parent
│
├──────> Parent
│
└──────> Child
After fork(), there are two processes.
With exec():
Child running Program A
│
exec()
↓
Child running Program B
The PID normally remains the same across exec().
They are commonly used together:
pid = fork();
if (pid == 0) {
exec("/bin/ls");
}
So:
fork = create a process exec = replace the process’s program
11. Which of the following is true regarding Pipe Communication (anonymous pipes) in Unix-like systems?
An anonymous pipe is a one-way byte stream commonly used between related processes.
Process A
│
│ write()
▼
┌──────────┐
│ PIPE │
└──────────┘
│
│ read()
▼
Process B
Key points:
- Data flows from the write end to the read end.
- The pipe is maintained by the kernel.
- It is not a regular disk file.
- Anonymous pipes normally have no filesystem pathname.
- They are commonly used between related processes, such as a parent and child.
Example:
ls | grep "txt"
Conceptually:
ls ──write──> pipe ──read──> grep
For bidirectional communication, two pipes can be used, or another IPC mechanism such as sockets can be chosen.
12. What advantage does a Message Queue have over a Pipe for Inter-Process Communication (IPC)?
A message queue allows processes to exchange discrete messages rather than an undifferentiated byte stream.
Sender
│
│ Message 1
│ Message 2
▼
┌─────────────────┐
│ Message Queue │
└─────────────────┘
│
▼
Receiver
For example:
Message 1 → "LOGIN"
Message 2 → "DATA"
Message 3 → "LOGOUT"
The queue preserves message boundaries.
Advantages:
- Messages are discrete and structured.
- Sender and receiver don’t necessarily have to execute simultaneously.
- Multiple processes can potentially use the same queue.
- Messages can sometimes be prioritized or selected by type, depending on the IPC implementation.
A pipe, by contrast, is fundamentally a byte stream.
Note: Saying a message queue lets the sender “exit” while the receiver reads later is generally true if the message remains queued, but exact queue lifetime and persistence depend on the operating system’s IPC implementation.
13. Why is Shared Memory considered the fastest form of Inter-Process Communication (IPC)?
Shared memory allows multiple processes to access the same physical memory region through their virtual address spaces.
Process A Process B
│ │
│ read/write │ read/write
▼ ▼
┌───────────────┐
│ Shared Memory │
└───────────────┘
Unlike pipes or message queues, the actual data does not have to be copied through the kernel for every exchange.
Pipe:
Process A → Kernel → Process B
Shared Memory:
Process A ──┐
├──> Same memory
Process B ──┘
Therefore, shared memory can provide very high data-transfer performance.
But: synchronization is still required when processes access shared data concurrently.
Common synchronization mechanisms include:
- Mutexes
- Semaphores
- Condition variables
So:
Shared memory = fast data sharing + explicit synchronization
14. What distinguishes Socket Communication from other local Inter-Process Communication (IPC) methods?
Sockets can provide communication between processes on the same machine or different machines.
Machine A Machine B
Process A Process B
│ ▲
▼ │
Socket ─────── Network ───────── Socket
With TCP:
Process A
↓
Socket
↓
TCP/IP
↓
Network
↓
TCP/IP
↓
Socket
↓
Process B
Sockets can also be used locally through Unix domain sockets:
Process A ── Unix Socket ──> Process B
(same machine)
This makes sockets a flexible IPC mechanism for both local and network communication.
15. What is the primary objective of a Remote Procedure Call (RPC)?
RPC allows a program to invoke a procedure on a remote system using an interface that resembles a local function call.
Client Server
Application Application
│ ▲
▼ │
Client Stub Server Stub
│ ▲
└────── Network ───────────────┘
Conceptually:
Client:
result = add(2, 3)
↓ RPC
Server:
add(2, 3)
↓
5
↓
Client receives:
result = 5
Behind the scenes:
- The client calls the client stub.
- The stub marshals (serializes) the arguments.
- The request is sent over the network.
- The server stub unmarshals the request.
- The server executes the procedure.
- The result is serialized and returned to the client.
The main goal is to hide much of the communication complexity so distributed operations can be expressed through procedure-like interfaces.
However, an RPC is not truly the same as a local function call: network delay, failures, serialization, and timeouts can occur.
Premium Content
Unlock Top 50 - Part 2 and all premium lessons with a subscription.
From ₹199.99/year — See plans