中国料学火计算机科学与波术系 niversity of Science and Technolo ogy of China DEAT三 NT OF C口 MPUTER SCIENGE AND TECHNOLOr 线程共享相同的内存空间。 与标准 fork(相比,线程带来的开销很小。内核无需单独复制进程的内 存空间或文件描述符等等。这就节省了大量的CPU时间 和进程一样,线程将利用多CPU。如果软件是针对多处理器系统设计的, 计算密集型应用 支持内存共享无需使用繁琐的IPC和其它复杂的通信机制。 ■ Linux clone不可移植, Pthread可移植。 ■P○SIX线程标准不记录任何“家族”信息。无父无子。如果要等待一个 线程终止,就必须将线程的td传递给 pthread_ join(。线程库无法为 您断定td。 国家高性能计算中心(合肥
国家高性能计算中心(合肥) ▪ 线程共享相同的内存空间。 ▪ 与标准 fork() 相比,线程带来的开销很小。内核无需单独复制进程的内 存空间或文件描述符等等。这就节省了大量的CPU 时间。 ▪ 和进程一样,线程将利用多 CPU。如果软件是针对多处理器系统设计的, 计算密集型应用。 ▪ 支持内存共享无需使用繁琐的 IPC 和其它复杂的通信机制。 ▪ Linux __clone不可移植,Pthread可移植。 ▪ POSIX 线程标准不记录任何“家族”信息。无父无子。如果要等待一个 线程终止,就必须将线程的 tid 传递给 pthread_join()。线程库无法为 您断定 tid
R POSIX Threads: Basics and Examples by uday Kamath PD1000 Instrucion http://www.coe.unccedu/abw/parallel Resources fork O /pthreads/pthreads. html POSIX线程详解:一种支持内存共 享的简单和快捷的工具 by Daniel robbins http://www.cn.ibm.com/developerwor Before ks/linux/thread/posix thread l/index.sht Reg sters Registers PD=1000 Instruct on Instructon SOurc Next ot torco Resources Dat 国家同∏凵鼻中心`西加丿
国家高性能计算中心(合肥) POSIX Threads: Basics and Examples by Uday Kamath http://www.coe.uncc.edu/~abw/parallel /pthreads/pthreads.html POSIX 线程详解: 一种支持内存共 享的简单和快捷的工具 by Daniel Robbins http://www.cn.ibm.com/developerWor ks/linux/thread/posix_thread1/index.sht ml
Register first_ function ( Stack y Register Second function () Stack )Z Main () Identit First function Text Second function Data p
国家高性能计算中心(合肥)
中国料学火计算机科学与波术系 niversity of Science and Technolo ogy of China DEAT三 NT OF C口 MPUTER SCIENGE AND TECHNOLOr 线程调用一线程管理 POSIX Solaris 2 thread create thr create thread exit thr exi计t pthread_kill thr kill oth read join thr join pthread_self thr se仟f 国家高性能计算中心(合肥
国家高性能计算中心(合肥) 线程调用—线程管理 POSIX Solaris 2 pthread_create thr_create pthread_exit thr_exit pthread_kill thr_kill pthread_join thr_join pthread_self thr_self
中国料学火计算机科学与波术系 niversity of Science and Technolo ogy of China DEAT三 NT OF C口 MPUTER SCIENGE AND TECHNOLOr 线程调用一线程同步和互斥 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 thread cond broadcast pT 国家高性能计算中心(合肥
国家高性能计算中心(合肥) 线程调用—线程同步和互斥 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