<?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: Semaphores on Linux &#8211; sem_init() vs sem_open()</title>
	<atom:link href="http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/</link>
	<description>Pat Patterson on the Cloud, Identity and Single Malt Scotch</description>
	<lastBuildDate>Thu, 23 May 2013 17:53:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Debugging python-for-android with gdb &#8212; /dev/blah</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-62005</link>
		<dc:creator>Debugging python-for-android with gdb &#8212; /dev/blah</dc:creator>
		<pubDate>Tue, 13 Nov 2012 01:11:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-62005</guid>
		<description><![CDATA[[...] been sinking a lot of time in trying to make python-for-android support multiprocessing, and for various reasons, it turns out to be a bad idea®, but in doing that, i had to go to great extents to [...]]]></description>
		<content:encoded><![CDATA[<p>[...] been sinking a lot of time in trying to make python-for-android support multiprocessing, and for various reasons, it turns out to be a bad idea®, but in doing that, i had to go to great extents to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat Patterson</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-45127</link>
		<dc:creator>Pat Patterson</dc:creator>
		<pubDate>Mon, 27 Feb 2012 16:12:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-45127</guid>
		<description><![CDATA[abhishek - sem_open is mentioned towards the bottom of the blog entry as a simpler alternative to sem_init. See also Vikram&#039;s original article: http://linuxdevcenter.com/pub/a/linux/2007/05/24/semaphores-in-linux.html?page=4]]></description>
		<content:encoded><![CDATA[<p>abhishek &#8211; sem_open is mentioned towards the bottom of the blog entry as a simpler alternative to sem_init. See also Vikram&#8217;s original article: <a href="http://linuxdevcenter.com/pub/a/linux/2007/05/24/semaphores-in-linux.html?page=4" rel="nofollow">http://linuxdevcenter.com/pub/a/linux/2007/05/24/semaphores-in-linux.html?page=4</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhishek</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-45080</link>
		<dc:creator>abhishek</dc:creator>
		<pubDate>Mon, 27 Feb 2012 04:36:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-45080</guid>
		<description><![CDATA[So what part of this article explains sem_open???? I came looking for some explanation on named semaphores but found the easy unnamed semaphores instead]]></description>
		<content:encoded><![CDATA[<p>So what part of this article explains sem_open???? I came looking for some explanation on named semaphores but found the easy unnamed semaphores instead</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat Patterson</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-42577</link>
		<dc:creator>Pat Patterson</dc:creator>
		<pubDate>Sat, 14 Jan 2012 00:56:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-42577</guid>
		<description><![CDATA[Hi zac - sem_open() takes the semaphore name, so you should be able to use that, I think.]]></description>
		<content:encoded><![CDATA[<p>Hi zac &#8211; sem_open() takes the semaphore name, so you should be able to use that, I think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zac</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-42379</link>
		<dc:creator>zac</dc:creator>
		<pubDate>Wed, 11 Jan 2012 16:05:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-42379</guid>
		<description><![CDATA[I forgot to mention i am coding in C.
Tnx a bunch!]]></description>
		<content:encoded><![CDATA[<p>I forgot to mention i am coding in C.<br />
Tnx a bunch!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zac</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-42378</link>
		<dc:creator>zac</dc:creator>
		<pubDate>Wed, 11 Jan 2012 16:01:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-42378</guid>
		<description><![CDATA[Dear Pat,thank u 4 that wonderful post.
Cud you  plz suggest something 4 thhis problem i am facing:
I am testing a custom inter-process semaphore implementation where semaphore is called as a function, ie, one function to create sem,another function to take sem and so on.
I am forking a process and i want the sem to be created in the shared memory.
I cannot pass the sem_t *sem value to the custom function(it has only one argument,which is semaphore name).
What can i do to make this function run in the shared memory space?Or how can i get around this problem?]]></description>
		<content:encoded><![CDATA[<p>Dear Pat,thank u 4 that wonderful post.<br />
Cud you  plz suggest something 4 thhis problem i am facing:<br />
I am testing a custom inter-process semaphore implementation where semaphore is called as a function, ie, one function to create sem,another function to take sem and so on.<br />
I am forking a process and i want the sem to be created in the shared memory.<br />
I cannot pass the sem_t *sem value to the custom function(it has only one argument,which is semaphore name).<br />
What can i do to make this function run in the shared memory space?Or how can i get around this problem?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vikraman</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-32265</link>
		<dc:creator>Vikraman</dc:creator>
		<pubDate>Wed, 17 Aug 2011 11:35:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-32265</guid>
		<description><![CDATA[Thank you, this literally saved my day ;)]]></description>
		<content:encoded><![CDATA[<p>Thank you, this literally saved my day <img src='http://blog.superpat.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat Patterson</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-31140</link>
		<dc:creator>Pat Patterson</dc:creator>
		<pubDate>Fri, 29 Jul 2011 00:42:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-31140</guid>
		<description><![CDATA[Hi Nilesh, it looks like your code is missing a couple of lines, but I think I understand your question. The answer is that the order in which the two processes enter the critical section is not guaranteed; only the fact that they won&#039;t be there at the same time. What are you trying to do?

BTW - it&#039;s better to create a gist and post the URL here - then your code won&#039;t get eaten by WordPress - https://gist.github.com/]]></description>
		<content:encoded><![CDATA[<p>Hi Nilesh, it looks like your code is missing a couple of lines, but I think I understand your question. The answer is that the order in which the two processes enter the critical section is not guaranteed; only the fact that they won&#8217;t be there at the same time. What are you trying to do?</p>
<p>BTW &#8211; it&#8217;s better to create a gist and post the URL here &#8211; then your code won&#8217;t get eaten by WordPress &#8211; <a href="https://gist.github.com/" rel="nofollow">https://gist.github.com/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilesh</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-31122</link>
		<dc:creator>Nilesh</dc:creator>
		<pubDate>Thu, 28 Jul 2011 19:51:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-31122</guid>
		<description><![CDATA[Thanks for this explanation. I tried using sem_open this way:

if ((mutex = sem_open(&quot;mysemaphore&quot;, O_CREAT, 0644, 0)) == SEM_FAILED) {
    cerr &lt;&lt; &quot;semaphore initilization error&quot; &lt;&lt; endl;
    return 1;
  }

  
  pid_t pid = fork();
  
  if (0 == pid) {
    /*
    if ((mutex = sem_open(&quot;mysemaphore&quot;, 0, 0644, 0)) == SEM_FAILED) {
      cerr &lt;&lt; &quot;semaphore initilization error&quot; &lt;&lt; endl;
      return 1;
    }
    */
    cout &lt;&lt; &quot;here1&quot; &lt; 0) {
    sem_wait(mutex);
    cout &lt;&lt; &quot;here2&quot; &lt;&lt; endl;
    wait(&amp;retval);
  }

The output is:
here2
here1

that&#039;s not correct. Am I missing something?]]></description>
		<content:encoded><![CDATA[<p>Thanks for this explanation. I tried using sem_open this way:</p>
<p>if ((mutex = sem_open(&#8220;mysemaphore&#8221;, O_CREAT, 0644, 0)) == SEM_FAILED) {<br />
    cerr &lt;&lt; &quot;semaphore initilization error&quot; &lt;&lt; endl;<br />
    return 1;<br />
  }</p>
<p>  pid_t pid = fork();</p>
<p>  if (0 == pid) {<br />
    /*<br />
    if ((mutex = sem_open(&quot;mysemaphore&quot;, 0, 0644, 0)) == SEM_FAILED) {<br />
      cerr &lt;&lt; &quot;semaphore initilization error&quot; &lt;&lt; endl;<br />
      return 1;<br />
    }<br />
    */<br />
    cout &lt;&lt; &quot;here1&quot; &lt; 0) {<br />
    sem_wait(mutex);<br />
    cout &lt;&lt; &quot;here2&quot; &lt;&lt; endl;<br />
    wait(&amp;retval);<br />
  }</p>
<p>The output is:<br />
here2<br />
here1</p>
<p>that&#039;s not correct. Am I missing something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat Patterson</title>
		<link>http://blog.superpat.com/2010/07/14/semaphores-on-linux-sem_init-vs-sem_open/comment-page-1/#comment-20948</link>
		<dc:creator>Pat Patterson</dc:creator>
		<pubDate>Fri, 01 Apr 2011 04:19:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superpat.com/?p=1113#comment-20948</guid>
		<description><![CDATA[Hi Nisheeth - shm_open takes a name for the shared memory region, so unrelated processes just need to know the same name. Yes - I think System V IPC message queues can do all this, they just looked quite a bit more complex to deal with when I was working on this.]]></description>
		<content:encoded><![CDATA[<p>Hi Nisheeth &#8211; shm_open takes a name for the shared memory region, so unrelated processes just need to know the same name. Yes &#8211; I think System V IPC message queues can do all this, they just looked quite a bit more complex to deal with when I was working on this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
