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

Memory Management Questions and Answers

233.

Which among the following page replacement algorithms suffers from Belady’s anomaly?

Answer: A

Correct answer: FIFO

Belady's anomaly is the counter-intuitive result that giving a process more frames can increase the number of page faults, and FIFO is the standard example. LRU and the optimal algorithm are stack algorithms, and stack algorithms cannot suffer it.

Please log in or register to report this question.

234.

The owner of an address space can grant a number of its

Answer: B

Correct answer: Pages

In a system that shares memory between address spaces, the unit that can be granted to another owner is the page, since that is the unit the mapping hardware works in.

Please log in or register to report this question.

235.

A process can map any of its pages into the address space of another

Answer: A

Correct answer: Process

A page may be mapped into the address space of another process, which is how two processes come to share physical memory while each keeps its own address space.

Please log in or register to report this question.

236.

In CPP, dynamic memory allocation is done using ______________ operator. 

Answer: D

Correct answer: New

In C++ dynamic memory is obtained with the new operator and released with delete. malloc and calloc are C library functions, and unlike new they do not call a constructor.

Please log in or register to report this question.

237.

During dynamic memory allocation in CPP, new operator returns _________ value if memory allocation is unsuccessful.

Answer: B

Correct answer: NULL

When new cannot obtain the memory it returns a null pointer in the traditional form, and in standard C++ throws std::bad_alloc unless the nothrow form is used. Testing the returned pointer is what the traditional form requires.

Please log in or register to report this question.

Answer: A

Correct answer: a page is a fixed-size physical division while a segment is a variable-size logical one

A page is a fixed-size division imposed by the system with no regard to program structure; a segment is a variable-size division corresponding to a logical unit of the program - code, data, stack, a procedure, an array. Everything else follows from that. Paging is invisible to the programmer, since the division is arbitrary; segmentation reflects the programmer’s own view. Paging suffers internal fragmentation and none external; segmentation suffers external and none internal. A paged address is one number split into page and offset; a segmented address is genuinely two-dimensional, a segment number and an offset. Segmentation makes protection and sharing natural, since a whole segment can be marked read-only and a shared library is one segment mapped into several processes. Paging can share too - the fourth option is wrong - but a page has no logical meaning, so the unit is arbitrary. Many real architectures combine both, dividing a program into segments and then paging each segment.

Please log in or register to report this question.

Answer: A

Correct answer: increasing the number of frames can increase the number of page faults in FIFO

Belady’s anomaly is the counter-intuitive result that giving a process more memory frames can produce more page faults under the FIFO replacement algorithm. It was demonstrated by László Bélády in 1969. The intuition it violates is that more memory should never hurt. FIFO breaks it because it evicts by age of loading rather than by usefulness, so a larger frame set can retain a different and worse selection of pages. A standard reference string demonstrating it is 1 2 3 4 1 2 5 1 2 3 4 5, which faults nine times with three frames and ten with four. Algorithms immune to it are the stack algorithms, whose defining property is that the set of pages held with \( n \) frames is always a subset of that held with \( n+1 \). LRU and the optimal algorithm both satisfy this and cannot show the anomaly. It is one reason FIFO, though simple, is rarely used unmodified.

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