【精品】线程的定义(introduction)

【精品】线程的定义(introduction)

ID:26020846

大小:183.50 KB

页数:22页

时间:2018-11-24

【精品】线程的定义(introduction)_第1页
【精品】线程的定义(introduction)_第2页
【精品】线程的定义(introduction)_第3页
【精品】线程的定义(introduction)_第4页
【精品】线程的定义(introduction)_第5页
资源描述:

《【精品】线程的定义(introduction)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、海量管理资源免费下载!1概述1.1线程的定义(Introduction)Threadscanbestbedescribedas“lightweightprocesses”.ThetraditionalUNIX-stylenotionofaprocesshasbeenfoundtobeinconvenient,ifnotinadequateforseveralapplicationsindistributedsystemsdevelopment.Theneedsoftheseapplicationsarebestservedb

2、ythreads,whichgeneralizethenotionofaprocesssothatitcanbeassociatedwithmultipleactivities.ThepopularityofthreadshasresultedintheirimplementationonUNIXsystemsandthreadlibrariesarenowwidelyavailabletoprogrammersforthedevelopmentofconcurrentapplications.1.2ThreadsImple

3、mentationThreadscanbeimplementedinoneoftwoways:1.User-levelthreads:Thereisnokernelsupportformulti-threadedprocesses.Hence,thekernelonlyhasasingle-threadedprocessabstraction,butmulti-threadedprocessesareimplementedinalibraryofprocedureslinkedwithapplicationprograms.

4、Thekernelhasnoknowledgeoflightweightprocesses(threads),andthereforecannotschedulethemindependently.Athreadsrun-timelibraryorganizestheschedulingofthreads.Athreadwouldblocktheprocessandthereforeallthreadswithinitifitmadeablockingsystemcall,sotheasynchronousI/Ofacili

5、tiesofUNIXareused.Themajordisadvantageofthisschemeisthatthreadswithinaprocesscannottakeadvantageofamulti-processor.(上段译文)User-level没有核心支持的多线程的进程。因此,核心只有单线程进程概念,而多线程进程由与应用程序连接的过程库实现。核心不知道线程的存在,也就不能独立的调度这些线程了。一个线程运行库组织线程的调度。如果一个线程调用了一个阻塞的系统调用,进程可能被阻塞,当然其中的所有线程也同时被阻塞,

6、所以UNIX使用了异步I/O工具。这种机制的的最大缺点是不能发挥多处理器的优势。Theadvantagesinclude:l(系统消耗小)Certainthreadoperationsaresignificantlylesscostly.Forexample,switchingbetweenthreadsbelongingtothesameprocessdonotnecessarilyinvolveasystemcall,andhencesavethisover-head.l(可以修改以适应特殊的应用)User-levelt

7、hreadimplementationscanbecustomizedorchangedtosuittheparticularapplicationrequirements.Thisisparticularlyusefulforreal-timemultimediaprocessingetc.Also,itispossible管理资源吧·管理人自己的下载网站海量管理资源免费下载!tosupportmanymoreuser-levelthreadsthancanbydefaultbyakernel.2.Kernel-level

8、threads:Thisimplementationallowsthreadswithindifferentprocessestobescheduledaccordingtoasingleschemeofrelativeprioritizing.Thisissuitedforexploit

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。