Font Size: a A A

Implementation Of Linux User-mode Timer Based On Multi-core Platform

Posted on:2015-11-16Degree:MasterType:Thesis
Country:ChinaCandidate:S X YuFull Text:PDF
GTID:2348330518991584Subject:Computer software and theory
Abstract/Summary:PDF Full Text Request
With the rapid growth of information technology,the real-time service is being associated with people's daily life closely,which also presents higher and higher requirement to the OS's real-time performance.The Linux OS is used to develop real-time system by more and more researchers and enterprises because of its advantages.And the timing subsystem is a very important factor to ensure the real-time performance in Linux.At present,the common timing solutions in Linux are the classic timer,hrtimer in the kernel mode and setitimer,posix-timer interface in the user mode which is based on the former timer.In some circumstances such as the Internet server,the scale of timer being used is often very large,and in this case the system would switch between kernel-mode and user-mode frequently,leading to performance degradation as a result of the implementing method of traditional user-mode timer.To solve this problem and keep good accuracy and delay of timer subsystem meanwhile,this paper presents a new design of user-mode timer,the main work includes:To obtain high accuracy without affecting the system's performance,a new design called calibration wheel is presented.This design treats the flowing of time as the pointer walking on the calibrations of the wheel and the timers are attached in their expiring calibration with linklist.The wheel is pushed periodically on a specified processor core,and when the pointer in the wheel moves a step forward,this core checks the timers expired in current calibration,timers used in other cores are also checked on this core.The timing accuracy can reach micro-second level by setting the frequency which the wheel moves at.Besides,the performance of other cores will not be affected because the high frequency job of expired timer checking only happens on the specified core.To solve the problem of state switching in the case that the scale of timer being used is very large,a shared memory strategy is presented.The data structures such as calibration wheel and timer are organized in a memory area which can be accessed from both user-mode and kernel-mode.In this way,the timer operation interface in the user-mode and the expired timer checking in the kernel-mode can be realized in the shared memory so that the process would not enter kernel-mode via system call.The expired timer handling procedure also provide a expired timer round-robin queue in the shared memory for user-mode threads,and only when the queue is empty,a signal will be sent to the user-mode thread.In this way,the unnecessary signals produced by expired timer are reduced and then the state switching caused by signal can be relieved.Finally,using the above methods,this paper designs a new user-mode timer system based on Linux,then implements and optimizes it in both multi-core X86 and ARM platform.The experiment shows that the new system keeps the accuracy of the timer within micro-second level.Compared with posix-timer,the new system offers a consistent delay in X86 platform and much smaller delay in ARM platform.
Keywords/Search Tags:Linux User-mode Timer, Multi-core Platform, Calibration Wheel, Shared Memory, Timer Accuracy, Timer Delay
PDF Full Text Request
Related items