Message143988
| Author |
neologix |
| Recipients |
benjamin.peterson, meador.inge, neologix, skrah, vstinner |
| Date |
2011年09月13日.20:47:09 |
| SpamBayes Score |
2.6431648e-09 |
| Marked as misclassified |
No |
| Message-id |
<1315946830.17.0.273226137403.issue12936@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> If we have access (and as I understood from Victor's post we do):
> pthread_getaffinity_np() also exists on FreeBSD, which would be
> an advantage.
Yes, but I see several drawbacks:
- as noted by Victor, it's really easy to crash the interpreter by passing an invalid thread ID, which IMHO, should be avoided at all cost
- to be safe, we would need to have a different API depending on whether Python is built with threads or not (i.e. sched_setaffinity() without threads, and pthread_setaffinity_np())
- pthread_setaffinity_np() is really non-portable (it's guarded by __USE_GNU in my system's header)
- sched_setaffinity() seems to work fine on most systems even when linked with pthread
> I don't care strongly about using pthread_getaffinity_np(), but at least I'd
> like to skip the scheduling sections on arm-linux if they don't work reliably.
Sounds reasonable.
I guess you could use os.uname() or platform.machine(). |
|