Menu

#2 context_switch() improvement idea

open
nobody
None
5
2004-08-15
2004-08-15
No

Hi,

usually, usleep(0) will behave the same as usleep(1),
i.e. pausing for one tick (1/HZ s). However, if your
usleep(0) does not do so, you could try usleep(1) in
context_switch().

Another idea would be to use sched_yield() (#include
<sched.h>) in context_switch(), but which is a bit
different from usleep() in that it puts itself at the
end of the task list for the current priority, whereas
I do not know of the pausing internals of usleep()
behaving the same.

Cheers,
Jan Engelhardt

Discussion


Log in to post a comment.