CSC264 ยท 2079 ยท 5 marks
List any two demerits of disabling interrupt to achieve mutual exclusion. Describe about fixed and variable partitioning.
List any two demerits of disabling interrupt to achieve mutual exclusion. Describe about fixed and variable partitioning. [5]
Quick answer
According to the notes, the following are two demerits of disabling interrupts to achieve mutual exclusion: Unsafe to give power to user processes; Not appropriate for user processes; Memory is divided into several fixed-size partitions before execution begins.
Answer
Two Demerits of Disabling Interrupts for Mutual Exclusion
According to the notes, the following are two demerits of disabling interrupts to achieve mutual exclusion:
-
Unsafe to give power to user processes: It is unwise to give user processes the power to turn off interrupts. If a user process disables interrupts and never re-enables them, the entire system could come to a halt. This makes the approach unsuitable for general user-level processes.
-
Not appropriate for user processes: Disabling interrupts is only a useful technique within the operating system itself. It is not appropriate for user processes because a malfunctioning or malicious process could permanently disable interrupts, causing the system to stop functioning correctly.
Fixed and Variable Partitioning
In a multiprogramming environment, several programs reside in primary memory at the same time and the CPU switches control between them. One way to support multiprogramming is to divide main memory into several partitions, each allocated to a single process. Depending on how and when partitions are created, there are two types:
(i) Fixed Partitioning (Static Partitioning)
- Memory is divided into several fixed-size partitions before execution begins.
- Each partition can accommodate only one program at a time.
- The number of programs residing in memory is bounded by the number of partitions.
- When a program terminates, its partition is freed for another program waiting in the queue.
- When a job arrives, it is placed in the input queue for the smallest partition large enough to hold it.
Demerit: Since partitions are fixed in size, any unused space within a partition cannot be used by other jobs and is simply wasted while that job runs. This is known as internal fragmentation.
(ii) Variable Partitioning (Dynamic Partitioning)
- Partitions are not fixed in advance; they are created dynamically at the time a process is loaded into memory.
- Each process is allocated exactly as much memory as it requires, so there is no internal fragmentation.
- As processes finish and leave memory, holes (free blocks) are created at various places in memory.
- Over time, memory becomes fragmented into many small holes scattered throughout, which is known as external fragmentation.
- Techniques such as compaction may be used to combine these holes into one large free block.
Demerit: External fragmentation occurs over time, making it difficult to allocate contiguous memory to new processes without compaction.
Comparison Table
| Feature | Fixed Partitioning | Variable Partitioning |
|---|---|---|
| Partition size | Fixed at system startup | Determined at load time |
| Internal fragmentation | Yes | No |
| External fragmentation | No | Yes |
| Flexibility | Low | High |
| Implementation | Simple | More complex |
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.