[fpc-pascal] Threading vs Parallelism ?
Brian
vmst at golden.net
Fri May 5 21:27:48 CEST 2017
Affinity
If a thread is dedicated to say , polling a serial or Ethernet port which
has a high input data rate , then dedicating one CPU to that task/thread is
useful.
(Hard Affinity) with multi-core CPU's is to dedicate a specific core to a
task (thread) and just poll the input memory mapped source. This works very
well.
http://www.ibm.com/developerworks/linux/library/l-affinity/index.html#download
These Linux API functions set the affinity for processes :
sched_set_affinity() (for altering the bitmask)
sched_get_affinity() (for viewing the current bitmask)
These functions set the affinity for threads :
pthread_setaffinity_np (pthread_t thread, size_t cpusetsize, const
cpu_set_t *cpuset);
pthread_getaffinity_np (pthread_t thread, size_t cpusetsize, cpu_set_t
*cpuset);
They are very simple to translate into Free Pascal
Brian
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Threading-vs-Parallelism-tp5728018p5728437.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
More information about the fpc-pascal
mailing list