码迷,mamicode.com
首页 > 其他好文 > 详细

Thread in depth 1: The basic

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

标签:time   eth   exception   elements   assigned   targe   read   use   which   

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

标签:time   eth   exception   elements   assigned   targe   read   use   which   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!