[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nptl] Re: SCHED_RR issue



Good Evening, 

> > > Second, you are right: [counter] reflects something like the age of 
> > > the thread.
> > 
> > To be more exact. It is the number of times that the thread acquired 
> > a CPU. Well, at least that's the intent! 
> > 
> > It is related to the age of the thread, because of SCHED_RR. 
> 
> That's it IMHO... in a perfect world ;) But I'm not sure whether
> sched_yield() works as expected... neither the SCHED_RR policy :)

One of my favorite principle:
In theory, there is no difference between theory and practice. 
In practice, there is no similarity. 
:-D :-D :-D 

But I can't really imagine that scheld_yield() is broken. That's one
of the most trivial syscall. Really. 
 
Let's check the kernel source right now ():
/usr/src/linux-2.6.5-1.358/kernel/sched.c 

asmlinkage long sys_sched_yield(void)
{
        runqueue_t *rq = this_rq_lock();
        prio_array_t *array = current->array;

        /*
         * We implement yielding by moving the task into the expired
         * queue.
         *
         * (special rule: RT tasks will just roundrobin in the active
         *  array.)
         */
        if (likely(!rt_task(current))) {
                dequeue_task(current, array);
                enqueue_task(current, rq->expired);
        } else {
                list_del(&current->run_list);
                list_add_tail(&current->run_list, array->queue +
current->prio);
        }
        /*
         * Since we are going to call schedule() anyway, there's
         * no need to preempt:
         */
        _raw_spin_unlock(&rq->lock);
        preempt_enable_no_resched();

        schedule();

        return 0;
}

This looks just fine, I guess. Unless there are some issue with the spin
lock...


Cheers,
Loic.

-- 
--
// Sender address goes to /dev/null (!!) 
// Use my 32/64 bits, ANSI C89, compliant email-address instead:   

unsigned y[]=
{0,34432,26811,16721,41866,63119,61007,48155,26147,10986};
void x(z){putchar(z);}; unsigned t; 
main(i){if(i<10){t=(y[i]*47560)%65521;x(t>>8);x(t&255);main(++i);}}

NEU: GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++

Liste de diffusion nptl
Pour se désinscrire : mailto:nptl_request@bullopensource.org?subject=unsubscribe