[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200806090837.25121.jozwicki@aster.pl>
Date: Mon, 9 Jun 2008 08:37:24 +0200
From: Jakub Jozwicki <jozwicki@...er.pl>
To: linux-kernel@...r.kernel.org
Cc: Robert Hancock <hancockr@...w.ca>
Subject: Re: sched_yield() on 2.6.25
> > Is this behavior expected?
>
> The behavior of sched_yield with SCHED_OTHER processes has changed
> several times with Linux over the years, since its behavior is not
> defined by standards, so it's really "whatever the scheduler feels like
> doing". The behavior is only defined with realtime scheduling
> (SCHED_FIFO or SCHED_OTHER).
>
> Generally, it's a mistake to assume specific timing behavior from
> sched_yied for SCHED_OTHER processes.
>From the man sched_yield:
A process can relinquish the processor voluntarily without blocking by
calling sched_yield(). The process will then be moved to the end of the
queue for its static priority and a new process gets to run.
and also IEEE/Open Group:
http://www.opengroup.org/onlinepubs/000095399/functions/sched_yield.html
>> pthread_mutex_lock(&mutex);
> > th = pthread_self();
> > if (pthread_equal(th,last_th)) {
> > pthread_mutex_unlock(&mutex);
> > sched_yield();
> > continue;
Here with SCHED_OTHER sched_yield for the first 100-200 times does nothing.
Should the man be updated?
Regards,
Jakub
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists