CS FundamentalsHardGATE CS (PYQ pattern)
Free memory consists of three holes (start, size in KB): (0, 300), (400, 200), (700, 500); everything else is allocated. Operations in order: allocate A = 150, allocate B = 180, free A, allocate C = 120, allocate D = 260, allocate E = 200 (KB). A chosen hole is split (allocation at its low end), freed blocks merge with adjacent holes, ties go to the lower address, and there is no compaction. Under first-fit, best-fit and worst-fit, which requests fail?
- A. Only best-fit fails, when E (200 KB) arrives
- B. No policy fails any request
- C. Only worst-fit fails, when D (260 KB) arrives
- D. First-fit and worst-fit both fail at D
Correct answer: C. Only worst-fit fails, when D (260 KB) arrives
Worst-fit puts A and B into the 500 KB hole (leaving 170), A's release leaves a separate 150 KB hole, C takes 120 of the 300 hole, and the largest hole is then 200 < 260, so D fails. First-fit: A at 0, B at 400, A's release merges back to 300, C at 0, D and E fit in the 500 hole (260 + 200 of it remaining 240). Best-fit: A in 200, B in 300, freeing A re-forms 200, C fits the 180 left at 180, D goes to 700, E fills the 200 hole exactly.
More Operating Systems questions
- On a Unix file system with an empty directory /tmp/x (call it X), these commands run: mkdir X/a; mkdir X/a/b; mkdir X/a/c; touch X/a/f; ln…
- A process has 4 threads on a single CPU. Each thread computes for 10 ms, makes a blocking disk read that takes 30 ms, then computes for…
- A 4-level x86-64 style page table maps 4 KB pages through all four levels, 2 MB pages with the third-level entry as the leaf and 1 GB…
- A data TLB has 64 entries and the OS backs a 1.5 GB array with 2 MB pages. A program accesses array elements uniformly at random and…
- Reference string: 8, 6, 5, 3, 3, 1, 6, 8, 2, 6, 1, 7, 3, 8, 7, 3, 3, 4, 1, 2, 3, 2, 7, 2, 5, 4, 4, 7, 2, 5. What is the smallest number of…
- SRTF with processes (arrival, burst) in ms: P1 (0, 10), P2 (1, 6), P3 (2, 3), P4 (3, 8), P5 (5, 1), P6 (6, 2). Ties go to the earlier…