<?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 Threadpool with priority version 1.1 is here ... in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threadpool-with-priority-version-1-1-is-here/m-p/863612#M2570</link>
    <description>&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;II have forgot to tell you that i have added also the &lt;BR /&gt;following:&lt;/P&gt;
&lt;P&gt;You can now call any method with the execute() method, like this&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;execute(your method, parameter , priority);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;In Object Pascal it looks like this:&lt;/P&gt;
&lt;P&gt;TP.execute(myobj.myproc1,pointer(obj),NORMAL_PRIORITY);&lt;/P&gt;
&lt;P&gt;(look inside the zipfile i have included two demos:&lt;BR /&gt;test.pas, and ptestpool.pas - a Parallel program of Matrix &lt;BR /&gt;multiply by a vector that use SSE+ -&lt;/P&gt;
&lt;P&gt;Also, as i have promised, the workers threads now &lt;BR /&gt;enters in a wait state when there is no jobs in the queues , &lt;BR /&gt;- now it doesn't consume the CPU when there is no jobs in the queues - &lt;BR /&gt;hence, it's very efficient&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;And, as i have promised and as you have noticed, my threadpool&lt;BR /&gt;now use my lockfree ParallelQueue:&lt;BR /&gt;at &lt;A href="http://pages.videotron.com/aminer/parallelqueue/parallelqueue.htm"&gt;http://pages.videotron.com/aminer/parallelqueue/parallelqueue.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;for less contention and more efficiency...&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Sincerely&lt;BR /&gt;Amine Moulay Ramdane.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2010 04:40:53 GMT</pubDate>
    <dc:creator>aminer10</dc:creator>
    <dc:date>2010-03-24T04:40:53Z</dc:date>
    <item>
      <title>Threadpool with priority version 1.1 is here ...</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threadpool-with-priority-version-1-1-is-here/m-p/863611#M2569</link>
      <description>&lt;DIV class="fontsize2 cb mb" id="body"&gt;
&lt;DIV id="inbdy"&gt;&lt;A name="msg_ce51e7177da1e4c2"&gt;&lt;/A&gt;&lt;BR /&gt;Hello all, &lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Description:&lt;/P&gt;
&lt;P&gt;Lock-free threadpool with priority.&lt;/P&gt;
&lt;P&gt;The following have been added:&lt;/P&gt;
&lt;P&gt;- You can give the following priorities to jobs:&lt;/P&gt;
&lt;P&gt;LOW_PRIORITY &lt;BR /&gt;NORMAL_PRIORITY &lt;BR /&gt;HIGH_PRIORITY&lt;/P&gt;
&lt;P&gt;-- Lockfree ParallelQueue for less contention and more efficiency or &lt;BR /&gt;it can use lockfree_mpmc - flqueue that i have modified, enhanced and &lt;BR /&gt;improved... -&lt;/P&gt;
&lt;P&gt;- Work-stealing - for more efficiency -&lt;/P&gt;
&lt;P&gt;- Enters in a wait state when there no job in the queue, hence, it's &lt;BR /&gt;very efficient&lt;/P&gt;
&lt;P&gt;Look into define.inc there is many options:&lt;/P&gt;
&lt;P&gt;CPU32: for 32 bits architecture &lt;BR /&gt;MUTIPLE_PRODUCER: mutiple producer (threads) &lt;BR /&gt;SINGLE_PRODUCER: for a single producer (thread)&lt;/P&gt;
&lt;P&gt;Required switches: -Sd (Delphi mode) for FPC&lt;/P&gt;
&lt;P&gt;Please look at the examples test.pas and testpool.pas inside the &lt;BR /&gt;zip...&lt;/P&gt;
&lt;P&gt;Note: testpool.pas does require Delphi 5+, test.pas works with both &lt;BR /&gt;FreePascal and Delphi&lt;/P&gt;
&lt;P&gt;You can download Threadpool with priority version 1.1 from:&lt;/P&gt;
&lt;P&gt;&lt;A target="_blank" rel="nofollow" href="http://www.google.com/url?sa=D&amp;amp;q=http://pages.videotron.com/aminer/&amp;amp;usg=AFQjCNEc4XUK97itZ-yH6hly_HwgwpbUjg"&gt;http://pages.videotron.com/aminer/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Language: FPC Pascal v2.2.0+ / Delphi 5+: &lt;A target="_blank" rel="nofollow" href="http://www.google.com/url?sa=D&amp;amp;q=http://www.freepascal.org/&amp;amp;usg=AFQjCNHOcnTp_XQ7n1ilPCMCbPNzoqhDEQ"&gt;http://www.freepascal.org/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Operating Systems: Win , Linux and Mac (x86).&lt;/P&gt;
&lt;P&gt;Threadpool is *VERY* easy to use, here is an example:&lt;/P&gt;
&lt;P&gt;-----------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;program test;&lt;/P&gt;
&lt;P&gt;uses &lt;BR /&gt;{$IFDEF Delphi} &lt;BR /&gt;cmem, &lt;BR /&gt;{$ENDIF} &lt;BR /&gt;PThreadPool,sysutils,syncobjs;&lt;/P&gt;
&lt;P&gt;{$I defines.inc}&lt;/P&gt;
&lt;P&gt;type &lt;BR /&gt; TMyThread = class (TPThreadPoolThread) &lt;BR /&gt; //procedure ProcessRequest(obj: Pointer); override;&lt;/P&gt;
&lt;P&gt; procedure MyProc1(obj: Pointer); &lt;BR /&gt; procedure MyProc2(obj: Pointer);&lt;/P&gt;
&lt;P&gt;  end;&lt;/P&gt;
&lt;P&gt;var &lt;BR /&gt; myobj:TMyThread; &lt;BR /&gt; TP: TPThreadPool; &lt;BR /&gt; obj:pointer; &lt;BR /&gt; cs:TCriticalSection;&lt;/P&gt;
&lt;P&gt;procedure TMyThread.MyProc1(obj: Pointer); &lt;BR /&gt;begin&lt;/P&gt;
&lt;P&gt;cs.enter; &lt;BR /&gt;writeln('This is MyProc1 with parameter: ',integer(obj)); &lt;BR /&gt;cs.leave;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;procedure TMyThread.MyProc2(obj: Pointer); &lt;BR /&gt;begin&lt;/P&gt;
&lt;P&gt;cs.enter; &lt;BR /&gt;writeln('This is MyProc2 with parameter: ',integer(obj)); &lt;BR /&gt;cs.leave;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;begin&lt;/P&gt;
&lt;P&gt;myobj:=TMyThread.create;&lt;/P&gt;
&lt;P&gt;cs:=TCriticalSection.create;&lt;/P&gt;
&lt;P&gt;TP := TPThreadPool.Create(4, 20, TMyThread); // 4 workers threads and &lt;BR /&gt;2^20 items for each queue.&lt;/P&gt;
&lt;P&gt;obj:=pointer(1); &lt;BR /&gt;TP.execute(myobj.myproc1,pointer(obj),NORMAL_PRIORITY);&lt;/P&gt;
&lt;P&gt;obj:=pointer(2); &lt;BR /&gt;TP.execute(myobj.myproc2,pointer(obj),NORMAL_PRIORITY);&lt;/P&gt;
&lt;P&gt;readln;&lt;/P&gt;
&lt;P&gt;TP.Terminate; &lt;BR /&gt;TP.Free;&lt;/P&gt;
&lt;P&gt;end.&lt;/P&gt;
&lt;P&gt;----------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Sincerely, &lt;BR /&gt;Amine Moulay Ramdane.&lt;/P&gt;
&lt;/DIV&gt;
&lt;BR clear="all" /&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Mar 2010 03:19:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threadpool-with-priority-version-1-1-is-here/m-p/863611#M2569</guid>
      <dc:creator>aminer10</dc:creator>
      <dc:date>2010-03-24T03:19:17Z</dc:date>
    </item>
    <item>
      <title>Threadpool with priority version 1.1 is here ...</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threadpool-with-priority-version-1-1-is-here/m-p/863612#M2570</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;II have forgot to tell you that i have added also the &lt;BR /&gt;following:&lt;/P&gt;
&lt;P&gt;You can now call any method with the execute() method, like this&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;execute(your method, parameter , priority);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;In Object Pascal it looks like this:&lt;/P&gt;
&lt;P&gt;TP.execute(myobj.myproc1,pointer(obj),NORMAL_PRIORITY);&lt;/P&gt;
&lt;P&gt;(look inside the zipfile i have included two demos:&lt;BR /&gt;test.pas, and ptestpool.pas - a Parallel program of Matrix &lt;BR /&gt;multiply by a vector that use SSE+ -&lt;/P&gt;
&lt;P&gt;Also, as i have promised, the workers threads now &lt;BR /&gt;enters in a wait state when there is no jobs in the queues , &lt;BR /&gt;- now it doesn't consume the CPU when there is no jobs in the queues - &lt;BR /&gt;hence, it's very efficient&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;And, as i have promised and as you have noticed, my threadpool&lt;BR /&gt;now use my lockfree ParallelQueue:&lt;BR /&gt;at &lt;A href="http://pages.videotron.com/aminer/parallelqueue/parallelqueue.htm"&gt;http://pages.videotron.com/aminer/parallelqueue/parallelqueue.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;for less contention and more efficiency...&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Sincerely&lt;BR /&gt;Amine Moulay Ramdane.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2010 04:40:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threadpool-with-priority-version-1-1-is-here/m-p/863612#M2570</guid>
      <dc:creator>aminer10</dc:creator>
      <dc:date>2010-03-24T04:40:53Z</dc:date>
    </item>
  </channel>
</rss>

