操作系统英文教学课件:Chapter 4 Threads_第1页
操作系统英文教学课件:Chapter 4 Threads_第2页
操作系统英文教学课件:Chapter 4 Threads_第3页
操作系统英文教学课件:Chapter 4 Threads_第4页
操作系统英文教学课件:Chapter 4 Threads_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、4.2Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 2005nOverviewnMultithreading ModelsnThreading IssuesnPthreads4.3Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 2005nA thread is a basic unit of CPU utilization;lit comprises a thre

2、ad ID, a program counter, a register set,and a stack.lIt shares with other threads belonging to the same process: the code section, the data section, and other OS resources,such as open files, signals, etcnA traditional process has a single thread of control: lheavyweight process.4.4Silberschatz, Ga

3、lvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 20054.5Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 2005nOn modern desktop PC, many APPs are multithreaded.la seperate process with several threadslExample 1: A web browser4one for displaying image

4、s or text;4another for retrieving data from networklExample 2: A word processor4one for displaying graphics;4another for responding to keystrokes from the user;4and a third for performing spelling & grammer checking in the background4.6Silberschatz, Galvin and Gagne 2005Operating System Concepts

5、 7th edition, Jan 23, 2005nIn certain situations, a single application may be required to perform several similar tasks. Example: a web servernAllow a server to service several concurrent requests. Example: an RPC servernThe OS itself needs to perform some specific tasks in kernel, such as managing

6、devices or interrupt handling.lPARTICULAR, many OS systems are now multithreaded.lExample: Solaris, Linux4.7Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 2005nResponsivenesslExample: an interactive application such as web browser. while one thread loading an image

7、, another thread allowing user interactionnResource Sharinglmemory, and other resourcesnEconomy (e.g. save memory) lSolaris:creating a process is about 30 times slower then creating a thread;context switching is about 5 times slowernUtilization of MP Architectureslparallelism and concurrency 4.8Silb

8、erschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 2005nTwo methods to support threadslUser threads VS. Kernel threadsnUser ThreadslThread management done by user-level threads library without kernel supportnKernel threadslSupported by the Kernel, usually may be slower the

9、n user threadlExamples4Windows XP/20004Solaris4Linux4Tru64 UNIX4Mac OS X4.9Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 2005nThe relationship between user threads and kernel threadslMany-to-OnelOne-to-OnelMany-to-Many4.10Silberschatz, Galvin and Gagne 2005Operati

10、ng System Concepts 7th edition, Jan 23, 2005nMany user-level threads mapped to single kernel threadnExamples:lSolaris Green ThreadslGNU Portable Threads4.11Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 20054.12Silberschatz, Galvin and Gagne 2005Operating System Co

11、ncepts 7th edition, Jan 23, 2005nEach user-level thread maps to kernel threadnExampleslWindows NT/XP/2000lLinuxlSolaris 9 and later4.13Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 20054.14Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, J

12、an 23, 2005nAllows many user level threads to be mapped to many kernel threadsnAllows the operating system to create a sufficient number of kernel threadsnSolaris prior to version 9nWindows NT/2000 with the ThreadFiber package4.15Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th editi

13、on, Jan 23, 20054.16Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 2005nSimilar to M:M, except that it allows a user thread to be bound to kernel threadnExampleslIRIXlHP-UXlTru64 UNIXlSolaris 8 and earlier4.17Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 20054.18Silberschatz, Galvin and Gagne 2005Operating System Concepts 7th edition, Jan 23, 2005nA thread library provides an API for creating and managing threads.nTwo primary ways

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论