Multithreading performance concern
Posted: Fri Nov 04, 2016 8:01 am
Before I write this in assembly, would this take less than a milisecond on 300mhz CPU?
(If MOV takes 1 cycle and CMP & JMP 2 cycles)
The best answer I could hear is less than 300ns on 300mhz.
(If MOV takes 1 cycle and CMP & JMP 2 cycles)
Code: Select all
void Scheduler()
{
if(TickLeft)return;
curThread.type=READY_THREAD;
Thread thr=Pop();
if(thr.type==READY_THREAD)
{
thr.type=EXECUTING_THREAD;
if(ThreadAmount<14)TickLeft=Optimizer[ThreadAmount];
else TickLeft=1000/ThreadAmount;
curThread=thr;
}
}