> I have some doubts regarding the way in which the Pth scheduler > implements "Priority based non-preemptive Scheduling".
When a low-priority thread make a higher-priority thread ready-to-run, it is offering the CPU to that higher-priority thread. > My program is using the pth "cond" and "mutex" > variables for synchronization between the threads. > From a low priority thread, I am calling > pth_cond_notify() and immediately a higher priority > thread (which was there in the ready queue) was getting scheduled. Well, that's the purpose of 'pth_cond_notify'. It is, after all, a synchronization function. > I analyzed the pth_cond_notify () and saw a pth_yield() inside that function. > This pth_yield() is "preempting" the lower priority thread that called the pth_cond_notify(). It's not preempting it, the lower priority thread explicity made the higher priority thread ready-to-run by calling a synchronization function. > But my application was expecting a pure non-preemptive response. You weren't pre-empted, you made a higher-priority thread run. > Can I achieve the non-preemptive response if I remove the > pth_yield() in pth_cond_notify() ? > Will there be any performance issue with the Pth library, > if I remove the pth_yield () in pth_cond_notify() ? It's hard for me to imagine why you would want to do this. What's the point of having thread priorities if you want to keep the higher-priority threads from running? But, yes, it should be safe and should do what you want. But I think it's quite likely that you're doing something fundamentally odd, possibly poorly thought out, that makes you want this. DS ______________________________________________________________________ GNU Portable Threads (Pth) http://www.gnu.org/software/pth/ Development Site http://www.ossp.org/pkg/lib/pth/ Distribution Files ftp://ftp.gnu.org/gnu/pth/ Distribution Snapshots ftp://ftp.ossp.org/pkg/lib/pth/ User Support Mailing List [EMAIL PROTECTED] Automated List Manager (Majordomo) [EMAIL PROTECTED]