Python Forum
os.sched_setaffinity/os.sched_getaffinity - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: os.sched_setaffinity/os.sched_getaffinity (/thread-26815.html)



os.sched_setaffinity/os.sched_getaffinity - pejohnson - May-14-2020

I am new to Python and am using Version 3.8.
The documentation shows there to be os.sched_setaffinity and os.sched_getaffinity. but I get the error that neighter are defined.
What am I missing? Thanks for the assistance.


RE: os.sched_setaffinity/os.sched_getaffinity - snippsat - May-14-2020

I guess you use Windows.
Quote:os.sched_setaffinity and os.sched_getaffinity.
Note: This methods is only available on some UNIX platforms.
Look into win32process, win32process.SetProcessAffinityMask and win32process.GetProcessAffinityMask here.


RE: os.sched_setaffinity/os.sched_getaffinity - pejohnson - May-14-2020

(May-14-2020, 06:04 PM)snippsat Wrote: I guess you use Windows.
Quote:os.sched_setaffinity and os.sched_getaffinity.
Note: This methods is only available on some UNIX platforms.
Look into win32process, win32process.SetProcessAffinityMask and win32process.GetProcessAffinityMask here.

Thanks for the reply.

I am writing an application that will run on Windows, Linux, and MacOS. I was starting on Windows.
I was hoping the Python would provide an OS agnostic environment to ease the cross-platform development.
Not a problem to setup the different platforms.


RE: os.sched_setaffinity/os.sched_getaffinity - DeaD_EyE - May-15-2020

Python is trying the best to have a similar API on different platforms.
In some cases it's not possible because the APIs are too different.
The affects the low-level stuff like process handling, mmap, windows/linux specific stuff.