Find the answer to your Linux question:
Results 1 to 2 of 2
Hi.. i think we can simulate preemption by using 2 different priority thread, am i true? I just try these scenario : 1. Create Thread A with priority 99 , ...
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    2

    preemption and scheduling of Pthreads

    Hi..

    i think we can simulate preemption by using 2 different priority thread, am i true? I just try these scenario :
    1. Create Thread A with priority 99 , SCHED_FIFO..
    2. Create Thread B with priority 4 , SCHED_FIFO

    Thread A started and doing some busy work.. I guess that Thread B wouldn't start until thread A finished, but I get thread B can run before Thread A finished (It just like a common task switching).. I'm sure my 2 thread has right priority.
    and if thread B is doing some work and if i yield it to thread A, it should preempt it but this doesnt happen, do someone kno wats happening?

    pls reply with your thought process
    thanks

  2. #2
    Just Joined!
    Join Date
    May 2010
    Posts
    2
    Hi

    I was trying to do something similar to this.
    For me SCHED_FIFO is not working as I expect. I would expect the high priority thread to keep running until its job is done. But what I observe is that both the threads run round robin.

    I had posted similar query on the forum:
    "implementing-priority-based-preemtive-pthread.html"

    Do you have any further leads in this ?

    Thanks,
    B

Posting Permissions

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