Re: Yielding the processor in a kext?
Re: Yielding the processor in a kext?
- Subject: Re: Yielding the processor in a kext?
- From: Régis Duchesne <email@hidden>
- Date: Fri, 07 Sep 2007 09:46:59 -0700
Garth,
> As you probably know, there's the I/O Kit world with its way of doing
> things, then there's the rest of the kernel. Which are you asking about?
Sorry I might be using the wrong terminology. I'm asking about a way to
do it from a kext (as opposed to the core xnu code). Whether that kext
is IOKit-style or BSD-style does not matter to me. I'll take anything
you give me :)
> What's going on in your kext when you want to yield?
We manage a bunch of (userland) threads that do some heavy computation
(very similar to finite element analysis). For some reason that I'm not
going to detail here, this management happens in a kext.
Our goal is to make sure that none of these threads computes much faster
than the others. That is, the more consistent the rate of progress
across all these threads, the better the accuracy of the result of the
computation.
The xnu scheduler is of course free to schedule these threads as it
wants (no CPU affinity API is available to userland or kexts), and it
knows nothing about the specifics of our application.
So our solution is to periodically measure how much progress has been
accomplished by these threads, and if one of them is too far ahead of
the others, we don't want to stop it but we want to slow it down
compared to the other threads.
To slow it down, we would like to yield the processor, i.e. just
deschedule the current thread, which is at the beginning of the
scheduling queue for its priority, and move it at the end of that queue.
We are wondering which API can be used to do that. Would an IOSleep(0)
(which is the way you do it on Windows) work or will it just be ignored?
Thanks,
--
hpreg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden