Re: minimum tick/quantum for fast real time control



I may be weak on many CE concepts – this is my 1st investigation of a complex
multithreaded RT OS but I have written control loops and filters for real
time machine control at the assembler level.
I am hoping that massive overkill hardware which is cheap now will make up
for added software overhead and yield project development time savings by
working with higher level tools.

My basic perspective is to 1st look at base hardware/software performance
limits at a very low level – I want information/guidance to ultimate limits
with Win CE before spending programmer-months learning them the hard way –
any good current references on what could be done with GHz SBC running CE and
fast/static memory model C code?

While the 1st project may be fine with 1 mS tick, I can foresee the wanting
higher loop speeds – one existing project uses 16 KHz data sampling rate,
another candidate for redesign is a project that uses 4 KHz sampling/control
loop on 12 channels requiring ~1K MAC operations per point – a trivial
computation load for a current GHz processor – but can Win CE successfully
schedule these? - wouldn't I want the system tick to be less than my required
loop time? Can the tick time be reduced below 1 mS (at system
build/configuration time?)

I also have questions about USB timing – is the OS/kernel/scheduler “aware”
of the USB frame times? With many “full speed” devices still being made I
realize 1 mS turn-around with interrupt transfers would be the best expected
performance – but as High speed devices become more available the 125 uS
microframe rate would make USB communication practical for the range of
motion control that our company employs. But without some scheduler/USB
driver coordination I would expect a 1 frame uncertainty in actual
transmission.

Where can I find information on these potentially project killing "details"
before deciding to go froward with Win CE?

thanx

"Michel Verhagen (eMVP)" wrote:

I think you are missing one important point:

CE uses a *prioritized* round robin scheduling mechanism.

This means that no matter what the quantum is, when a higher priority
thread is ready to run, it *will* run, preempting the lower priority
thread immediately (not after that lower thread finishes its quantum).

If two threads of the same priority are the only two threads running in
the system, they will each run for 100ms at a time.

In other words (simplistic view): the scheduler decides which thread
should run every 1ms based on priority.

From what I can determine from the information in your question, those
data rates can be easily attained in CE (and yes I've got a lot of
experience with USB in CE ;o)



Good luck,

Michel Verhagen, eMVP
Check out my blog: http://GuruCE.com/blog

GuruCE Ltd.
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.

e^ipi wrote:
what determines/limits/is practical minimum quantum? (default = 100 mS)
I want to use a 500+ MHz SBC w/Win CE as a industrial controller - may want
1 mS or less quantum and/or "tick" ( default=1mS ?) to get enough
responsivity for running PID control loop in CE

"headless" - no GUI/graphics - just collect data from usb and/or pci
interface cards, time stamp/align and pump it out on ethernet, ~1-200 kbyte/s
aggregate rates

obviously at some point the scheduler eats up all of the time with thread
swapping overhead - but someone must have some idea how many instruction
cycles/tick or quantum is reasonable as a lower limit

several older refs show (costly?) ~100 uS thread creation/destruction times
with 200 MHz processors, since 1+ GHz Single Board Computers are cheap
nowadays I would think the 1 mS tick,100 mS quantum defaults are outdated

does it differ in CE 5 vs 6, any/which services/components have (large)
critcal sections?

I know usb "full speed" uses 1 mS interrupt rate so I assume latency would
be an issue when trying to use USB interface DAQ boards in a fast real time
system - anyone have experience with USB drivers and CE?


.



Relevant Pages