Http://blog.chinaunix.net/uid-14528823-id-4136760.html
Linux has a variety of stacks, it is easy to faint, simple explanation:
1, the User state stack: In the process User State address space at the bottom, with the usual we simple and understanding, is the virtual address space in a paragraph, not many say ~
2. Kernel stack:
It is independent of the user-state stack and needs to be switched when the user state and the kernel state switch.
Default 8k, can be modified by kernel configuration item
Together with the thread_info structure, a common union:thread_union,
Click ( here) to collapse or open
- Union thread_union {
- struct Thread_info thread_info;
- unsigned long stack[thread_size/sizeof(Long)];
- };
Put in a special Groud: __ (". Data.init_task")))
Click ( here) to collapse or open
- Union Thread_union Init_thread_union
- __attribute__((__section__(". Data.init_task" )) =
- {init_thread_info(init_task) };
Click ( here) to collapse or open
- ENTRY(Stack_start)
- . Long Init_thread_union+thread_size
- . Long __boot_ds
Default with interrupt stack sharing, can be modified by kernel configuration item
belong to the process, that is, each process has its own kernel stack
3. Interrupt stack:
Shared with kernel stacks by default
Independent of the content in the kernel stack, not visible to each other
Interrupt, exception, soft interrupt use this stack
Use the kernel stack of the interrupted process
Stacks in Linux: User state stack/kernel stack/interrupt stack