Find the answer to your Linux question:
Results 1 to 3 of 3
Hello all, First, I'm new to Linux and pthread programming and recently discovered that calling pthread_cond_signal does not immediately wakeup higher priority waiting threads. Instead, the low priority thread which ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    9

    Pthreads: How to get pthread_cond_signal to immediately wakeup waiters


    Hello all,

    First, I'm new to Linux and pthread programming and recently discovered that calling pthread_cond_signal does not immediately wakeup higher priority waiting threads. Instead, the low priority thread which calls pthread_cond_signal is allowed to execute for a bit before the high priority waiting thread executes. However, I'd like to eliminate the scheduling delay. My goal is to find a solution which allows threads to signal a condition variable and immediately wakeup higher priority waiters.

    My current approach to call sched_yield after every call to pthread_cond_signal. However, I would like to find an alternative which preferably does not require modifications to my code. Are there other solutions available and, if so, how can I use them? Are there kernel/pthread settings available or alternate schedulers available to give this behavior? Does the RT-Preempt patch give this behavior?

    Best Regards,
    Shaun

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,380
    Is your real need for deterministic real-time performance? If so, then Linux is not the solution. Check out QNX for that sort of requirement.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Apr 2011
    Posts
    9
    I am porting software from a commercial RTOS to Linux and cannot choose a different OS. Please understand that I appreciate your advice, but I need another approach. Given that I'm finding Linux options such as CONFIG_PREEMPT, the RT-Preempt patch was created, etc. I am hopeful another solution exists other than avoiding Linux entirely and am checking into potential options.

    BTW - Here is one site discussing how Linux is suitable for real-time:
    (Linux forums is blocking the link since I have fewer than 15 posts. Search for "Anatomy of real-time Linux architectures" on Google" instead)

    Ultimately, I am not sure what pthread behavior I can acheive with the combinations of options. Do you know what the pthread behavior is with CONFIG_PREEMPT or with the RT-Preempt patch?
    Last edited by shaunp; 04-01-2011 at 07:12 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •