Forum Discussion
Altera_Forum
Honored Contributor
21 years agoscheduling policy
We're running uClinux based on linux version 2.6.x under the Nios II IDE v1.0.0 build 393. In experimenting with POSIX threads, I've been attempting to activate timeslicing for an app...
Altera_Forum
Honored Contributor
21 years agoI've no direct experience of uLinux, so take what I say with a pinch of salt. But the principles are likely to be the same from other OSes.
1: Round robin scheduling won't switch between tasks except at system "clock tick" boundaries. which are typically about 100Hz. So to see RR scheduling happening, you need to make your task busy for at least 10Millisecs. This is more than just a little bit of maths and declaring an int. Try calculating PI to 1000 places with floating point math http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif ? You only need RR scheduling if you have more than one *CPU-bound* task at the same priority level. 2: Putchar and buffering. Even if you're using a slow serial port, putchar will likely put some buffering in the way, so your output will happen quicker than it appears. This can distort what you see. 2: Beware the priorities of your spawned tasks vs. the task spawning them! Make sure your spawned tasks don't start running until all of them are ready to go, otherwise you'll get additional confusion. This is why you see the slightly odd starting and ending sequences with the 'yield' inserted. Hope that helps... - Roddy