中科大操作系统原理与实现课件4_Threads2.pdf
《中科大操作系统原理与实现课件4_Threads2.pdf》由会员分享,可在线阅读,更多相关《中科大操作系统原理与实现课件4_Threads2.pdf(21页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、.操作系统原理与设计第4章 Threads2(线程2)陈香兰中国科学技术大学计算机学院December 20,2009.提纲OS Examples for ThreadThread SchedulingOS Examples for Thread Scheduling小结和作业.OutlineOS Examples for ThreadThread SchedulingOS Examples for Thread Scheduling小结和作业.Windows XP Threads IIAn Windows XP application runs as a seperate process,a
2、ndeach process may contain one or more threads.IImplements the one-to-one mappingIeach user-level thread maps to an assotiated kernel threadIany thread belonging to a process can access the address spaceof the processIEach thread containsIA thread idIRegister setISeparate user and kernel stacksIPriv
3、ate data storage areaIThe register set,stacks,and private storage area are known asthe context of the threads.Windows XP Threads IIIThe primary data structures of a thread include:IETHREAD(executive thread block)IKTHREAD(kernel thread block)ITEB(thread environment block).Windows XP Threads III.Linux
4、 ThreadsILinux refers to them as tasks rather than threadsIThread creation is done through clone()system callIclone()allows a child task to share the address space ofthe parent task(process)Iclone()VS.fork().Java ThreadsIJava在语言级提供线程创建和管理支持功能IJava threads are managed by the JVM,not user-level librar
5、y orkernelIJava threads may be created by:IExtending Thread classIImplementing the Runnable interface Java.Thread States.OutlineOS Examples for ThreadThread SchedulingOS Examples for Thread Scheduling小结和作业.Thread SchedulingIuser-level thread:kernel-level thread(or LWP)ILocal Scheduling How the threa
6、ds library decides whichthread to put onto an available LWPImany-to-one,many-to-many modelsIprocess-contention scope,PCSIGlobal Scheduling How the kernel decides which kernelthread to run nextImany-to-one,many-to-many&one-to-one modelsIsystem-contention scope,SCS.Pthread Scheduling API IIPOSIX Pthre
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 中科大 操作系统 原理 实现 课件 _Threads2
限制150内