首页 > 代码库 > Thread in depth 1: The basic
Thread in depth 1: The basic
Every single thread has the follow elements:
- Thread Kernel Object:TKO is a data structure.Everytime when a thread is created,a TKO will be assigned and initialized.TKO maintains a property of descriping the thread, and thread context.
- Thread Environment Block,which is related to exception.
- User-Mode Stack: this stack stores the local variables and arguments in the method,and the returnning address of the method,so the thread can move on from this address when returned from the method.
- Kernel-Mode Stack:a stack which managed by OS kernel function.
Thread context switch causes a bad performence.Here is how a context switch work :OS will move the data on CPU‘s register to the current thread‘s context, then move the target thread‘s context data into the cpu register so that the cpu can do its work.
Thread in depth 1: The basic
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。