Thread in depth 1: The basic
2024-09-03 16:24:44
Every single thread has the follow elements:
- Execution Context:Every thread has a execution context which maintains some basical data about the running of the thread, like windows identity information, pricipal ,etc.One important thing about execution context is,when a thread create another thread (say,to do some work asynchronously), the execution context will "flow" from main thread to the sub-thread to let it run just like the main thread do.You can say that a "execution context inherit". You can stop this by calling the System.Threading.ExecutionContext.SuppressFlow() static method, that will help improve the performance.
- 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.
最新文章
- 【CSS3动画】transform对文字及图片的旋转、缩放、倾斜和移动
- python中非关键字可变长参数和关键字变量参数的区别
- AE创建一个空白的Shapefile
- Oracle Temp表空间切换
- Ceph性能优化总结(v0.94)
- SQL中Where与Having的区别
- 包含Blob字段的表无法Export/Import
- 【转】PackageInfo、ResolveInfo 笔记
- 使用Eclipse构建Maven的SpringMVC项目
- android之Widget01
- iOS 两种方法实现左右滑动出现侧边菜单栏 slide view
- android 遇到的细节 FAQ
- windows系统SVN和apache的下载和安装
- Nginx编译参数
- FFmpeg 结构体学习(二): AVStream 分析
- C#.NET 大型通用信息化系统集成快速开发平台 4.6 版本 - SSO单点登录接口
- PowerDesigner 学习:十大模型及五大分类
- 01_hello world
- web项目目录结构
- mfc 虚函数