1 Sep 2008 07:07
Re: Timeslicing on arm
Andrew Lunn <andrew <at> lunn.ch>
2008-09-01 05:07:20 GMT
2008-09-01 05:07:20 GMT
On Sun, Aug 31, 2008 at 09:42:02PM +0200, Martin Hansen wrote:
> 2008/8/31 Andrew Lunn <andrew <at> lunn.ch>:
> > Thank about how mutex affect round robin scheduling....
> Does cyg_io_write implie an mutex on the thread?
I think so.
Anyway, there are a couple possible explanations here. Use the bt and
threads commands in gdb to see where the threads are running/blocked.
Think about two threads:
thread1()
for (;;) {
mutex_lock(m);
do_work()
mutex_unlock(m);
}
thread2()
for (;;) {
mutex_lock(m);
do_other_work()
mutex_unlock(m);
}
thread1 starts first and will spend most of its time inside do_work(),
holding the mutex. If it runs without blocking until it has used its
timeslice, it will be descheduled. This is likely to happen inside
do_work, while still holding the mutex. thread 2 gets to run. It runs
(Continue reading)
RSS Feed