- 1、本文档共126页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
04 基于共享内存分布式程序设计技术
Parallel and Distributed Systems Instructor: Zhang Weizhe (张伟哲) Computer Network and Information Security Technique Research Center , School of Computer Science and Technology, Harbin Institute of Technology Programming Shared Address Space Platforms What is a thread? A thread is an independent sequence of execution of program code inside a UNIX process A thread is often called a lightweight process – but it is NOT a process (something smaller than a process) Why Threads? Do concurrent control more efficiently Use fork() to create a process: is expensive, usually the child process need copy the whole context from the parent process. Inter-process communication is expensive and difficult. OS does more effort to switch process contexts. Creating a thread Threads use and exist within the process resources, so creating a thread is faster than creating a process. Inter-thread communication is easy, usually we can use global variable or struct to share data between threads. OS switches thread contexts easier than process contexts. Shared or Not Shared between thread and process Shared process instruction most data(A thread can have its own private data) open files signal handlers and signal dispositions current working directory user and group ID Not shared thread ID set of registers (including pc and sp) stack errno signal mask priority Programing with windows threads Microsoft Win32 threads Microsoft .Net threads Programming with pthreads Programming with OpenMP Win32 thread API CreateThread MyThreadStart CloseHandle WaitForSingleObject WaitForMultipleObjects CreateMutex ReleaseMutex InitializeCriticalSection DeleteCriticalSection EnterCriticalSection LeaveCriticalSection CreateSemaphore ReleaseSemaphore Win32* HANDLE type Each Windows object is referenced by HANDLE type variables Pointer to kernel objects Thread, process, file, event, mutex, semaphore, etc. Object creation functions return HANDLE Object controlled through its handle Don’t manipulate objects dire
您可能关注的文档
- 初一年级第一学期英语期中考试题十三.doc
- 初三英语课件Unit11 self check.ppt
- 初二英语六次课攻破语法高频考点.doc
- 初赛真题2008年(无听力).doc
- 初高中衔接典津——初稿.doc
- 北京工商大学431金融课件-风险与收益率.ppt
- 北京市海淀区2016年中考二模英语试题及答案(纯word版含官方参考答案及评分标准).doc
- 十条英语新闻(双语).doc
- 四级基础精品词汇讲义 主讲:任志远.doc
- 在Mathematica 中作图.doc
- 2025农业系统职称考试试卷含答案详解【典型题】.docx
- 2025三支一扶考试彩蛋押题含答案详解【达标题】.docx
- 2025年三支一扶复习提分资料附答案详解(满分必刷).docx
- 2025三支一扶常考点试卷【重点】附答案详解.docx
- 2025三支一扶模考模拟试题(网校专用)附答案详解.docx
- 2025三支一扶高频难、易错点题标准卷附答案详解.docx
- 2025年三支一扶综合提升测试卷含答案详解【完整版】.docx
- 2025三支一扶考前冲刺测试卷带答案详解(典型题).docx
- 2025三支一扶通关题库及答案详解(夺冠).docx
- 2025三支一扶通关考试题库附完整答案详解(名校卷).docx
文档评论(0)