<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: high-speed single-producer/consumer queue impl in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995676#M6356</link>
    <description>&lt;P&gt;During my last update to the web server, I screwed up the zip file by added &lt;BR /&gt;old assembly files. Its fixed now!&lt;/P&gt;
&lt;P&gt;Please re-download.&lt;/P&gt;
&lt;P&gt;Sorry!&lt;/P&gt;
&lt;P&gt;:O &lt;BR /&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;HR /&gt;
lockfree wrote:&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;
&lt;P&gt;&lt;SPAN&gt;Here are some snippets of code from my new library that implement a simple and efficient lock-free method for high-speed thread-to-thread communication. Its a simple single-producer/consumer queue algorithm implemented in i686 assembly. You can easily convert it into a multi-producer/consumer queue by protecting it with two &lt;SPAN&gt;separate&lt;/SPAN&gt;mutexs; one for the push function and one for the pop function. Unfortunately, adding mutexs gets rid of the lock-free nature of the queue and introduces the kernel. However, the setup allows for "concurrent pushes and pops" because youre using two mutexs to emulate a single producer/consumer environment. In other words a producer does not block a consumer and vise versa. Enjoy! ;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Any comments or questions?&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;HR /&gt;
&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sat, 26 Mar 2005 03:50:39 GMT</pubDate>
    <dc:creator>Chris_M__Thomasson</dc:creator>
    <dc:date>2005-03-26T03:50:39Z</dc:date>
    <item>
      <title>high-speed single-producer/consumer queue impl</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995669#M6349</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;
&lt;P&gt;&lt;SPAN&gt;Here are some snippets of code from my new library that implement a simple and efficient lock-free method for high-speed thread-to-thread communication. Its a simple single-producer/consumer queue algorithm implemented in i686 assembly. You can easily convert it into a multi-producer/consumer queue by protecting it with two &lt;SPAN&gt;separate&lt;/SPAN&gt;mutexs; one for the push function and one for the pop function. Unfortunately, adding mutexs gets rid of the lock-free nature of the queue and introduces the kernel. However, the setup allows for "concurrent pushes and pops" because youre using two mutexs to emulate a single producer/consumer environment. In other words a producer does not block a consumer and vise versa. Enjoy! ;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Any comments or questions?&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 12 Feb 2005 16:01:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995669#M6349</guid>
      <dc:creator>Chris_M__Thomasson</dc:creator>
      <dc:date>2005-02-12T16:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: high-speed single-producer/consumer queue impl</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995670#M6350</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;An atomic operations api has been added to AppCore.&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Feb 2005 21:29:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995670#M6350</guid>
      <dc:creator>Chris_M__Thomasson</dc:creator>
      <dc:date>2005-02-21T21:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: high-speed single-producer/consumer queue impl</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995671#M6351</link>
      <description>&lt;DIV align="left"&gt;There was a stupid memory leak wrt tls node cache due to a stupid cut&amp;amp;paste &lt;BR /&gt;error. It's fixed. Probably should redownload. The memory leak will cause &lt;BR /&gt;the simple malloc counter to assert saying there is a leak if you create a &lt;BR /&gt;tls for the main thread, cache some nodes, and call ac_shutdown(). The &lt;BR /&gt;posted test does not trip the leak because it doesn't create a tls for the &lt;BR /&gt;main thread.&lt;/DIV&gt;
&lt;DIV align="left"&gt;&lt;/DIV&gt;
&lt;DIV align="left"&gt;Sorry!&lt;/DIV&gt;</description>
      <pubDate>Tue, 22 Feb 2005 12:42:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995671#M6351</guid>
      <dc:creator>Chris_M__Thomasson</dc:creator>
      <dc:date>2005-02-22T12:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: high-speed single-producer/consumer queue impl</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995672#M6352</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Afull-blown hazard-pointer implementation was added to AppCore. There is also an eventcount, lock-free stack, and a rw-spinlock ( not Joes &lt;BR /&gt;algorithm ). I still need to tweak the memory barriers in the eventcount, &lt;BR /&gt;but since its for i686 everything should work fine. I am currently cleaning &lt;BR /&gt;up the site and adding some simple build instructions. I am planning to post &lt;BR /&gt;a MSVC workspace, Dev-Cpp project, and Anjuta project for Linux to make &lt;BR /&gt;AppCore super easy to build. IDE's are sort of nice in that respect. Any &lt;BR /&gt;questions or comments?&lt;/DIV&gt;</description>
      <pubDate>Tue, 15 Mar 2005 06:23:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995672#M6352</guid>
      <dc:creator>Chris_M__Thomasson</dc:creator>
      <dc:date>2005-03-15T06:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: high-speed single-producer/consumer queue impl</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995673#M6353</link>
      <description>&lt;DIV&gt;Updated the assembly files. Redownload.&lt;/DIV&gt;</description>
      <pubDate>Tue, 15 Mar 2005 09:17:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995673#M6353</guid>
      <dc:creator>Chris_M__Thomasson</dc:creator>
      <dc:date>2005-03-15T09:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: high-speed single-producer/consumer queue impl</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995674#M6354</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Lockfree -&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;I appreciate your posting links to your software and papers to educate the forum readers on lockfree methods. I've learned quite a bit.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Have you ever benchmarked or seen reports of performance for lockfree techniques (yours or others) to equivalent locking methods? I'm hoping you might have some "feel" or intuition (possibly backed up with some experience) that would give an idea of how valuable lockfree methods can be with regards to performance in threaded applications.&lt;EM&gt;&lt;/EM&gt;Is there any benefit for using (more complex) lockfree methods over standard locking?&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;--clay&lt;/DIV&gt;</description>
      <pubDate>Thu, 17 Mar 2005 06:16:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995674#M6354</guid>
      <dc:creator>ClayB</dc:creator>
      <dc:date>2005-03-17T06:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: high-speed single-producer/consumer queue impl</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995675#M6355</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;BLOCKQUOTE&gt;ClayB wrote:&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Lockfree -&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;I appreciate your posting links to your software and papers to educate the forum readers on lockfree methods. I've learned quite a bit.&lt;/DIV&gt;
&lt;DIV&gt;
&lt;HR /&gt;
&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;SPAN&gt;Youre welcome! :)&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;HR /&gt;
&lt;/DIV&gt;
&lt;DIV&gt;Have you ever benchmarked or seen reports of performance for lockfree techniques (yours or others) to equivalent locking methods?&lt;/DIV&gt;
&lt;DIV&gt;
&lt;HR /&gt;
&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;
&lt;P align="left"&gt;&lt;SPAN&gt;Yes. I havedoneawhole lotof testing.I am planning on posting some results andvarioustest applications so you can see for yourself. Some of the lock-based tests can end up taking so long tocomplete that you just ctrl-c the test case. Try to put a lock-based solution up against a lock-free single-producer/consumer queue... You should quickly see the major difference. The lock-based version will be using atomic operations for the mutex implementation, and also employ the kernel for contention. Thats a ton of unnecessary overhead. The lock-free version will use simple loads and stores /w some memory barriers and avoid the kernel completely. Its a lot more efficient...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P align="left"&gt;&lt;SPAN&gt;Also, try comparing a lock-based referencecounttoa lock-free reference count... The lock-based version dies. The lock itself requires at least two atomic operations for a lock-unlock cycle, plus it uses the kernel for contention. The lock-free version requires a single atomic operation to modify the count, and the kernel is totally avoided.&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;HR /&gt;
&lt;/DIV&gt;
&lt;DIV&gt;I'm hoping you might have some "feel" or intuition (possibly backed up with some experience) that would give an idea of how valuable lockfree methods can be with regards to performance in threaded applications.&lt;EM&gt;&lt;/EM&gt;Is there any benefit for using (more complex) lockfree methods over standard locking?&lt;/DIV&gt;
&lt;DIV&gt;
&lt;HR /&gt;
&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;
&lt;DIV&gt;&lt;SPAN&gt;
&lt;P&gt;&lt;SPAN&gt;Yes. Therecanbemany benefits.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. If one thread fails is means that another thread has made forward progress&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. Avoids lock convoy and priority inversion&lt;/SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. Can be immune to thread failures&lt;/SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. Some lock-free stuff can be used in a signal handler&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4. Fewer atomic ops than lock-based&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5. Avoids the kernel in user-space applications&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;6. Can allow for reads while there are concurrent writes in a shared collection&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Take a look at these threads:&lt;/SPAN&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;A href="http://groups.google.de/groups?group=comp.programming.threads&amp;amp;threadm=ec1c3924.0410171103.568fa38a%40posting.google.com" target="_blank"&gt;http://groups.google.de/groups?group=comp.programming.threads&amp;amp;threadm=ec1c3924.0410171103.568fa38a%40posting.google.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;A href="http://groups-beta.google.com/group/comp.programming.threads/msg/7e7834ca10f2613a" target="_blank"&gt;http://groups-beta.google.com/group/comp.programming.threads/msg/7e7834ca10f2613a&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;A href="http://groups-beta.google.com/group/comp.programming.threads/msg/6b2ccf76ba145c9c" target="_blank"&gt;&lt;/A&gt;&lt;A href="http://groups-beta.google.com/group/comp" target="_blank"&gt;http://groups-beta.google.com/group/comp&lt;/A&gt;.
programming.threads/msg/6b2ccf76ba145c9c&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;A href="http://groups-beta.google.com/group/comp.programming.threads/msg/da843ddf7e139098" target="_blank"&gt;http://groups-beta.google.com/group/comp.programming.threads/msg/da843ddf7e139098&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Does that help?&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 Mar 2005 20:14:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995675#M6355</guid>
      <dc:creator>Chris_M__Thomasson</dc:creator>
      <dc:date>2005-03-25T20:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: high-speed single-producer/consumer queue impl</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995676#M6356</link>
      <description>&lt;P&gt;During my last update to the web server, I screwed up the zip file by added &lt;BR /&gt;old assembly files. Its fixed now!&lt;/P&gt;
&lt;P&gt;Please re-download.&lt;/P&gt;
&lt;P&gt;Sorry!&lt;/P&gt;
&lt;P&gt;:O &lt;BR /&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;HR /&gt;
lockfree wrote:&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;
&lt;P&gt;&lt;SPAN&gt;Here are some snippets of code from my new library that implement a simple and efficient lock-free method for high-speed thread-to-thread communication. Its a simple single-producer/consumer queue algorithm implemented in i686 assembly. You can easily convert it into a multi-producer/consumer queue by protecting it with two &lt;SPAN&gt;separate&lt;/SPAN&gt;mutexs; one for the push function and one for the pop function. Unfortunately, adding mutexs gets rid of the lock-free nature of the queue and introduces the kernel. However, the setup allows for "concurrent pushes and pops" because youre using two mutexs to emulate a single producer/consumer environment. In other words a producer does not block a consumer and vise versa. Enjoy! ;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Any comments or questions?&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;HR /&gt;
&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 26 Mar 2005 03:50:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/high-speed-single-producer-consumer-queue-impl/m-p/995676#M6356</guid>
      <dc:creator>Chris_M__Thomasson</dc:creator>
      <dc:date>2005-03-26T03:50:39Z</dc:date>
    </item>
  </channel>
</rss>

