简体   繁体   中英

Where are threads stored in memory relative to other process structures during execution on a windows x86 system

So a process is:

------DOS header/PE header

------executable code and statically linked libraries

------slack space?

------some dynamically linked libraries

------start of heap

------slack space

------top of stack

------bottom of stack

I am unsure of where the kernel mode stack and user mode stacks are relative to eachother in the virtual memory allocated for the process stack - also, when a new thread is spawned by a multithreaded process, where is the virtual memory allocated for it?

Thanks!

On x86 Windows, the kernel-mode modules are located in the (virtual) memory space from 0x80000000 , which is not accessible from a user mode process, and all the user-mode modules are located in the memory space before 0x80000000 .

When a new (user-mode) thread gets spawned, a new memory page is allocated for its stack in both the user-mode memory space (accessible from both user-mode and kernel-mode) and kernel-mode memory space (accessible only from the kernel mode). Note that there are some system threads that do not have a user mode context (thus no stack allocated in any of the user-mode processes). These threads purely run in the kernel and do not run under user-mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM