作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2010, Vol. 36 ›› Issue (2): 75-77. doi: 10.3969/j.issn.1000-3428.2010.02.027

• 软件技术与数据库 • 上一篇    下一篇

多线程应用中的定时器管理算法

姚崇华,姜新红,程凌宇,程永裕   

  1. (上海贝尔阿尔卡特股份有限公司,上海 200070)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2010-01-20 发布日期:2010-01-20

Timer Management Algorithm in Multi-thread Application

YAO Chong-hua, JIANG Xin-hong, CHENG Ling-yu, CHENG Yong-yu   

  1. (Alcatel Shanghai Bell, Ltd. Co., Shanghai 200070)
  • Received:1900-01-01 Revised:1900-01-01 Online:2010-01-20 Published:2010-01-20

摘要: 针对高性能电信系统中软定时器效率低下的问题,提出一系列优化方案,采用二次散列的时间轮,并结合免锁算法的低粒度互斥锁,从理论上把定时器查询和定时器插入等常用操作的复杂度从O(n)降至最优情况的O(1)。通过真实高负荷进行测试,采用SunStudio11性能分析工具对优化前后的性能进行定量分析。实验结果表明,该优化方案能够有效提高系统效率。

关键词: 时间轮, 二次散列, 粒度, 免锁算法

Abstract: Aiming at the problem of low performance issue of soft timer manager which is commonly used in high performance telecom system, a series of optimized algorithm and solution are proposed including double hash time wheel and mutex with small granularity which is inspired by lock-free theory. It decreases the theoretical complexity from O(n) to O(1). Through high load test, and analysis is made with SunStudio11’s performance analyzer, and the results show this optimized scheme can promote the system performance effectively.

Key words: time wheel, double hash, granularity, lock-free algorithm

中图分类号: