Main Site Documentation

Adjusting the thread quantum duration


I know there are ways to adjust the thread quantum duration, but so far the only method I’ve read about is to modify the .netmf port CPP files and recompile. That is beyond my experience, and enthusiasm. ???

Is there any other way to adjust the quantum, preferably through .netmf itself? I’m not trying to build a RTOS or anything like that, but I don’t want an ill-behaved thread to be able to suck down a full 20 mS. I’d like to lower that to about 4 mS.

I’m using a Panda-II, though I expect it does not matter.


This is built in the core and can’t be changed but you can give threads higher priority to give them more execution time.


I don’t believe there is an API for changing the thread quantum.

There is a thread priority facility, but I do not know whether the MF “kernel” will interrupt a running thread if a higher priority task goes int a ready state. You can experiment with priorities and let us know what you find.

If you have a long running thread, that you might want to release the CPU before the 20ms is up, you can try inserting a Thread.Sleep(0). This should cause task scheduling to occur, and if another task is ready it will run.

Normally, a program with a an ill-behaved thread would not be released.