Re: question about thread scheduling

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Henrik,
your suggestion is very helpful!
thanks for your help!
Zhiqiang
"Henrik Viklund" <henrik.viklund@xxxxxxxxx> schrieb im Newsbeitrag
news:1174399051.548533.247190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Using TerminateThread is generally not advisable. It just "point
blank" kills the thread as soon as it gets a chanse, possibly leaving
sharded resources in an inconsistent state.

I don't know the details of your system so this might or might not not
work for you, but what you probably want to do in this case is to have
the NN thread periodically check a control variable and reset or exit
based on the state of that variable.

For example for each iteration through the NN you check an event that
the control thread sets when it wants the NN to start over.

Henrik Viklund
http://www.addlogic.se

On Mar 20, 2:19 pm, "Zhiqiang Li" <zhiqiang...@xxxxxxxxxx> wrote:
I am afraid that I have to use TerminateThread to get the thread start
from
the very beginning instead of where it is preempted! right?

thanks for your help
"Henrik Viklund" <henrik.vikl...@xxxxxxxxx> schrieb im
Newsbeitragnews:1174391436.225622.144870@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Changing the thread quanta will *not* make the thread start over. A
thread's quanta is essentially the maximum amount of continious
computing time that the scheduler will dedicate to a thread if there
are other threads of equal priority in the system that can also run.

Henrik Viklund
http://www.addlogic.se

On Mar 20, 11:15 am, "Zhiqiang Li" <zhiqiang...@xxxxxxxxxx> wrote:
If CeSetThreadQuantum(3) on my neural network thread, will it starts
from
the entry point of thread instead of where it is preempted?
"Steve Wolstenholme" <s...@xxxxxxxxxxxxxxxxxxxx> schrieb im
Newsbeitragnews:cuntv21lgdjbnoh3qsb3khsc7tcgns3nu8@xxxxxxxxxx

On Mon, 19 Mar 2007 15:04:17 +0100, "Zhiqiang Li"
<zhiqiang...@xxxxxxxxxx> wrote:

now the control thread get running every 4ms, but I got another
question
on
thread scheduling. Since the thread doing neural network stuff want
to
use
up the CPU time allocated to it as much as possible, it is an
optimization
problem, the longer it runs, the better the result, but at some
point,
it
will be preempted by higher priority thread: control thread,
and enter a suspended state, how can I get the thread doing neural
network
stuff start over again when next time it is awakened. Sicne normally
it
would start from where it is preempted, right?

In my neural network I set the base priority to IDLE_PRIORITY_CLASS
so
that the threads only run when the system is idle. The application
uses whatever CPU is available (90% plus) but yields to anything
that
wants to run. The best of both worlds.

--
Steve Wolstenholme Neural Planner Software Ltd

EasyNN-plus. The easy way to build neural networks.

http://www.easynn.com-Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -




.


Quantcast