<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: More information on pthread_setaffinity_np and sched_setaffinity</title>
	<atom:link href="http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/</link>
	<description>A Blog on Parallel Programming and Concurrency by Michael Suess</description>
	<pubDate>Sat, 31 Jul 2010 08:30:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: glass</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-98559</link>
		<dc:creator>glass</dc:creator>
		<pubDate>Sat, 29 May 2010 02:46:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-98559</guid>
		<description>call can not handle the whole affinity mask of the process, so it is impossible to move a process with many threads with one sched_setaffinity</description>
		<content:encoded><![CDATA[<p>call can not handle the whole affinity mask of the process, so it is impossible to move a process with many threads with one sched_setaffinity</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: manas</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-98519</link>
		<dc:creator>manas</dc:creator>
		<pubDate>Fri, 16 Apr 2010 15:58:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-98519</guid>
		<description>I tried using this function to bind two cores using two threads... but i noticed that 
the function is not binding threads to the cores. when the threads are reading the values from shared memory ,means they have the same data set to work upon in that case scheduler is running both the threads on the same core irrespective of this function. I came to know by looking at the system monitor and the time of execution. even after using the threads the execution time was coming out to be approximately equal to the sequential code. Can anybody help me with this ... can somebody give us a good example like the above one on sched_setaffinity...

when i tried to use this function in the threads which are using totally different data sets then this functon worked perfectly . thanks for the example</description>
		<content:encoded><![CDATA[<p>I tried using this function to bind two cores using two threads&#8230; but i noticed that<br />
the function is not binding threads to the cores. when the threads are reading the values from shared memory ,means they have the same data set to work upon in that case scheduler is running both the threads on the same core irrespective of this function. I came to know by looking at the system monitor and the time of execution. even after using the threads the execution time was coming out to be approximately equal to the sequential code. Can anybody help me with this &#8230; can somebody give us a good example like the above one on sched_setaffinity&#8230;</p>
<p>when i tried to use this function in the threads which are using totally different data sets then this functon worked perfectly . thanks for the example</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-98510</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 26 Mar 2010 11:17:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-98510</guid>
		<description>I har run my multithreaded application on a quad core but even I used pthread_setaffinity_np and it seems to set the affinity of each thread on the desired CPU-CORE, also TOP utility show that each core is loaded but the time reports that for a given TASK isung one THREAD it takes T seconds.millis...while for the same task spreaded on N=4 THREADS it takes 4xT secconds.millis...so four times longer which proves that there isn't parallelism...strange</description>
		<content:encoded><![CDATA[<p>I har run my multithreaded application on a quad core but even I used pthread_setaffinity_np and it seems to set the affinity of each thread on the desired CPU-CORE, also TOP utility show that each core is loaded but the time reports that for a given TASK isung one THREAD it takes T seconds.millis&#8230;while for the same task spreaded on N=4 THREADS it takes 4xT secconds.millis&#8230;so four times longer which proves that there isn&#8217;t parallelism&#8230;strange</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tommy</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-98435</link>
		<dc:creator>tommy</dc:creator>
		<pubDate>Wed, 10 Feb 2010 06:16:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-98435</guid>
		<description>&lt;blockquote&gt;
np stands for "non-portable"
http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_setaffinity_np.3.html

I tried this function on an Intel Core2 Duo processor with two threads to run on the two cores. printf outputs tell me that all was well but the system monitor shows me that only one of the cores is being utilized.  (The same application with OpenMP uses both cores). Anything i missed? Thanks</description>
		<content:encoded><![CDATA[<blockquote><p>
np stands for &#8220;non-portable&#8221;<br />
<a href="http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_setaffinity_np.3.html" rel="nofollow">http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_setaffinity_np.3.html</a></p>
<p>I tried this function on an Intel Core2 Duo processor with two threads to run on the two cores. printf outputs tell me that all was well but the system monitor shows me that only one of the cores is being utilized.  (The same application with OpenMP uses both cores). Anything i missed? Thanks</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pradeep</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-97910</link>
		<dc:creator>Pradeep</dc:creator>
		<pubDate>Tue, 30 Jun 2009 00:40:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-97910</guid>
		<description>Hi, 
Any idea about "pthread_setaffinity" version,  not _np (non preemptive) version?
I am on a project that require job to be preempt on a single processor. (This is an experiment)

-Pradeep</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Any idea about &#8220;pthread_setaffinity&#8221; version,  not _np (non preemptive) version?<br />
I am on a project that require job to be preempt on a single processor. (This is an experiment)</p>
<p>-Pradeep</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramki</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-97620</link>
		<dc:creator>Ramki</dc:creator>
		<pubDate>Fri, 27 Feb 2009 23:54:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-97620</guid>
		<description>in the previous post, s,/lib64/tls/nptl,/usr/lib64/nptl,

- Ramki</description>
		<content:encoded><![CDATA[<p>in the previous post, s,/lib64/tls/nptl,/usr/lib64/nptl,</p>
<p>- Ramki</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramki</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-97619</link>
		<dc:creator>Ramki</dc:creator>
		<pubDate>Fri, 27 Feb 2009 23:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-97619</guid>
		<description>Turns out that RHEL doesn't find the right NPTL enabled libpthread.so by default. Trying with -L/lib64/tls/nptl on RHEL works (without the _GNU_SOURCE define).

-
Ramki Balasubramanian
ramki_b@acm.org</description>
		<content:encoded><![CDATA[<p>Turns out that RHEL doesn&#8217;t find the right NPTL enabled libpthread.so by default. Trying with -L/lib64/tls/nptl on RHEL works (without the _GNU_SOURCE define).</p>
<p>-<br />
Ramki Balasubramanian<br />
<a href="mailto:ramki_b@acm.org">ramki_b@acm.org</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: antx</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-64132</link>
		<dc:creator>antx</dc:creator>
		<pubDate>Fri, 06 Jun 2008 00:40:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-64132</guid>
		<description>After inspecting my headers a week ago I found that the pthread_setaffinity_np() is located inside a #ifdef GNU or something similar,
then after some googling I found that in order to link the function you MUST use -D_GNU_SOURCE, so try appending it to GCC!

Luck &#38; Happy hacking.</description>
		<content:encoded><![CDATA[<p>After inspecting my headers a week ago I found that the pthread_setaffinity_np() is located inside a #ifdef GNU or something similar,<br />
then after some googling I found that in order to link the function you MUST use -D_GNU_SOURCE, so try appending it to GCC!</p>
<p>Luck &amp; Happy hacking.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bert Wesarg</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-6287</link>
		<dc:creator>Bert Wesarg</dc:creator>
		<pubDate>Wed, 11 Apr 2007 13:55:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-6287</guid>
		<description>two notes:

(1) pthread_setaffinity_np() is just a wrapper around sched_setaffinity() with the tid from the thread described by the pthread_t. this can be see here http://tinyurl.com/2slkve and here http://tinyurl.com/yobmfb (first note).

(2) because of this, the sched_setaffinity() call can not handle the whole affinity mask of the process, so it is impossible to move a process with many threads with one sched_setaffinity() call to an other set of cpus. and the kernel does also not make a different between a process and a thread, which can be see here http://tinyurl.com/2kdu4f.</description>
		<content:encoded><![CDATA[<p>two notes:</p>
<p>(1) pthread_setaffinity_np() is just a wrapper around sched_setaffinity() with the tid from the thread described by the pthread_t. this can be see here <a href="http://tinyurl.com/2slkve" rel="nofollow">http://tinyurl.com/2slkve</a> and here <a href="http://tinyurl.com/yobmfb" rel="nofollow">http://tinyurl.com/yobmfb</a> (first note).</p>
<p>(2) because of this, the sched_setaffinity() call can not handle the whole affinity mask of the process, so it is impossible to move a process with many threads with one sched_setaffinity() call to an other set of cpus. and the kernel does also not make a different between a process and a thread, which can be see here <a href="http://tinyurl.com/2kdu4f" rel="nofollow">http://tinyurl.com/2kdu4f</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: charles</title>
		<link>http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/comment-page-1/#comment-3060</link>
		<dc:creator>charles</dc:creator>
		<pubDate>Thu, 01 Mar 2007 22:37:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2006/08/18/more-information-on-pthread_setaffinity_np-and-sched_setaffinity/#comment-3060</guid>
		<description>you have to #include "nptl/pthread.h" not pthread.h, which will probably use the linuxthreads header file which doesn't have the affinity methods.  you will also need to do a -I/usr/include/nptl and -L/usr/lib/nptl.  be aware you're breaking your program's compatibility with linuxthreads as a result.  http://osmirrors.cerias.purdue.edu/pub/slackware/slackware-10.2/README.NPTL explains it all.</description>
		<content:encoded><![CDATA[<p>you have to #include &#8220;nptl/pthread.h&#8221; not pthread.h, which will probably use the linuxthreads header file which doesn&#8217;t have the affinity methods.  you will also need to do a -I/usr/include/nptl and -L/usr/lib/nptl.  be aware you&#8217;re breaking your program&#8217;s compatibility with linuxthreads as a result.  <a href="http://osmirrors.cerias.purdue.edu/pub/slackware/slackware-10.2/README.NPTL" rel="nofollow">http://osmirrors.cerias.purdue.edu/pub/slackware/slackware-10.2/README.NPTL</a> explains it all.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
