东南大学:《操作系统概念 Operating System Concepts》课程教学资源(PPT课件讲稿)04 线程 Threads

●●● ●●●● 4. Threads ●●●●● ●●●● ●●●0● ●●●0 Objectives To introduce the notion of a thread -a fundamental unit of cpu utilization that forms the basis of multi-threaded computer systems o To discuss the apis for the pthreads Win 32 and Java thread libraries o To examine issues related to multi- threaded programming
2 4. Threads ⚫ Objectives ⚫ To introduce the notion of a thread — a fundamental unit of CPU utilization that forms the basis of multi-threaded computer systems ⚫ To discuss the APIs for the Pthreads, Win32, and Java thread libraries ⚫ To examine issues related to multithreaded programming

●●● ●●●● 4. Threads ●●●●● ●●●● ●●●0● ●●●0 ●41 Overview o 4.2 Multi-threading Models ●4.3 Thread libraries 4.4 Threading Issues 0 4.5 Operating System Examples
3 4. Threads ⚫ 4.1 Overview ⚫ 4.2 Multi-threading Models ⚫ 4.3 Thread Libraries ⚫ 4.4 Threading Issues ⚫ 4.5 Operating System Examples

●●● ●●●● 4.1 Overview ●●●●● ●●●● ●●●0● ●●●0 ● a thread is a basic unit of cpu utilization°。 It comprises ● A thread|D ● A program counter A register set e A stack o It shares with other threads belonging to the same process Code section o Data section Other Os resources, such as open files and sIgnals
4 4.1 Overview ⚫ A thread is a basic unit of CPU utilization ⚫ It comprises ⚫ A thread ID ⚫ A program counter ⚫ A register set ⚫ A stack ⚫ It shares with other threads belonging to the same process ⚫ Code section ⚫ Data section ⚫ Other OS resources, such as open files and signals

●●● ●●●● 4.1 Overview ●●●●● ●●● ●●●0● ●●0 o A traditional (or heavyweight)process has a single thread of o control a lightweight process has multiple threads of control, it can perform more than one task at a time code data data files registers stack registers‖ registers‖ registers stack ck stack ← thread single-threaded multithreaded
5 4.1 Overview ⚫ A traditional (or heavyweight) process has a single thread of control ⚫ A lightweight process has multiple threads of control, it can perform more than one task at a time

●●● ●●●● 4.1 Overview ●●●●● ●●●● ●●●0● ●●●0 ● Motivation EXamples of multi-threaded program o web browser o word processor o database server web server
6 4.1 Overview ⚫ Motivation ⚫ Examples of multi-threaded program: ⚫ web browser ⚫ word processor ⚫ database server ⚫ web server

●●● ●●●● 4.1 Overview ●●●●● ●●● ●●●0● ●●●0 ● Benefits Responsiveness o Interactive application may continue running when part of it is blocked or is performing a lengthy operation ° Resource sharing o threads share the memory and the resource of process to which they belong To allow an application to have several different threads of activity within the same address space Economy e creation 30: 1, context switching 5: 1 o Utilization of multiprocessor architectures
7 4.1 Overview ⚫ Benefits ⚫ Responsiveness ⚫ Interactive application may continue running when part of it is blocked or is performing a lengthy operation ⚫ Resource sharing ⚫ Threads share the memory and the resource of process to which they belong ⚫ To allow an application to have several different threads of activity within the same address space ⚫ Economy ⚫ creation 30:1, context switching 5:1 ⚫ Utilization of multiprocessor architectures

●●● ●●●● 4. Threads ●●●●● ●●●● ●●●0● ●●●0 ●41 Overview e 4.2 Multithreading Models ●4.3 Thread libraries 4.4 Threading Issues 0 4.5 Operating System Examples
8 4. Threads ⚫ 4.1 Overview ⚫ 4.2 Multithreading Models ⚫ 4.3 Thread Libraries ⚫ 4.4 Threading Issues ⚫ 4.5 Operating System Examples

●●● ●●●● 4.2 Multithreading Models :99 ●●●0 User threads vs, Kernel threads ● User threads o Provided by a thread library at the user level e PosiX Pthreads. Mach c-threads, solaris ul-threads Kernel Threads Provided and managed by the os directly Linux Solaris2 Windows. BeOS Relationship between kernel threads and user threads Many-to-one model One-to-one model ●Many- to-many model
9 4.2 Multithreading Models ⚫ User Threads vs. Kernel Threads ⚫ User Threads ⚫ Provided by a thread library at the user level ⚫ POSIX Pthreads, Mach C-threads, Solaris UI-threads ⚫ Kernel Threads ⚫ Provided and managed by the OS directly ⚫ Linux, Solaris2, Windows, BeOS ⚫ Relationship between kernel threads and user threads ⚫ Many-to-one model ⚫ One-to-one model ⚫ Many-to-many model

●●● ●●●● 4.2 Multithreading Models :99 ●●●0 ● Many-to- one model Many user-level threads mapped to single kernel thread ser thread k刀+ kernel thread
10 4.2 Multithreading Models ⚫ Many-to-one model ⚫ Many user-level threads mapped to single kernel thread

●●● ●●●● 4.2 Multithreading Models : ●●●0 ● Threads management is done by the thread°° library in user space so it is efficient(no often to invoke system call) o The entire process will block if a thread makes blocking system call o Only one thread can access the kernel at a time, multiple threads are unable to run in parallel on multiprocessors ● Example: o Green threads for solaris2 o GNU Portable Threads
11 4.2 Multithreading Models ⚫ Threads management is done by the thread library in user space, so it is efficient (no often to invoke system call) ⚫ The entire process will block if a thread makes blocking system call ⚫ Only one thread can access the kernel at a time, multiple threads are unable to run in parallel on multiprocessors ⚫ Example: ⚫ Green threads for Solaris2. ⚫ GNU Portable Threads
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《数字图像处理学》课程教学资源(PPT课件讲稿)第9章 数学形态学及其应用.ppt
- 南京航空航天大学:《数据结构》课程教学资源(PPT课件讲稿)第一章 绪论.ppt
- 《大学计算机》实践教程(PPT讲稿)面向计算思维能力培养(Raptor程序设计).pptx
- 机械工业出版社:国家“十一五”规划教材《数据库原理与应用教程》教学资源(PPT课件,第3版)第8章 数据库设计.ppt
- 安徽理工大学:《汇编语言》课程教学资源(PPT课件讲稿)第三章 80x86指令系统和寻址方式.ppt
- 广西医科大学:《计算机网络 Computer Networking》课程教学资源(PPT课件讲稿)CHAPTER 9 COMMUNICATIONS CIRCUITS.pptx
- 《电子商务实用教程》课程教学资源(PPT课件讲稿)第五章 物流配送.ppt
- 东南大学:《数据结构》课程教学资源(PPT课件讲稿)分治算法.pptx
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)第4章 存储层次结构设计.ppt
- 《数据结构》课程教学资源(PPT课件讲稿)第3章 栈和队列.ppt
- 南京大学:《面向对象技术 OOT》课程教学资源(PPT课件讲稿)引言、背景概述.ppt
- 《计算机视觉》课程教学资源(PPT课件讲稿)第十二章 目标识别 Object Recognition.ppt
- 华东师范大学:《程序设计》课程教学资源(PPT课件讲稿)第九讲 类与对象(面向对象基础).pptx
- 《C程序设计》课程电子教案(PPT课件)第四章 数组和结构.ppt
- 山东大学:《人机交互技术》课程教学资源(PPT课件讲稿)第4章 人机交互技术.ppt
- 基于分布式哈希表的对等系统关键技术研究(论文PPT).ppt
- 西安交通大学:《微型计算机硬件技术》课程教学资源(PPT课件讲稿)第三章 总线线驱动与接口(主讲:桂小林).ppt
- 电子科技大学:《信息安全概论》课程教学资源(PPT课件讲稿)第一章 概述(秦志光).ppt
- 《计算机网络》课程教学资源(PPT课件讲稿)第7章 广域网.ppt
- 《电子技术》课程教学资源(PPT讲稿资料)玩转Arduino合集.ppt
- 《计算机视觉》课程教学资源(PPT课件)第八章 基于运动视觉的稠密估计——光流法(Optical Flow).ppt
- 中国科学技术大学:《算法基础》课程教学资源(PPT课件讲稿)第八讲 串匹配算法(主讲:顾乃杰).ppt
- 中国科学技术大学:《信号与图像处理基础 Signal and Image Processing》课程教学资源(PPT课件讲稿)图像成像机理与模型.pptx
- 数据包检测技术(PPT讲稿)High-Performance Pattern Matching for Intrusion Detection.ppt
- 《计算机操作系统》课程教学资源(PPT课件讲稿)第8章 计算机系统的测试.ppt
- 西北农林科技大学:高性能计算之并行编程技术(讲座PPT,报告人:周兆永).ppt
- 山东大学:《微机原理及单片机接口技术》课程教学资源(PPT课件讲稿)第四章 指令系统及汇编语言程序设计(4.1-4.6).ppt
- 电子工业出版社:《计算机网络》课程教学资源(第六版,PPT课件讲稿)第三章 数据链路层.pptx
- 北京大学:《软件需求工程》课程教学资源(PPT课件讲稿)第三章 软件需求获取(主讲:周立新).ppt
- 《管理信息系统》课程教学资源(PPT课件讲稿)第16章 新型数据库技术及发展.ppt
- 西安交通大学:《网络与信息安全》课程PPT教学课件(网络入侵与防范)第一章 网络安全概述(主讲:沈超、刘烃).ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)第4章 存储层次结构设计.ppt
- 河南中医药大学:《数据库原理》课程教学资源(PPT课件讲稿)第一章 绪论.ppt
- 东南大学:《操作系统概念 Operating System Concepts》课程教学资源(PPT课件讲稿)06 Process synchronization.ppt
- 上海交通大学:《Multicore Architecture and Parallel Computing》课程教学资源(PPT课件讲稿)Lecture 8 CUDA, cont’d.ppt
- 赣南师范大学:《计算机网络原理》课程教学资源(PPT课件讲稿)第四章 数据链路层.ppt
- 南京大学:移动Agent系统支撑(PPT讲稿)Agent Mobility Software Agent(主讲:余萍).pptx
- 上海师范大学:《R语言与统计分析》课程教学资源(PPT课件)R语言——介绍(主讲:汤银才).ppt
- 《视频制作》课程教学资源:课程教学大纲.doc
- 新乡学院:《办公自动化》课程教学资源(教学大纲).pdf