The image shown above is completely out of date for both Windows and Linux. At which addresses the individual distributions do not matter. The virtual address space is large at 32 bits and huge at 64 bits. The OS just needs to cut out part of it somewhere and pass it on.
Each stack is an independent allocation of virtual memory , which can be placed in arbitrary places. It is important to note that stacks are usually finite in size . The OS reserves a certain maximum size (for example, 1 MB or 8 MB). The stack cannot exceed this size. This is offered differently in the (obsolete) image above. The stack does grow, but when the fixed space is exhausted, the stack overflows. In practice, this is not a problem. In fact, exceeding a reasonable stack size is considered a mistake.
Binary images (above: text, initialized data and bss) are also placed anywhere. They are also fixed in size.
a heap consists of several segments. It can grow arbitrarily by simply adding more segments. The heap is managed by user-mode libraries. The kernel does not know about this. The entire core is the provision of virtual memory slabs at select locations.
source share