- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话: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
您可能关注的文档
最近下载
- 无人机系统结构与设计 课件 第9、10课时 无人机的动力系统、 活塞式发动机 .pptx
- 厂房仓库消防安全培训.pptx VIP
- 20152020年兴义一中阳光书院小升初数学测试卷(8套必威体育精装版)图文.pdf VIP
- 新解读《GB_T 8026 - 2023石油蜡和石油脂滴熔点测定法》必威体育精装版解读.pptx VIP
- 《伦理学讲座课件》课件.ppt VIP
- 给水排水工程顶管技术规程CECS_246:2008.pdf VIP
- 低空智联网技术体系白皮书 2024.docx
- 内分泌性激素六项解读.pptx VIP
- 建筑水表配置和安装维护管理规范-2024标准 .pdf VIP
- 医学文献阅读如何高效阅读医学文献.pptx VIP
文档评论(0)