Typical virtual memory layout, Operating System

Using pages makes it easier to manage the whole memory, avoiding excessive fragmentation and waste. As an analogy, think of Tetris, but with only square blocks: it is relatively easy to avoid fragmentation in this case. Both the virtual and the physical memory are divided into pages. As an aside, we often refer to physical memory pages as frames. Every virtual page consists of a range of virtual addresses. Virtual pages are then mapped to physical pages in the physical memory. When an application needs to access a virtual page, the corresponding virtual address is translated into a "real" physical address, and then the actual data might be read and/or written. As a consequence, note that although arrays are contiguous in virtual memory, they may be non-contiguous in physical memory. Note also that some virtual pages do not map to any actual physical memory address, because not all virtual pages are necessarily being used at any given time. The unused virtual pages are called invalid. If a program ever tries to access an invalid page, it pagefaults.

A typical virtual memory layout includes a stack, a mmap region, a heap, and the code of the program (the "text" section). Since mmap and heap grow towards each other, in the worst case they could smash into each other. The same could happen with the stack: if a program recurses for a large number of times, the stack could grow over the mmap region ("stack over?ow") and in this case something bad and usually unpredictable will happen.

Posted Date: 3/12/2013 5:35:28 AM | Location : United States







Related Discussions:- Typical virtual memory layout, Assignment Help, Ask Question on Typical virtual memory layout, Get Answer, Expert's Help, Typical virtual memory layout Discussions

Write discussion on Typical virtual memory layout
Your posts are moderated
Related Questions
Allocators can also be used to avoid problems with unsafe languages. C and C++ are pervasive, with huge amounts of existing code. They are also memory-unsafe languages, in that the

What is the main function of the memory-management unit? The runtime mapping from virtual to physical addresses is done by a hardware device known as a memory management unit (

Garbage collectors trade space for time. If we collect all the time (which requires a lot of processing time), the GC allocator will use the least memory possible. On the other han

Explain DosCreateThread Functions Used in the OS/2  DosCreateThread(&threadID,MyThreadFunction,arg,flags,stackSize) DosCreateThread creates a thread within the context of th

what is a batch system give me answer in simple words so that i can understand

when demand is 24000 units/year, production rate is 48000 units/year, setup cost is rs 200 per setup, carring cost is rs 20 per units/year, and economic batch quantity is 692.8203

Q. Explain about Deadlocks? Deadlocks for (int i = 0; i // first find a thread that can finish for (int j = 0; j if (!finish[j]) { boolean temp = true; for

KERNEL-LEVEL THREADS (KLT) In this level every thread management is done by kernel .No thread library except an API system calls to the kernel thread facility exists. The kern

Two Level Directory This kind of structure overcomes the problems of assigning unique names to the files. Thus there need not be any confusion among users. In this kind of s

Define ‘LRU’ page replacement policy LRU is Least Recently Used page replacement policy.