| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
There are "helper" threads that process the data within the in-kernel network code somewhat isolating your thread from directly accessing the network hardware in that way. Your realtime thread may even interfere with the responsiveness of these helper threads in ways that might affect your own data. Even if you don't interfere with the processing of the in-kernel data, your response-time characteristics are going to be dominated by the scheduling behavior of these in-kernel threads. There are also situation where the network stack just borrows another user-level thread (that just happened to be in the network stack at the time) to drive completion of your packet handling (inbound and outbound). Obviously, you can't make these all realtime threads, so that too will affect your latency.
The THREAD_PRECEDENCE_POLICY isn't really a completely different policy from the normal timeshare (migrating priority) policy on the system. It's just a way to control a key aspect of that policy. In essence, you are telling the schedule that, within this one process, some threads should have precedence over others even if they have the same priority. Essentially, you are assigning ordinal values to the process' threads without having to know or guess an appropriate system-wide priority for the threads. The system doesn't guarantee to honor it, but will attempt to do so (fairness may dictate that we chose threads to execute out of ordinal order). However, the effect should be process-local, and therefore cannot be relied upon to have any system-wide effect whatsoever.
What has worked well for others in this type of situation is to use the THREAD_EXTENDED_POLICY notion to declare the thread as a "non-long-running" thread (by specifying the timeshare parameter as FALSE). As long as your thread is well behaved and gives up the CPU in reasonable amounts of time, it will always run at a fixed priority.
As such, it will have significant preference over other threads in the system that are (or have been) consuming large amounts of CPU time (and are therefore likely to get in the time way of reasonable timeliness).
| References: | |
| >Re: scheduling question (From: Jim Magee <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.