Any time a heap manager is unable to allocate memory even though free memory exi
ID: 657644 • Letter: A
Question
Any time a heap manager is unable to allocate memory even though free memory exists this causes a problem. What is the phenomenon called? Describe what circumstances exist in terms of free and allocated memory blocks? What mechanisms are used to overcome the problem and how do they work?
Provide the code (i.e., a function that computes the factorial of a non-negative integer) using two different languages, each from one of the following (imperative functional, logic, or object-oriented) given the following specification. Give the chief (main) characteristic of that type of language that makes it a good choice for solving a type (give an example) problem.
Explanation / Answer
Whenever the heap manager is unable to allocate memory even though free memory exists,it is due to the non contiguous memory allocations made earlier while allocating memory to earlier processes. Any application wnenever needs memory it needs in contiguous blocks of addresses.And if earlier allocations are done in form of small blocks/chunks at many places, and not in a continuous manner, it will create problem when the need arises for a continuous large block. This phenomenon is called Non Contiguous Memory Allocation.
In Non contiguous memory Allocation, the allocated memory blocks occupy space at discontinuous addresses in the memory. Due to this, free memory blocks are also present at various addresses in discontinuous manner.
To overcome this problem, we should avoid the allocation of large memory spaces that may require fragmentation. When a large block of memory is requested, the heap manager allocates memory in fragments taking space from next free pages in memory. If request is for smaller allocations, they can be easily provided within continuous memory space in same page.
We can use Virtual Memory to increase the availability of contiguous and large memory. When large blocks of memory are requested, Virtual memory can extend the available memory to allocate contiguous space.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.