Machine-translated by Google. Questions are authored in English.
Top

Memory Management Questions and Answers

91.

When the memory allocated to a process is slightly larger than the process, then :

Answer: A

Correct answer: internal fragmentation occurs

Memory allocated to a process but not used by it is internal fragmentation - the waste lies inside the allocation. External fragmentation is waste between allocations.

Please log in or register to report this question.

Answer: B

Correct answer: each process occupies a single unbroken block of memory

Contiguous allocation gives each process one unbroken region of physical memory, defined by a base address and a limit. Its virtue is simplicity: address translation needs only an addition and a bounds check, so a single relocation register and limit register suffice, and no page table is required. Its defect is external fragmentation. As processes come and go, free memory is left in scattered holes, and a request may fail even when the total free space is ample. Compaction can cure it by shuffling processes together, but at a heavy cost in copying and only where relocation is dynamic. The scheme comes in two forms. Fixed partitioning divides memory into a set number of regions, wasting whatever a process does not fill - internal fragmentation. Variable partitioning allocates exactly what is asked for, avoiding that but suffering external fragmentation instead. Paging was introduced to escape the dilemma: because any free frame serves for any page, contiguity is never required.

Please log in or register to report this question.

93.

Compaction is used to solve which problem?

Answer: A

Correct answer: External fragmentation

Compaction moves allocated blocks together at one end of memory so that all the free space forms a single large hole. It is the remedy for external fragmentation, where enough total memory is free but it is scattered in pieces too small to be useful. It has two serious costs. Copying every process is expensive, and the system can do nothing else meanwhile. And it is possible only if relocation is dynamic - addresses bound at execution time through a base register - since a process whose addresses were fixed at load time cannot be moved. It does nothing for internal fragmentation, which is space wasted inside an allocated block and cannot be recovered by rearrangement. The better answer to external fragmentation is paging, which removes the problem by definition: since any free frame will serve for any page, physical contiguity is never required and there is nothing to compact. Compaction survives in garbage-collected runtimes, where it consolidates the heap.

Please log in or register to report this question.

Answer: A

Correct answer: The pages of a process currently held in physical memory

The resident set is the portion of a process’s pages that are actually in physical memory at a given moment. The rest of its address space sits on the backing store. It should be distinguished from two neighbouring ideas. The address space, the second option, is everything the process could in principle reference. The working set is the pages referenced within a recent window - a measure of what the process needs rather than what it currently has. The relation between resident set and working set is what determines performance. If the resident set contains the working set, faults are rare; if it is smaller, the process faults constantly and thrashes. Frame allocation policy is essentially the business of keeping the first at least as large as the second. Resident set size is what a process monitor reports as a program’s memory use, and it is why that figure is usually far smaller than the program’s virtual size - and why the two are reported separately.

Please log in or register to report this question.

Answer: A

Correct answer: the set of pages it has referenced in a recent interval

The working set is the set of pages a process has referenced within the most recent window of \( \Delta \) references. It is Denning’s model, and it is an approximation of the process’s current locality. Its purpose is practical. If every process is given enough frames to hold its working set, page faults stay rare and the system runs efficiently; if a process has fewer, it thrashes. The operating system therefore sums the working set sizes of all processes and, if the total exceeds the available frames, suspends one - freeing its frames for the rest rather than letting every process thrash together. The choice of window matters. Too small a \( \Delta \) misses part of the locality; too large a one spans several localities and overstates the requirement. Tracking it exactly is expensive, so it is approximated with reference bits sampled at intervals. The related control is page-fault frequency, which adjusts allocation by watching the fault rate directly rather than by measuring the working set.

Please log in or register to report this question.

Answer: A

Correct answer: translate a logical page number into a physical frame number

A page table maps each logical page of a process to the physical frame holding it. A logical address is split into a page number and an offset; the page number indexes the table to give a frame number, and the offset is carried across unchanged. That indirection is what makes paging work. A process’s pages need not be contiguous in physical memory, so external fragmentation disappears, and each process gets its own address space isolated from every other. Its cost is an extra memory access for every reference, which would halve performance. The remedy is the translation lookaside buffer, a small associative cache of recent translations; hit rates above 90 per cent bring the average close to a single access. Each entry also carries protection and status bits - valid or invalid, read-only, and a modified or dirty bit recording whether the page must be written back when replaced. For large address spaces the table is itself paged, giving multilevel page tables.

Please log in or register to report this question.

Answer: A

Correct answer: run a program larger than available memory by loading parts of it in turn

Overlays allowed a program larger than physical memory to run by keeping only the instructions and data needed at a given moment in memory, and loading a different portion over the same area when a new phase began. A two-pass assembler is the classic example: pass one and pass two are never needed simultaneously, so both occupy the same overlay region in turn, with a small permanently resident driver managing the switching. The critical burden was that overlays had to be designed by the programmer. The program had to be divided by hand into parts that were never needed together, and the loading arranged explicitly. That required detailed knowledge of the program’s structure and was error-prone. Virtual memory made the technique obsolete by achieving the same end automatically: the operating system pages in what is referenced and pages out what is not, with no cooperation from the programmer at all. Overlays survive only in small embedded systems without memory management hardware.

Please log in or register to report this question.

98.

When a page must be replaced and the victim page is clean, the operating system can

Answer: A

Correct answer: discard it without writing it to disk

A clean page is one that has not been modified since it was loaded, so an identical copy already exists on the backing store. It can simply be discarded, and the frame reused at once. A dirty page must first be written out, which costs a disk write of several milliseconds - and that write sits in the critical path of the page fault, delaying the process that is waiting. The distinction is recorded by the dirty bit, set by hardware on any write to the page. Because the difference in cost is so large, some replacement algorithms weigh the dirty bit alongside recency, preferring a clean victim where the choice is close. The enhanced second-chance algorithm does exactly this, ranking pages by the pair of reference and dirty bits. Code pages are typically read-only and therefore always clean, which makes them cheap to evict - one reason a program under memory pressure loses its instructions before its data. Some systems also write dirty pages out in the background to keep clean pages available.

Please log in or register to report this question.

Answer: D

Correct answer: can be loaded and run at any address in memory

A relocatable program can be placed anywhere in memory, because its addresses are expressed relative to a starting point rather than as absolute values. The loader or the hardware supplies the actual base. The alternative is absolute code, produced by binding addresses at compile time. It must be loaded at one fixed address, and moving it requires recompilation - workable only where a single program owns the machine. Relocation may happen at load time, when the loader adjusts every address once, after which the program cannot move; or at execution time, when a base register is added to each address by hardware, and the program can be moved simply by changing the register. Only execution-time binding permits swapping and compaction, since both require a running process to change location. It is what every general-purpose system uses, and paging is its general form, with a page table in place of a single register.

Please log in or register to report this question.

Answer: B

Correct answer: mapping the same physical frame into several processes’ page tables

Sharing is achieved by having the page tables of several processes point to the same physical frame. Each process sees the page at whatever virtual address suits it, and only one copy exists in memory. This is how shared libraries work: the code of a library used by twenty processes occupies one set of frames rather than twenty. The same mechanism serves shared memory between cooperating processes, and memory-mapped files. Two conditions apply to shared code. It must be reentrant - never modifying itself, so that its instructions are identical for every user - and it is marked read-only in every page table, which enforces that. Each process keeps its own private data and stack pages. Where a process must be able to write to an initially shared page, copy-on-write is used: the page is shared read-only until a write faults, at which point it is duplicated for the writer alone. Sharing is one of the reasons paging is preferred to contiguous allocation.

Please log in or register to report this question.

Loading…
Tags: Memory Management Questions and Answers || Memory Management MCQ Questions and Answers || Memory Management GK Questions and Answers || Memory Management GK MCQ Questions || Memory Management Multiple Choice Questions and Answers || Memory Management GK || GK on Memory Management || Computer Awareness Questions and Answers || Computer Awareness MCQ Questions and Answers || Computer Awareness GK Questions and Answers || GK on Computer Awareness