Algorithms like first-fit, best-fit, and worst-fit are used for which of the operating...
Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Algorithms like first-fit, best-fit, and worst-fit are used for which of the operating system concepts given in options?
Show answer & explanation
First-fit, best-fit, and worst-fit are placement algorithms used in contiguous memory allocation to decide where to place a process in a single contiguous block of memory. These algorithms select from available holes (free memory blocks) based on different strategies: first-fit takes the first suitable hole, best-fit chooses the smallest hole that fits, and worst-fit picks the largest hole. Non-contiguous allocation doesn't need these strategies since memory can be scattered, deadlocks and swapping are unrelated OS concepts.
Step-by-step Derivation:
First-fit, best-fit, and worst-fit are classic memory placement algorithms:
- First-fit: Allocate to the first hole large enough
- Best-fit: Allocate to the smallest hole that fits (minimizes wasted space)
- Worst-fit: Allocate to the largest hole (maximizes remaining hole size)
These apply only to contiguous memory allocation where:
- The OS maintains a list of free memory holes
- A process needs one contiguous block
- The algorithm must choose which hole to use
In non-contiguous allocation (paging/segmentation), memory can be scattered across pages/segments, so these placement algorithms are irrelevant. Deadlocks and swapping are separate OS concerns.