Threads, SMP, and MicroKernels

Threads. SMP and microkernels Processes and threads The two characteristics of a process unit of resource ownership virtual address space for the process image I/O channels. devices files unit of dispatching/scheduling/execution This is the execution path through one or more modules It is also the entity that is being scheduled and dispatched by the os a process may have many dispatching units. a unit of dispatching is commonly called a thread or lightweight process New notion of process: unit of resource ownershI
1 Threads, SMP, and MicroKernels • Processes and threads – The two characteristics of a process • unit of resource ownership – virtual address space for the process image – I/O channels, devices, files • unit of dispatching/scheduling/execution – This is the execution path through one or more modules. – It is also the entity that is being scheduled and dispatched by the OS. – A process may have many dispatching units. A unit of dispatching is commonly called a thread or lightweight process. – New notion of Process : unit of resource ownership

Threads Single process, single thread DOS Multiple processes, single thread per process UNIX One process, multiple threads Java run-time(actually not an Os) Multiple processes multiple threads per process Solaris. Windows 2000/XP Windows XP. mach. oS/2. Linux Multithreading a process unit of protection and unit of resource allocation )virtual address space, process image >)protected access to processors, interprocess communication (IPC), files. lo resources 2
2 Threads – Single process, single thread • DOS – Multiple processes, single thread per process • UNIX – One process, multiple threads • Java run-time (actually not an OS) – Multiple processes, multiple threads per process • Solaris, Windows 2000/XP, Windows XP, Mach, OS/2, Linux – Multithreading • a process – unit of protection and unit of resource allocation » virtual address space, process image » protected access to processors, interprocess communication (IPC), files, I/O resources

one process one thread multiple thread multiple processes multiple processes thread ocess multiple threads per process instruction trace Figure 4.1 Threads and Processes [andE971
3

Single-Threaded Multithreaded Process model Process model Thread Thread Thread Thread Thread Thread Pr User ocess Control Control Control Stack Block block Block Block Process User User sel sel Kernel Control: Stack Stack I Stack Address Stack Block S ace User Kernel Kernel i Kernel Address Stack Stack! Stack Space Figure 4.2 Single threaded and Multithreaded Process mode
4

Threads(cont Multithreading(cont Each thread has a thread execution state(running, ready, etc. a separate control block, with priority, some thread related state information, and saved processor context when not running (with program counter an execution stack some per-thread static storage for local variables access to the memory and resources of its process, shared with all other threads in the process A single application logically doing several functions especially in GUI systems Example application-a file server entertaining requests to create, open, read and write on files >>One thread per request Two threads cannot write on the same file at the same time
5 Threads (cont.) – Multithreading (cont.) • Each thread has – a thread execution state (running, ready, etc.) – a separate control block, with priority, some thread related state information, and saved processor context when not running (with program counter) – an execution stack – some per-thread static storage for local variables – access to the memory and resources of its process, shared with all other threads in the process, • A single application logically doing several functions, especially in GUI systems. – Example application -- a file server entertaining requests to create, open, read, and write on files. »One thread per request »Two threads cannot write on the same file at the same time

Benefits of threads less time to create(10 times )and terminate than doing the same thing to a process less time to switch between two threads within the same process parallel processing -multiple threads executing simultaneously on different processors communication between different executing modules within the same process In most Os, communication between independent processes requires the intervention of the kernel to provide protection and the mechanism needed for communication Because threads within the same task share memory and files, they can communicate with each other without invoking the kernel
6 Benefits of threads • less time to create (10 times) and terminate than doing the same thing to a process • less time to switch between two threads within the same process • parallel processing -- multiple threads executing simultaneously on different processors. • communication between different executing modules within the same process – In most OS, communication between independent processes requires the intervention of the kernel to provide protection and the mechanism needed for communication. – Because threads within the same task share memory and files, they can communicate with each other without invoking the kernel

RPC RPC Request Process 1 v Server (a) RPC Using Single Thread RPC Thread A (Process 1) Thread B(Process l Server (b)RPC Using One Thread per Server(on a uniprocessor) MZZ Blocked, waiting for response to RPC Blocked, waiting for processor, which is in use by Thread B Figure 4.3 Remote Procedure Call (RPC) Using Threads
7

Request Time quantum request complete expires Thread A(Process 1) Thread b (process 1) Thread C(Process 2) Time quantum exDI Process created 区× Blocked Ready Running Figure 4.4 Multithreading Example on a Uniprocessor
8

Screen-redrawthread Figure 4.5 Thread structure for adobe page maker
9

Example applications using threads Threads in a spreadsheet program One thread displays menus and read user input (foreground work) Another thread executes user commands and updates the spreadsheet (background work Adobe PageMaker Writing, design, and production tool for desktop publishing service thread event-handling thread screen-drawing thread When the event-handling thread(e.g, doing a large computation, etc. or the screen-drawing thread is busy, the service thread(e.g,, printing file importing, etc restricts user activity by disabling menu items and displaying a busy "cursor. The user is free to switch to other applications, or even kill the computation through the service thread
10 Example applications using threads • Threads in a spreadsheet program – One thread displays menus and read user input (foreground work). – Another thread executes user commands and updates the spreadsheet (background work). • Adobe PageMaker – Writing, design, and production tool for desktop publishing – service thread – event-handling thread – screen-drawing thread – When the event-handling thread (e.g., doing a large computation, etc.) or the screen-drawing thread is busy, the service thread (e.g., printing, file importing, etc.) restricts user activity by disabling menu items and displaying a “busy” cursor. The user is free to switch to other applications, or even kill the computation through the service thread
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- Object-Oriented Programming(Java).ppt
- 《编译原理》课程教学资源(PPT课件讲稿)第三章 语法分析.ppt
- 《操作系统》课程教学资源(PPT课件)第六章 设备管理 Devices Management.ppt
- 《计算机组装维修及实训教程》课程教学资源(PPT课件)第2章 中央处理器.ppt
- 《轻松学习C语言》教学资源(PPT课件讲稿,繁体版,共十二章).pptx
- 西安电子科技大学:《Mobile Programming》课程PPT教学课件(Android Programming)Lecture 7 数据持久化 Data Persistence.pptx
- 《数据结构》课程教学资源(PPT课件讲稿)第四章 串.ppt
- 四川大学:《数据库技术》课程教学资源(PPT课件讲稿)第1章 数据库技术概论.ppt
- Urandaline Investments The Perils of Down Under:Chinese Investment in Australia.pptx
- 《计算机网络》课程教学资源(PPT课件讲稿)第六章 IP路由.ppt
- 《微型计算机原理及应用》课程教学资源(PPT课件讲稿)第2章 微处理器.ppt
- Landmark-Based Speech Recognition.ppt
- 中国科学技术大学:《现代密码学理论与实践》课程教学资源(PPT课件讲稿)第9章 公钥密码学与RSA.pptx
- 中国科学技术大学:《数据结构及其算法》课程电子教案(PPT课件讲稿)第六章 二叉树和树.pps
- 计算机外设及电源故障处理(PPT课件讲稿).ppt
- 《计算机系统结构》课程教学资源(PPT课件讲稿)第三章 流水线技术.ppt
- 四川大学:《Java面向对象编程》课程PPT教学课件(Object-Oriented Programming - Java)Unit 1.2 Designing Classes.ppt
- 软件开发环境与工具的选用(PPT课件讲稿)Select software development tool.ppt
- 电子科技大学:《微机原理与接口技术》课程教学资源(PPT实验讲稿,习友宝).ppt
- 北京师范大学:《多媒体技术与网页制作》课程教学资源(PPT课件)数字音频技术.ppt
- 对等网络 Peer-to-Peer Networks(P2P).ppt
- 香港浸会大学:《网络管理 Network Management》课程教学资源(PPT课件讲稿)Chapter 02 Network Management Model.ppt
- 中国科学技术大学:《高级操作系统 Advanced Operating System》课程教学资源(PPT课件讲稿)第四章 分布式进程和处理机管理(主讲:熊焰).ppt
- 兰州大学:《SOA & Web Service》教学资源(PPT课件讲稿)Lecture 5 Web Service Program(苏伟).ppt
- 哈尔滨工业大学:开放式中文实体关系抽取研究(导师:秦兵).pptx
- 《计算机控制技术》课程教学资源(PPT课件讲稿)第二章 模拟量输出通道.ppt
- 中国科学技术大学:《并行算法实践》课程教学资源(PPT课件讲稿)上篇 并行程序设计导论 单元I 并行程序设计基础 第三章 并行程序设计简介.ppt
- 《多媒体技术基础》课程教学资源(PPT课件讲稿)单元1 多媒体概述.ppt
- 广西医科大学:《计算机网络 Computer Networking》课程教学资源(PPT课件讲稿)Chapter 18 NETWORK DESIGN AND IMPLEMENTATION.pptx
- 《计算机网络》课程实验教学大纲.pdf
- 东南大学:《C++语言程序设计》课程教学资源(PPT课件讲稿)Chapter 11 Operator Overloading; String and Array Objects(主讲:东方).ppt
- 《大学计算机基础》课程教学资源(PPT课件讲稿)第四章 Excel 2007电子表格.ppt
- 进程(PPT课件讲稿)Processes.pptx
- 电子科技大学:《汇编语言程序设计》课程教学资源(PPT课件)第一章 基础知识(主讲:詹瑾瑜).ppt
- 《数据库系统概论》课程教学资源(PPT课件讲稿)第六章 数据库设计.ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)MSI、MESI、分布式共享存储器体系结构、Models of Memory Consistency.pptx
- 《汇编语言》课程教学资源(PPT课件讲稿)第6章 子程序.ppt
- 中国科学技术大学:《网络信息安全 NETWORK SECURITY》课程教学资源(PPT课件讲稿)第二章 数据加密技术基础.ppt
- 北京大学:《软件需求工程》课程教学资源(PPT课件讲稿)第十章 软件需求开发与管理工具.ppt
- 《计算机组装与维修》课程教学资源(PPT课件讲稿)第十三章 局域网维护及常见故障处理.ppt