共享存储系统编程课件.ppt

  1. 1、本文档共50页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
线程调用—线程管理 POSIX Solaris 2 pthread_create thr_create pthread_exit thr_exit pthread_kill thr_kill pthread_join thr_join pthread_self thr_self 线程调用—线程同步和互斥 POSIX Solaris 2 pthread_mutex_init mutex_init pthread_ mutex_destroy mutex_destroy pthread_ mutex_lock mutex_lock pthread_ mutex_trylock mutex_trylock pthread_ mutex_unlock mutex_unlock pthread_cond_init pthread_cond_destroy pthread_cond_wait pthread_cond_timedwait pthread_cond_signal pthread_cond_broadcast Pthreads实现计算?的实例 1 Pthreads实现计算?的实例 2 对生产者驱动的有界缓冲区问题的Pthread条件变量解 void *producer(void *arg1){ int i; for (i=1;i=SUMSIZE;i++){ pthread_mutex_lock(slot_lock); while(nslots=0) pthread_cond_wait(slots,slot_lock); nslots--; pthread_mutex_unlock(slot_lock); put_item(i*i); pthread_mutex_lock(item_lock); nitems++; pthread_cond_signal(items); pthread_mutex_unlock(item_lock); } pthread_mutex_lock(item_lock); producer_done=1; pthread_cond_broadcast(items); pthread_mutex_unlock(item_lock); return NULL;} void *consumer(void *arg2){ int i,myitem; for (;;){ pthread_mutex_lock(item_lock); while ((nitems=0)!producer_done) pthread_cond_wait(items,item_lock); if ((nitems=0)producer_done){ ptherad_mutex_unlock(item_lock); break; } nitems--; pthread_mutex_unlock(item_lock); get_item(myitem); sum+=myitem; pthread_mutex_lock(slot_lock nslots++; cond_signal(slots); pthread_mutex_unlock(slot_lock); } return NULL; } 共享存储系统编程 13.1 ANSI X3H5共享存储模型 13.2 POSIX 线程模型 13.3 OpenMP模型 The History of OpenMP What is directive/pragma? Directive-based general purpose parallel programming API with emphasis on the ability to parallelize existing serial programs Why a new standard? Who’s Involved? Parallelism model and basic directives Fortran77, Fortran90 C, C++ OpenMP标准 The History of OpenMP A key intermediate step was X3H5 in the late 80

文档评论(0)

liuxiaoyu99 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档