On Wed, 16 Feb 2000, David Miller wrote:
> > > Is there a way to change the priority of a thread which is
> > > running. Is there any interface to change the attributes of an task
> > > dynamically.
> > [delete]
> > self = pthread_self();
> >
> > // Get the current thread scheduling parameters.
> > if(( r_c = pthread_getschedparam(self, &my_policy, &my_param)) != 0) {
> > rt_printk("pthread_getschedparam error: %d\n", r_c);
> > }
> >
> > // Set thread priority to the new value.
> > my_param.sched_priority = NEW_PRIORITY;
> > if(( r_c = pthread_setschedparam(self, my_policy, &my_param)) != 0) {
> > rt_printk("pthread_setschedparam error: %d\n", r_c);
> > }
> >
> >
> NOTE: When you do this the results may not be what you would expect.
> This can
> raise or lower the priority but it will not prempt a lower priority
> thread. In
> other words. You set a thread to higher priority and it is waiting on
> data to
> be supplied by an interrupt. When the interrupt comes in the thread
> will be made
> ready and will execute before lower priority threads but it must wait
> for the
> currently running, possibly lower priority, thread to suspend.
>
> David Miller
Your statement is true only for user level thread. In Linux, the kernel
level thread will preempt the low priority thread immediately after the
interrupt return except that the low priority thread is in kernel mode.
In that case, the preemption will occur immediately after the low priority
thread return to the user mode.
Therefore, the latency depends on the execution time of system call. The
preemption points of RED-Linux is used to reduce this delay. The low
latency patch basicly do the same thing.
Yu-Chung Wang
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/