首页 > 其他 > 详细

Thread in depth 1: The basic

时间:2017-04-18 00:34:17      阅读:268      评论:0      收藏:0      [点我收藏+]

Every single thread has the follow elements:

  1. 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.
  2. Thread Environment Block,which is related to exception.
  3. 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.
  4. 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

原文:http://www.cnblogs.com/lwhkdash/p/6725789.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!