摘要
经典的哈希分级时间轮算法在管理大规模定时器时存在响应时间长、累积时延高等缺点。该文借鉴"高速缓存"思想,提出了一种时间轮改进算法(Cached And Timing Wheels,CTW),基于多线程和缓存机制,提前查找和存储即将超时的定时器。该算法能够充分利用多核CPU的性能,优化开启、查找和停止定时器的操作,提升大规模定时器的管理效率。实践表明,CTW算法在管理大规模定时器时能够缩短响应时间,消除累积时延,提高定时器精度。
Hashed and hierarchical timing wheel algorithm, which is a classical timer management algorithm, has a long response time and the high cumulative delay in the management of large - scaled timers. This article takes the thought of the "cache", searches and stores timers that will be timeout in the future, a timing wheel algorithm named CTW( Cached And Timing Wheels) is proposed based on multithreading and cache mechanism. The algorithm takes full advantage of multi - core CPU performance, optimizes the timer operations of opening, seraching and stopping, improves management efficiency of large - scale timer. Practice result shows that the CTW algorithm can reduce the response time in the management of large - scaled timers, eliminate the accumulated delay, and improve the timing accuracy.
出处
《计算机仿真》
CSCD
北大核心
2015年第12期142-145,共4页
Computer Simulation
基金
国家863项目(2012AA01A509
2012AA01A510)
国家自然科学基金(61402518)
关键词
大规模
定时器
哈希分级时间轮
多线程
缓存
Large scale
Timer
Hashed and hierarchical timing wheels algorithm
Multithreading
Cache