Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8825879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:59:12+00:00 2026-06-14T06:59:12+00:00

I need a thread in my process to wakeup every 5ms(precise) and do some

  • 0

I need a thread in my process to wakeup every 5ms(precise) and do some work.
I have used posix timers, they seems to be accurate 90% and accuracy further decreases when cpu is somewhat loaded.
I believe that is because posix timer have to fork new thread on every expiry.
Is there some other reliable way to implement high resolution timer in linux and will increasing priority of thread help?
I am on CentOS 5.6.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:59:14+00:00Added an answer on June 14, 2026 at 6:59 am

    The POSIX timers (created with timer_create()) are already high-resolution. Your problem is in the delivery method – if you want very precise timing then SIGEV_THREAD is not a good idea.

    You could instead use SIGEV_SIGNAL so that timer expiry is notified via a signal, then use sigwaitinfo() to wait for it to expire. Alternately, you could use a timerfd instead of a POSIX timer (created with timerfd_create()).

    Additionally, if you want your thread to preempt other running threads when the timer expires, you’ll need to give it a real-time scheduling policy (SCHED_FIFO or SCHED_RR) with sched_setscheduler().

    You will also want to ensure that your kernel is compiled with the CONFIG_PREEMPT option, which allows most kernel code to be preemptable. There will still be some level of jitter, caused by non-preemptible kernel work like hardware interrupts and softirqs. To reduce this further, you can try using the CONFIG_PREEMPT_RT kernel patchset.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ACE threads and need each thread to have its own int
I have to create a progress bar in a webapp. I need a thread
I need to kill specific worker thread in my application. I don't have any
For some part of my project I need a process-local scheduling system that will
I have a List<Polyline> that I need to generate in a second thread so
I need to built a thread/process that is always running, and can be queried
I need to send information to every thread that's running in my program, and
I have 3 processes which need to be synchronized. Process one does something then
I have a process where I want the main thread to run through a
I have a process that I need to run almost permanently. I've being using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.