How priority works. - Linux

This is a discussion on How priority works. - Linux ; .... (in pthread higher the value has higher priority) take following example thread A has priority 22 , thread B has priority 80, thread C has priority 2, Assume all thread's A,B and C are SCHED_FIFO and also in infinite ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How priority works.

  1. How priority works.

    .... (in pthread higher the value has higher
    priority)
    take following example
    thread A has priority 22 ,
    thread B has priority 80,
    thread C has priority 2,
    Assume all thread's A,B and C are SCHED_FIFO
    and also in infinite loop....printing time in microseconds
    repeatedly......
    will A occupies entire CPU time...or...execute all thread in
    equal time..??

    Could u please explian flow structure.........


  2. Re: How priority works.

    On Tue, 12 Dec 2006 22:52:28 -0800, VimaleshS wrote:

    > .... (in pthread higher the value has higher
    > priority)
    > take following example
    > thread A has priority 22 ,
    > thread B has priority 80,
    > thread C has priority 2,
    > Assume all thread's A,B and C are SCHED_FIFO
    > and also in infinite loop....printing time in microseconds
    > repeatedly......
    > will A occupies entire CPU time...or...execute all thread in
    > equal time..??



    All threads have the same scheduling class and different priorities,
    therefore the selection will favour BAC in that order, if more then one
    thread is actually runnable at any given time.

    In practise all these threads will spend the vast majority of their time
    waiting on IO to print the time!

    In other words, if B can run, it will, if we still have a CPU available
    and A can run it will, and if we still have a CPU available and C can run
    it will, finally if we STILL have a CPU available the normal scheduler for
    the rest of the system will do its thing.
    There is no notion of fairness with RT scheduling, the highest priority
    runnable thread runs until it blocks!

    HTH

    Regards, Dan.


+ Reply to Thread