摘要
针对多线程并发中的竞争和协作控制问题,介绍了Linux环境下的条件变量机制及其相关系统调用,并对其工作原理进行分析.以线程同步中的司机、售票员模型为例,指出一般信号量解决方案的不足,提出基于条件变量机制的解决方案,并给出一个具体的控制模型.
Being aimed at competition and cooperative control in the multi-threads concurrence system, condition variables mechanism and related system under Linux are introduced. Its working principle is analyzed as well. With driver, conductor model in thread synchronization as an example, the deficiency of general semaphore solution is given. A way out solution is proposed based on condition variables mechanism with detailed control model.
出处
《武汉理工大学学报(交通科学与工程版)》
2007年第3期540-543,共4页
Journal of Wuhan University of Technology(Transportation Science & Engineering)
基金
国家自然科学基金项目(批准号:40751128)
中南民族大学科研基金资助项目(批准号:YZY06008)资助
关键词
线程
同步
信号量
条件变量
thread
synchronization
semaphore
condition variables