Virtual address range of a process

In short: is the virtual address space of a process contiguous?

I need to know something about virtual address allocated to a process by the kernel. Please correct me if I am wrong as I proceed.

On process creation, the kernel allocated virtual memory to the process and stores the starts and ends of the virtual addresses of the different segments of the process in the mm_struct in the task_struct.

Now say the a process has run out of the heap and needs to increase the heap size.calls brk().

If the virtual address range is contiguous, is the newly allocated chunk of heap provided from outside the range that was allocated originally for this process? Or is it allocated in a way that the new chunk is adjacent to the original one. What if there is no space for that (because the memory mapped segment is lying there). how is it kept track of? If the virtual address range is not contiguous, how does the vm_struct keep track of the different chunks of the address ranges for the heap (or any other segment)?

Can you please clear my concept on that?

6
задан imp25 1 May 2014 в 21:36
поделиться