Re: Yielding the processor in a kext?
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com User-agent: Icedove 1.5.0.9 (X11/20061220) 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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Régis Duchesne