Results 1 to 18 of 18

Thread: Qt Thread Priorities Under Linux

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    122
    Thanks
    62
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Thread Priorities Under Linux

    wyosata, you were kind enough in another thread to provide source code to a thread safe queue you developed. It is my understanding, that this implemenation implements a monitor object, providing thread safe mutual exclusion to the objects it controls.
    What is also nice about this C++ template is that it will throttle the producer until the consumer has freed up some queue space.

    In my current application, I have several secondary threads, none of which run exec() loops because I want them to pend. The secondary threads will likely have a higher priority than the main GUI thread.

    The secondary thread within its thread context will pass data to the primary GUI thread via your thread safe queue.

    Do you see any potential priority inversion condition that could occur wherein the GUI thread, having a lower priority than the producer thread, would be indirectly preempted by the lower priority GUI thread effectively "inverting" the relative priorities of the two tasks?

    I was doing some reading on how POSIX threads, and speciifically how the Pthread mutex has a provision to handle this condition via priority inheritence or ceiling. However, in looking through the Qt source code, it is clear that Qt's implementation of QMutex does
    not have these provisions.

    I was wondering if a simple derivation from QMutex might suffice, or in the case of your fine thread safe template, perhaps a derivation from QSemaphore to ensure that a priority inversion solution is in place.

    Do you have any thoughts on this?
    Last edited by bob2oneil; 20th April 2011 at 20:07.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt Thread Priorities Under Linux

    I'm not sure what you mean, the following sentence seems to be misedited which makes it lose its sense.

    Quote Originally Posted by bob2oneil View Post
    Do you see any potential priority inversion condition that could occur wherein the GUI thread, having a lower priority than the producer thread, would be indirectly preempted by the lower priority GUI thread effectively "inverting" the relative priorities of the two tasks?
    GUI thread would be preemptied by the GUI thread? Could you explain what you really meant?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 5
    Last Post: 22nd February 2011, 21:21
  2. Replies: 7
    Last Post: 27th January 2011, 08:48
  3. Replies: 9
    Last Post: 28th November 2009, 20:31
  4. Replies: 16
    Last Post: 7th October 2009, 08:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.