Where in memory (technically, where in the VAS of the given process) does the thread stack actually reside? The following points help us in this regard:
- The stack of the main thread is always situated at the very top of the process VAS.
- The stacks of all other threads in the process are located somewhere between the process heap segment and the stack of main; the precise location is not known in advance to the app developer; in any case, we should not need to know.
- This is not directly related, but important: recall from Chapter 2, Virtual Memory, that, for most processors, the stack(s) conform to the stack-grows-down semantic; that is, the direction of growth of the stack segment is toward lower virtual addresses.
Though ...