[fpc-pascal] Re: GetAffinity\SetAffinity

Brian vmst at golden.net
Wed Nov 20 22:24:10 CET 2013


All the documentation seems to indicate that processes and threads are
treated alike in Linux , however , even having established that I can
apparently select a core to run a thread , I haven't yet been able to make
it work.

I explain the findings from a dual core Intel CPU.

Using the sched_setaffinity() I can run a program on either core1 or core2
as long as all threads are set to the same core.

If the main process (program) is set to core2 and all the threads are set to
core2 everything is fine and dandy.

However if the main process (program) is set to Core1 and any thread is set
to Core2 using pthread_setaffinity_np() , when the Core2 thread starts to
run it generates an immediate GP fault.

The intent is to be able to run a thread which polls a serial or Ethernet
port , rather like one would do with an ISR , but using a separate core for
the task , while the main program runs on a different core.

At this point I am not certain if there is something I am missing.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/GetAffinity-SetAffinity-tp3351231p5717541.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.

More information about the fpc-pascal mailing list