<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-2681</id>
	<title>Nabble - JSR166 Concurrency</title>
	<updated>2009-12-10T05:55:31Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/JSR166-Concurrency-f2681.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/JSR166-Concurrency-f2681.html" />
	<subtitle type="html">&lt;a href=&quot;http://gee.cs.oswego.edu/dl/concurrency-interest/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;JSR 166 Concurrency Utilities&lt;/a&gt;: The JSR (Java Specification Requests) proposes a set of medium-level utilities that provide functionality commonly needed in concurrent programs.</subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26727787</id>
	<title>Re: out of order execution on uniprocessor</title>
	<published>2009-12-10T05:55:31Z</published>
	<updated>2009-12-10T05:55:31Z</updated>
	<author>
		<name>alarmnummer</name>
	</author>
	<content type="html">Some time ago I placed a blogpost about this topic:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://pveentjer.wordpress.com/2008/10/27/jmm-single-processor-can-also-suffer-from-visibility-problems/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://pveentjer.wordpress.com/2008/10/27/jmm-single-processor-can-also-suffer-from-visibility-problems/&lt;/a&gt;&lt;br&gt;&lt;br&gt;On Tue, Dec 8, 2009 at 7:37 PM, Boehm, Hans &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26727787&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hans.boehm@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; If you are writing Java code, it doesn't matter whether you're on a
&lt;br&gt;&amp;gt; uniprocessor.  The hardware generally won't visibly reorder memory accesses
&lt;br&gt;&amp;gt; on a uniprocessor, but the compiler still will.  And you'd be hard pressed
&lt;br&gt;&amp;gt; to tell the difference.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; If you are building a JVM, then it does matter.  Since the hardware doesn't
&lt;br&gt;&amp;gt; reorder, you can take some shortcuts.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Both of the excerpts below are correct, but they're targeting a different
&lt;br&gt;&amp;gt; audience.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hans
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; P.S. I do think there are a few statements in the cookbook that are in need
&lt;br&gt;&amp;gt; of an update.  The ppc and pa-risc situations are more complex than what's
&lt;br&gt;&amp;gt; stated there.  (The PA_RISC recipe works for actual hardware, but I think
&lt;br&gt;&amp;gt; the emulator on Itanium follows the rules inthe manual, which allow more
&lt;br&gt;&amp;gt; reordering.  For PPC, I think the recipes for sequentially consistent
&lt;br&gt;&amp;gt; operations in
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2745.html also&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2745.html also&lt;/a&gt;&lt;br&gt;&amp;gt; apply to Java volatiles and are more accurate.)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ________________________________
&lt;br&gt;&amp;gt; From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26727787&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;
&lt;br&gt;&amp;gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26727787&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;] On Behalf Of raghuram
&lt;br&gt;&amp;gt; nidagal
&lt;br&gt;&amp;gt; Sent: Tuesday, December 08, 2009 6:12 AM
&lt;br&gt;&amp;gt; To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26727787&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Subject: [concurrency-interest] out of order execution on uniprocessor
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt; Is &amp;quot;out of order execution&amp;quot; relevant in case of a single processor. I see
&lt;br&gt;&amp;gt; the following extracts relating to single processors. Would appreciate if
&lt;br&gt;&amp;gt; somebody could clarify
&lt;br&gt;&amp;gt; what can be expected in a single processor case.
&lt;br&gt;&amp;gt; Discussing this in terms of caches, it may sound as if these issues only
&lt;br&gt;&amp;gt; affect multiprocessor machines. However, the reordering effects can be
&lt;br&gt;&amp;gt; easily seen on a single processor. It is not possible, for example, for the
&lt;br&gt;&amp;gt; compiler to move your code before an acquire or after a release. When we say
&lt;br&gt;&amp;gt; that acquires and releases act on caches, we are using shorthand for a
&lt;br&gt;&amp;gt; number of possible effects.
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#reordering&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#reordering&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; If you are generating code that is guaranteed to only run on a uniprocessor,
&lt;br&gt;&amp;gt; then you can probably skip the rest of this section. Because uniprocessors
&lt;br&gt;&amp;gt; preserve apparent sequential consistency, you never need to issue barriers
&lt;br&gt;&amp;gt; unless object memory is somehow shared with asynchrononously accessible IO
&lt;br&gt;&amp;gt; memory. This might occur with specially mapped java.nio buffers, but
&lt;br&gt;&amp;gt; probably only in ways that affect internal JVM support code, not Java code.
&lt;br&gt;&amp;gt; Also, it is conceivable that some special barriers would be needed if
&lt;br&gt;&amp;gt; context switching doesn't entail sufficient synchronization.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://gee.cs.oswego.edu/dl/jmm/cookbook.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gee.cs.oswego.edu/dl/jmm/cookbook.html&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Concurrency-interest mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26727787&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26727787&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/out-of-order-execution-on-uniprocessor-tp26694614p26727787.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26698684</id>
	<title>Re: out of order execution on uniprocessor</title>
	<published>2009-12-08T10:37:36Z</published>
	<updated>2009-12-08T10:37:36Z</updated>
	<author>
		<name>Boehm, Hans</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;HTML&gt;&lt;HEAD&gt;
&lt;META content=&quot;text/html; charset=us-ascii&quot; http-equiv=Content-Type&gt;
&lt;META name=GENERATOR content=&quot;MSHTML 8.00.6001.18812&quot;&gt;&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;If you are writing Java code, it doesn't matter whether you're 
on a uniprocessor.&amp;nbsp; The hardware generally won't visibly reorder memory 
accesses on a uniprocessor, but the compiler still will.&amp;nbsp; And you'd be hard 
pressed to tell the difference.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;If you are building a JVM, then it does matter.&amp;nbsp; Since 
the hardware doesn't reorder, you can take some shortcuts.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;Both of the excerpts below are correct, but they're targeting 
a different audience.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;Hans&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=798382418-08122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;P.S. I do think there are a few statements in the cookbook 
that are in need of an update.&amp;nbsp; The ppc and pa-risc situations&amp;nbsp;are 
more complex than what's stated there.&amp;nbsp; (The PA_RISC recipe works for 
actual hardware, but I think the emulator on Itanium follows the rules inthe 
manual, which allow more reordering.&amp;nbsp; For PPC, I think the recipes for 
sequentially consistent operations in &lt;A href=&quot;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2745.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2745.html&lt;/A&gt;&amp;nbsp;also 
apply to Java volatiles and are more accurate.)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR&gt;
&lt;BLOCKQUOTE style=&quot;BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px&quot; dir=ltr&gt;
  &lt;DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left&gt;
  &lt;HR tabIndex=-1&gt;
  &lt;FONT size=2 face=Tahoma&gt;&lt;B&gt;From:&lt;/B&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26698684&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt; 
  [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26698684&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;] &lt;B&gt;On Behalf Of 
  &lt;/B&gt;raghuram nidagal&lt;BR&gt;&lt;B&gt;Sent:&lt;/B&gt; Tuesday, December 08, 2009 6:12 
  AM&lt;BR&gt;&lt;B&gt;To:&lt;/B&gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26698684&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;&lt;BR&gt;&lt;B&gt;Subject:&lt;/B&gt; 
  [concurrency-interest] out of order execution on 
  uniprocessor&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;
  &lt;DIV&gt;&lt;/DIV&gt;Hi, 
  &lt;DIV&gt;Is &quot;out of order execution&quot; relevant in case of a single processor. I see 
  the following extracts relating to single processors. Would appreciate if 
  somebody could clarify&amp;nbsp;&lt;/DIV&gt;
  &lt;DIV&gt;what can be expected in a single processor case.&lt;/DIV&gt;
  &lt;DIV&gt;&lt;BR&gt;&lt;/DIV&gt;
  &lt;DIV&gt;&lt;SPAN style=&quot;BORDER-COLLAPSE: collapse; FONT-FAMILY: arial, sans-serif; FONT-SIZE: 13px&quot; class=Apple-style-span&gt;
  &lt;DIV&gt;Discussing this in terms of caches, it may sound as if these issues only 
  affect multiprocessor machines. However, the reordering effects can be easily 
  seen on a single processor. It is not possible, for example, for the compiler 
  to move your code before an acquire or after a release. When we say that 
  acquires and releases act on caches, we are using shorthand for a number of 
  possible effects.&lt;BR&gt;&lt;A style=&quot;COLOR: rgb(42,93,176)&quot; href=&quot;http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#reordering&quot; target=_blank rel=&quot;nofollow&quot;&gt;http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#reordering&lt;/A&gt;&lt;/DIV&gt;
  &lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
  &lt;DIV&gt;&lt;BR&gt;If you are generating code that is guaranteed to only run on a 
  uniprocessor, then you can probably skip the rest of this section. Because 
  uniprocessors preserve apparent sequential consistency, you never need to 
  issue barriers unless object memory is somehow shared with asynchrononously 
  accessible IO memory. This might occur with specially mapped java.nio buffers, 
  but probably only in ways that affect internal JVM support code, not Java 
  code. Also, it is conceivable that some special barriers would be needed if 
  context switching doesn't entail sufficient synchronization.&lt;/DIV&gt;
  &lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
  &lt;DIV&gt;&lt;A style=&quot;COLOR: rgb(42,93,176)&quot; href=&quot;http://gee.cs.oswego.edu/dl/jmm/cookbook.html&quot; target=_blank rel=&quot;nofollow&quot;&gt;http://gee.cs.oswego.edu/dl/jmm/cookbook.html&lt;/A&gt;&lt;/DIV&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26698684&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/out-of-order-execution-on-uniprocessor-tp26694614p26698684.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26694614</id>
	<title>out of order execution on uniprocessor</title>
	<published>2009-12-08T06:12:14Z</published>
	<updated>2009-12-08T06:12:14Z</updated>
	<author>
		<name>raghuram nidagal</name>
	</author>
	<content type="html">Hi,
&lt;div&gt;Is &amp;quot;out of order execution&amp;quot; relevant in case of a single processor. I see the following extracts relating to single processors. Would appreciate if somebody could clarify &lt;/div&gt;&lt;div&gt;what can be expected in a single processor case.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; &quot;&gt;&lt;div&gt;Discussing this in terms of caches, it may sound as if these issues only affect multiprocessor machines. However, the reordering effects can be easily seen on a single processor. It is not possible, for example, for the compiler to move your code before an acquire or after a release. When we say that acquires and releases act on caches, we are using shorthand for a number of possible effects.&lt;br&gt;
&lt;a href=&quot;http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#reordering&quot; target=&quot;_blank&quot; style=&quot;color: rgb(42, 93, 176); &quot; rel=&quot;nofollow&quot;&gt;http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#reordering&lt;/a&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;br&gt;If you are generating code that is guaranteed to only run on a uniprocessor, then you can probably skip the rest of this section. Because uniprocessors preserve apparent sequential consistency, you never need to issue barriers unless object memory is somehow shared with asynchrononously accessible IO memory. This might occur with specially mapped java.nio buffers, but probably only in ways that affect internal JVM support code, not Java code. Also, it is conceivable that some special barriers would be needed if context switching doesn&amp;#39;t entail sufficient synchronization.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://gee.cs.oswego.edu/dl/jmm/cookbook.html&quot; target=&quot;_blank&quot; style=&quot;color: rgb(42, 93, 176); &quot; rel=&quot;nofollow&quot;&gt;http://gee.cs.oswego.edu/dl/jmm/cookbook.html&lt;/a&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26694614&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/out-of-order-execution-on-uniprocessor-tp26694614p26694614.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26672076</id>
	<title>Re: Seeking Interruption Rule Clarification</title>
	<published>2009-12-06T19:23:35Z</published>
	<updated>2009-12-06T19:23:35Z</updated>
	<author>
		<name>David Holmes-6</name>
	</author>
	<content type="html">Will,
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; But it gets even more complicated, because we could also have the
&lt;br&gt;&amp;gt; following actual execution sequence (ie, assume that this is the
&lt;br&gt;&amp;gt; &amp;quot;real&amp;quot; global execution sequence, after any reorderings) between
&lt;br&gt;&amp;gt; just 2 threads, T1 and T3:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 1) T3 has just called Thread.sleep(10000)
&lt;br&gt;&amp;gt; 2) 2 secs later, T1 calls T3.interrupt().
&lt;br&gt;&amp;gt; 3) 2 secs later, T1 executes the statement &amp;quot;x = 5&amp;quot; (stores a
&lt;br&gt;&amp;gt; value into a mutable shared var)
&lt;br&gt;&amp;gt; 4) 2 secs later, T1 again calls T3.interrupt()
&lt;br&gt;&amp;gt; 5) Now T3's Thread.sleep(10000) call (from step #1) returns, and
&lt;br&gt;&amp;gt; T3 calls T3.interrupted() and detects the interrupt.
&lt;br&gt;&amp;gt; 6) T3 performs a read on var x
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; In this case, the same thread T1 made 2 calls to T3.interrupt()
&lt;br&gt;&amp;gt; (in steps #2 &amp; #4), but only the call from step #2 is the one
&lt;br&gt;&amp;gt; that caused the actual state change to T3's interrupt flag, so
&lt;br&gt;&amp;gt; supposedly this is the only state change that T3 &amp;quot;detected&amp;quot;. Does
&lt;br&gt;&amp;gt; that mean that there's only a HB left edge from the execution of
&lt;br&gt;&amp;gt; T1's first T3.interrupt() call rather than from T1's second
&lt;br&gt;&amp;gt; T3.interrupt() call? If that's true, then it seems that there can
&lt;br&gt;&amp;gt; be no (transitive) HB edge between the write of var x in T1 and
&lt;br&gt;&amp;gt; the read of var x in T3, in which case the value &amp;quot;5&amp;quot; might not be
&lt;br&gt;&amp;gt; visible to T3's read, right?
&lt;/div&gt;&lt;br&gt;Maybe. The problem is that JMM rule is really only considering the case
&lt;br&gt;where the actual interrupt state changes. In the scenario given the second
&lt;br&gt;interrupt call might be implemented as a no-op if the system can see that
&lt;br&gt;the target is already in the interrupted state. In practice on Hotspot it
&lt;br&gt;isn't a complete no-op so you're in fact likely to get the necessary memory
&lt;br&gt;synchronization to see the value &amp;quot;5&amp;quot;.
&lt;br&gt;&lt;br&gt;The JMM would have to specify the interaction here in a lot more detail to
&lt;br&gt;be able to reason in the abstract about what is guaranteed in this case.
&lt;br&gt;Even treating the interrupted state as a volatile does not specify it
&lt;br&gt;precisely enough as you need to know if interrupt() is required to always
&lt;br&gt;write to the volatile or can elide it if it sees the thread is already
&lt;br&gt;interrupted.
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;David Holmes
&lt;br&gt;&lt;br&gt;&amp;gt; Thank you. I appreciate your help in clarifying.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Cheers,
&lt;br&gt;&amp;gt; Will
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26672076&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Seeking-Interruption-Rule-Clarification-tp26647957p26672076.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26653550</id>
	<title>Re: Task Queue ordering</title>
	<published>2009-12-04T23:25:42Z</published>
	<updated>2009-12-04T23:25:42Z</updated>
	<author>
		<name>Joe Bowbeer</name>
	</author>
	<content type="html">Ken,&lt;br&gt;&lt;br&gt;I&amp;#39;m imagining a serial executor per client:&lt;br&gt;&lt;br&gt;ExecutorService pool = Executors.newCachedThreadPool();&lt;br&gt;&lt;br&gt;Executor execA = new SerialExecutor(pool);&lt;br&gt;
Executor execB = new SerialExecutor(pool);&lt;br&gt;
&lt;br&gt;SerialTask task1 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);&lt;br&gt;
SerialTask task2 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);&lt;br&gt;
SerialTask task3 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);&lt;br&gt;
SerialTask task4 = new SerialTask(&amp;quot;client-b&amp;quot;, 2000);&lt;br&gt;
SerialTask task5 = new SerialTask(&amp;quot;client-b&amp;quot;, 4000);&lt;br&gt;
SerialTask task6 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);&lt;br&gt;
&lt;br&gt;execA.execute(task1);&lt;br&gt;
execA.execute(task2);&lt;br&gt;
execA.execute(task3);&lt;br&gt;
execB.execute(task4);&lt;br&gt;
execB.execute(task5);&lt;br&gt;
execA.execute(task6);&lt;br&gt;
&lt;br&gt;--Joe&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Dec 4, 2009 at 9:51 PM, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26653550&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Ken--@...&lt;/a&gt; &lt;span dir=&quot;ltr&quot;&gt;&lt;/span&gt;wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;br&gt;
Dear Joe,&lt;br&gt;
&lt;br&gt;
Sorry I cannot under how to achieve it. I have tasks to be submitted in&lt;br&gt;
order (task1 to task6) like this:&lt;br&gt;
&lt;br&gt;
public class SerialTask implements Runnable {&lt;br&gt;
    private String client = null;&lt;br&gt;
    private long sleep = 0;&lt;br&gt;
    public SerialTask(String client, long sleep){&lt;br&gt;
        this.client = client;&lt;br&gt;
        this.sleep = sleep;&lt;br&gt;
    }&lt;br&gt;
    public void run() {&lt;br&gt;
        try {Thread.sleep(sleep);} catch (Exception e) {}&lt;br&gt;
        String msg = &amp;quot;Task ID = &amp;quot; + client + &amp;quot;, sleep = &amp;quot; + sleep;&lt;br&gt;
        System.out.println(msg);&lt;br&gt;
    }&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
SerialTask task1 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);&lt;br&gt;
SerialTask task2 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);&lt;br&gt;
SerialTask task3 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);&lt;br&gt;
SerialTask task4 = new SerialTask(&amp;quot;client-b&amp;quot;, 2000);&lt;br&gt;
SerialTask task5 = new SerialTask(&amp;quot;client-b&amp;quot;, 4000);&lt;br&gt;
SerialTask task6 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);&lt;br&gt;
&lt;br&gt;
How can I make use of SerialExecutor to execute client&amp;#39;s task in order? I&lt;br&gt;
expected client-a&amp;#39;s tasks can be finished in 40 mills and tasks are run in&lt;br&gt;
serial. and after around (2000 + 4000 - 40) mills, all client-b tasks are&lt;br&gt;
finished.&lt;br&gt;
&lt;br&gt;
Regards,&lt;br&gt;
Ken&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Joe Bowbeer wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If each client&amp;#39;s tasks are executed sequentially, you can use a&lt;br&gt;
&amp;gt; SerialExecutor per client.  See the &amp;quot;SerialExecutor&amp;quot; example in the&lt;br&gt;
&amp;gt; Executor&lt;br&gt;
&amp;gt; javadoc.  Each client&amp;#39;s executor would delegate to the shared thread pool&lt;br&gt;
&amp;gt; executor.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If all tasks can execute in concurrently, but you want to retire them in&lt;br&gt;
&amp;gt; order, I think there was a useful discussion about this in June &amp;#39;08.&lt;br&gt;
&amp;gt; Search for &amp;quot;Out-of-order execution, in-order retirement&amp;quot;.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; (The suggestion was to queue the Futures when the Callables are submitted,&lt;br&gt;
&amp;gt; and retire the tasks in the order they were enqueued.)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; --Joe&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; On Wed, Dec 2, 2009 at 6:32 PM, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26653550&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Ken--@...&lt;/a&gt; wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Hi All,&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; I have a Task Queue (ArrayBlockingQueue) with single thread for client&amp;#39;s&lt;br&gt;
&amp;gt;&amp;gt; task processing. For same client, I  have to guarantee the ordering of&lt;br&gt;
&amp;gt;&amp;gt; task&lt;br&gt;
&amp;gt;&amp;gt; results as I need the result of previous task to perform next task of the&lt;br&gt;
&amp;gt;&amp;gt; same client. It&amp;#39;s work for ArrayBlockQueue with single thread as it&amp;#39;s&lt;br&gt;
&amp;gt;&amp;gt; always&lt;br&gt;
&amp;gt;&amp;gt; FIFO.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; My question is, how to enable multi threads (like ThreadPoolExecutor) for&lt;br&gt;
&amp;gt;&amp;gt; queue but maintaining the ordering of same client&amp;#39;s tasks? I tried&lt;br&gt;
&amp;gt;&amp;gt; PriorityBlockingQueue but it just ensure tasks are started in order.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Any solution? Please help.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Thanks and Best Regards,&lt;br&gt;
&amp;gt;&amp;gt; Ken&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26653550&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Task-Queue-ordering-tp26585945p26653550.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26653201</id>
	<title>Re: Task Queue ordering</title>
	<published>2009-12-04T21:51:22Z</published>
	<updated>2009-12-04T21:51:22Z</updated>
	<author>
		<name>Ken--@newsgroupstats.hk</name>
	</author>
	<content type="html">Dear Joe,
&lt;br&gt;&lt;br&gt;Sorry I cannot under how to achieve it. I have tasks to be submitted in order (task1 to task6) like this:
&lt;br&gt;&lt;br&gt;public class SerialTask implements Runnable {
&lt;br&gt;&amp;nbsp; &amp;nbsp; private String client = null;
&lt;br&gt;&amp;nbsp; &amp;nbsp; private long sleep = 0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; public SerialTask(String client, long sleep){
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.client = client;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.sleep = sleep;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; public void run() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try {Thread.sleep(sleep);} catch (Exception e) {}
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String msg = &amp;quot;Task ID = &amp;quot; + client + &amp;quot;, sleep = &amp;quot; + sleep;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(msg);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;SerialTask task1 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);
&lt;br&gt;SerialTask task2 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);
&lt;br&gt;SerialTask task3 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);
&lt;br&gt;SerialTask task4 = new SerialTask(&amp;quot;client-b&amp;quot;, 2000);
&lt;br&gt;SerialTask task5 = new SerialTask(&amp;quot;client-b&amp;quot;, 4000);
&lt;br&gt;SerialTask task6 = new SerialTask(&amp;quot;client-a&amp;quot;, 10);
&lt;br&gt;&lt;br&gt;How can I make use of SerialExecutor to execute client's task in order? I expected client-a's tasks can be finished in 40 mills and tasks are run in serial. and after around (2000 + 4000 - 40) mills, all client-b tasks are finished. 
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Ken
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Joe Bowbeer wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;If each client's tasks are executed sequentially, you can use a
&lt;br&gt;SerialExecutor per client. &amp;nbsp;See the &amp;quot;SerialExecutor&amp;quot; example in the Executor
&lt;br&gt;javadoc. &amp;nbsp;Each client's executor would delegate to the shared thread pool
&lt;br&gt;executor.
&lt;br&gt;&lt;br&gt;If all tasks can execute in concurrently, but you want to retire them in
&lt;br&gt;order, I think there was a useful discussion about this in June '08.
&lt;br&gt;Search for &amp;quot;Out-of-order execution, in-order retirement&amp;quot;.
&lt;br&gt;&lt;br&gt;(The suggestion was to queue the Futures when the Callables are submitted,
&lt;br&gt;and retire the tasks in the order they were enqueued.)
&lt;br&gt;&lt;br&gt;--Joe
&lt;br&gt;&lt;br&gt;On Wed, Dec 2, 2009 at 6:32 PM, Ken--@newsgroupstats.hk wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi All,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I have a Task Queue (ArrayBlockingQueue) with single thread for client's
&lt;br&gt;&amp;gt; task processing. For same client, I &amp;nbsp;have to guarantee the ordering of task
&lt;br&gt;&amp;gt; results as I need the result of previous task to perform next task of the
&lt;br&gt;&amp;gt; same client. It's work for ArrayBlockQueue with single thread as it's
&lt;br&gt;&amp;gt; always
&lt;br&gt;&amp;gt; FIFO.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; My question is, how to enable multi threads (like ThreadPoolExecutor) for
&lt;br&gt;&amp;gt; queue but maintaining the ordering of same client's tasks? I tried
&lt;br&gt;&amp;gt; PriorityBlockingQueue but it just ensure tasks are started in order.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Any solution? Please help.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks and Best Regards,
&lt;br&gt;&amp;gt; Ken
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;Concurrency-interest@cs.oswego.edu
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Task-Queue-ordering-tp26585945p26653201.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26649187</id>
	<title>Re: Seeking Interruption Rule Clarification</title>
	<published>2009-12-04T12:53:31Z</published>
	<updated>2009-12-04T12:53:31Z</updated>
	<author>
		<name>Boehm, Hans</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;HTML&gt;&lt;HEAD&gt;
&lt;META content=&quot;text/html; charset=us-ascii&quot; http-equiv=Content-Type&gt;
&lt;META name=GENERATOR content=&quot;MSHTML 8.00.6001.18812&quot;&gt;&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=990054020-04122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;If you believe that the volatile case is equivalent, then the 
second bullet under 17.4.4 (JLS 3rd edition, &lt;A href=&quot;http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4.4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4.4&lt;/A&gt;) 
makes it clear that any prior (in a total synchronization order) write of a 
volatile flag synchronizes with any later read of&amp;nbsp; the synchronization 
variable.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=990054020-04122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=990054020-04122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;In that case, both&amp;nbsp;happens before &amp;nbsp;edges inthe 
original question exist.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=990054020-04122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=990054020-04122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;I'm inclined to read the last bullet in that list as 
confirming this interpretation.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=990054020-04122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir=ltr align=left&gt;&lt;SPAN class=990054020-04122009&gt;&lt;FONT color=#0000ff size=2 face=Arial&gt;Hans&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR&gt;
&lt;BLOCKQUOTE style=&quot;BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px&quot; dir=ltr&gt;
  &lt;DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left&gt;
  &lt;HR tabIndex=-1&gt;
  &lt;FONT size=2 face=Tahoma&gt;&lt;B&gt;From:&lt;/B&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26649187&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt; 
  [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26649187&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;] &lt;B&gt;On Behalf Of &lt;/B&gt;Joe 
  Bowbeer&lt;BR&gt;&lt;B&gt;Sent:&lt;/B&gt; Friday, December 04, 2009 11:56 AM&lt;BR&gt;&lt;B&gt;To:&lt;/B&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26649187&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;&lt;BR&gt;&lt;B&gt;Subject:&lt;/B&gt; Re: 
  [concurrency-interest] Seeking Interruption Rule 
  Clarification&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;
  &lt;DIV&gt;&lt;/DIV&gt;I think you can reason effectively about this by replacing the 
  interrupted flag with a volatile boolean flag.&lt;BR&gt;&lt;BR&gt;T3: T3.flag = 
  false&lt;BR&gt;T1: T3.flag = true&lt;BR&gt;T2: T3.flag = true &lt;BR&gt;T3: if T3.flag then 
  ...&lt;BR&gt;&lt;BR&gt;The right answer, I think, is that the write to the volatile will 
  always &quot;happen&quot; (unless the compiler can deduce that a concurrent read will 
  never happen).&amp;nbsp; However, I'm not sure how or if the JMM specifies 
  this.&lt;BR&gt;&lt;BR&gt;--Joe&lt;BR&gt;&lt;BR&gt;
  &lt;DIV class=gmail_quote&gt;On Fri, Dec 4, 2009 at 11:22 AM, Will McQueen&lt;SPAN dir=ltr&gt;&lt;/SPAN&gt; wrote:&lt;BR&gt;
  &lt;BLOCKQUOTE style=&quot;BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex&quot; class=gmail_quote&gt;
    &lt;TABLE border=0 cellSpacing=0 cellPadding=0&gt;
      &lt;TBODY&gt;
      &lt;TR&gt;
        &lt;TD style=&quot;FONT-FAMILY: inherit; font-size-adjust: inherit; font-stretch: inherit&quot; vAlign=top&gt;Hi,&lt;BR&gt;&lt;BR&gt;On p341 of JCIP, the Interruption Rule 
          states:&lt;BR&gt;&quot;A thread calling&lt;SPAN style=&quot;FONT-STYLE: italic&quot;&gt; 
          interrupt &lt;/SPAN&gt;on another thread &lt;SPAN style=&quot;FONT-STYLE: italic&quot;&gt;happens-before &lt;/SPAN&gt;the interrupted 
          thread detects the interrupt (either by having &lt;SPAN style=&quot;TEXT-DECORATION: underline&quot;&gt;InterruptedException &lt;/SPAN&gt;thrown, 
          or invoking &lt;SPAN style=&quot;TEXT-DECORATION: underline&quot;&gt;isInterrupted 
          &lt;/SPAN&gt;or &lt;SPAN style=&quot;TEXT-DECORATION: underline&quot;&gt;interrupted&lt;/SPAN&gt;)&quot;&lt;BR&gt;&lt;BR&gt;I'm a 
          little unclear on the specifics. Suppose that we 
          have:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Threads T1, T2, and T3 are alive and 
          the interrupt flag is clear. T3 is executing in a loop, where it does 
          Thread.sleep(10000) and then calls T3.interrupted() to check+clear the 
          flag status.&lt;BR&gt;&lt;BR&gt;And suppose that we have the following global 
          execution sequence:&lt;BR&gt;1) T3 has just called Thread.sleep(10000)&lt;BR&gt;2) 
          2 secs later, T1 calls T3.interrupt().&lt;BR&gt;3) Another 2 secs later, T2 
          calls T3.interrupt().&lt;BR&gt;4) Now T3's Thread.sleep(10000) call (from 
          step #1) returns, and T3 calls T3.interrupted() and detects the 
          interrupt.&lt;BR&gt;&lt;BR&gt;In this case which of the following statements can 
          we claim as true?&lt;BR&gt;1) There's a HB edge from T1's T3.interrupt() 
          call to T3's T3.interrupt() call.&lt;BR&gt;2) There's a HB edge from T2's 
          T3.interrupt() call to T3's T3.interrupt() call.&lt;BR&gt;&lt;BR&gt;I would guess 
          that we can only claim #1, because T1 is the thread that caused T3's 
          interrupt flag state to change state from false to true. T2's call to 
          T3.interrupt() did not cause a state change to T3's interrupt flag 
          because it was already true before T2 called T3.interrupt(). My 
          assumption can be summed-up as:&lt;BR&gt;&lt;BR&gt;&quot;The Interruption Rule results 
          in a HB edge from T1's T3.interrupt() call to T3's T3.interrupted() 
          call, only if T1 was the thread responsible for the state change to 
          T3's interrupt flag&quot;.&lt;BR&gt;&lt;BR&gt;But it gets even more complicated, 
          because we could also have the following actual execution sequence 
          (ie, assume that this is the &quot;real&quot; global execution sequence, after 
          any reorderings) between just 2 threads, T1 and T3:&lt;BR&gt;&lt;BR&gt;1) T3 has 
          just called Thread.sleep(10000)&lt;BR&gt;2) 2 secs later, T1 calls 
          T3.interrupt().&lt;BR&gt;3) 2 secs later, T1 executes the statement &quot;x = 5&quot; 
          (stores a value into a mutable shared var)&lt;BR&gt;4) 2 secs later, T1 
          again calls T3.interrupt()&lt;BR&gt;5) Now T3's Thread.sleep(10000) call 
          (from step #1) returns, and T3 calls T3.interrupted() and detects the 
          interrupt.&lt;BR&gt;6) T3 performs a read on var x&lt;BR&gt;&lt;BR&gt;In this case, the 
          same thread T1 made 2 calls to T3.interrupt() (in steps #2 &amp;amp; #4), 
          but only the call from step #2 is the one that caused the actual state 
          change to T3's interrupt flag, so supposedly this is the only state 
          change that T3 &quot;detected&quot;. Does that mean that there's only a HB left 
          edge from the execution of T1's first T3.interrupt() call rather than 
          from T1's second T3.interrupt() call? If that's true, then it seems 
          that there can be no (transitive) HB edge between the write of var x 
          in T1 and the read of var x in T3, in which case the value &quot;5&quot; might 
          not be visible to T3's read, right?&lt;BR&gt;&lt;BR&gt;Thank you. I appreciate 
          your help in 
    clarifying.&lt;BR&gt;&lt;BR&gt;Cheers,&lt;BR&gt;Will&lt;BR&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26649187&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Seeking-Interruption-Rule-Clarification-tp26647957p26649187.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26648434</id>
	<title>Re: Seeking Interruption Rule Clarification</title>
	<published>2009-12-04T11:56:22Z</published>
	<updated>2009-12-04T11:56:22Z</updated>
	<author>
		<name>Joe Bowbeer</name>
	</author>
	<content type="html">I think you can reason effectively about this by replacing the interrupted flag with a volatile boolean flag.&lt;br&gt;&lt;br&gt;T3: T3.flag = false&lt;br&gt;T1: T3.flag = true&lt;br&gt;T2: T3.flag = true &lt;br&gt;T3: if T3.flag then ...&lt;br&gt;&lt;br&gt;The right answer, I think, is that the write to the volatile will always &amp;quot;happen&amp;quot; (unless the compiler can deduce that a concurrent read will never happen).  However, I&amp;#39;m not sure how or if the JMM specifies this.&lt;br&gt;
&lt;br&gt;--Joe&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Dec 4, 2009 at 11:22 AM, Will McQueen&lt;span dir=&quot;ltr&quot;&gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;&quot; valign=&quot;top&quot;&gt;
Hi,&lt;br&gt;&lt;br&gt;On p341 of JCIP, the Interruption Rule states:&lt;br&gt;&amp;quot;A thread calling&lt;span style=&quot;font-style: italic;&quot;&gt; interrupt &lt;/span&gt;on another thread &lt;span style=&quot;font-style: italic;&quot;&gt;happens-before &lt;/span&gt;the interrupted thread detects the interrupt (either by having &lt;span style=&quot;text-decoration: underline;&quot;&gt;InterruptedException &lt;/span&gt;thrown, or invoking &lt;span style=&quot;text-decoration: underline;&quot;&gt;isInterrupted &lt;/span&gt;or &lt;span style=&quot;text-decoration: underline;&quot;&gt;interrupted&lt;/span&gt;)&amp;quot;&lt;br&gt;
&lt;br&gt;I&amp;#39;m a little unclear on the specifics. Suppose that we have:&lt;br&gt;     Threads T1, T2, and T3 are alive and the interrupt flag is clear. T3 is executing in a loop, where it does Thread.sleep(10000) and then calls T3.interrupted() to check+clear the flag status.&lt;br&gt;
&lt;br&gt;And suppose that we have the following global execution sequence:&lt;br&gt;1) T3 has just called
 Thread.sleep(10000)&lt;br&gt;2) 2 secs later, T1 calls T3.interrupt().&lt;br&gt;3) Another 2 secs later, T2 calls T3.interrupt().&lt;br&gt;4) Now T3&amp;#39;s Thread.sleep(10000) call (from step #1) returns, and T3 calls T3.interrupted() and detects the interrupt.&lt;br&gt;
&lt;br&gt;In this case which of the following statements can we claim as true?&lt;br&gt;1) There&amp;#39;s a HB edge from T1&amp;#39;s T3.interrupt() call to T3&amp;#39;s T3.interrupt() call.&lt;br&gt;2) There&amp;#39;s a HB edge from T2&amp;#39;s T3.interrupt() call to T3&amp;#39;s T3.interrupt() call.&lt;br&gt;
&lt;br&gt;I would guess that we can only claim #1, because T1 is the thread that caused T3&amp;#39;s interrupt flag state to change state from false to true. T2&amp;#39;s call to T3.interrupt() did not cause a state change to T3&amp;#39;s interrupt flag because it was already true before T2 called T3.interrupt(). My assumption can be summed-up as:&lt;br&gt;
&lt;br&gt;&amp;quot;The Interruption Rule results in a HB edge from T1&amp;#39;s T3.interrupt() call to T3&amp;#39;s T3.interrupted() call, only if T1 was the thread responsible for the state
 change to T3&amp;#39;s interrupt flag&amp;quot;.&lt;br&gt;&lt;br&gt;But it gets even more complicated, because we could also have the following actual execution sequence (ie, assume that this is the &amp;quot;real&amp;quot; global execution sequence, after any reorderings) between just 2 threads, T1 and T3:&lt;br&gt;
&lt;br&gt;1) T3 has just called Thread.sleep(10000)&lt;br&gt;
2) 2 secs later, T1 calls T3.interrupt().&lt;br&gt;3) 2 secs later, T1 executes the statement &amp;quot;x = 5&amp;quot; (stores a value into a mutable shared var)&lt;br&gt;
4) 2 secs later, T1 again calls T3.interrupt()&lt;br&gt;
5) Now T3&amp;#39;s Thread.sleep(10000) call (from step #1) returns, and T3 calls T3.interrupted() and detects the interrupt.&lt;br&gt;6) T3 performs a read on var x&lt;br&gt;&lt;br&gt;In this case, the same thread T1 made 2 calls to T3.interrupt() (in steps #2 &amp;amp; #4), but only the call from step #2 is the one that caused the actual state change to T3&amp;#39;s interrupt flag, so supposedly this is the only state change that T3 &amp;quot;detected&amp;quot;. Does that mean that there&amp;#39;s only a HB left edge from the execution of T1&amp;#39;s first T3.interrupt() call rather than from T1&amp;#39;s second T3.interrupt() call? If that&amp;#39;s true, then it seems that there can be no (transitive) HB edge between the write of var x in T1 and the read of var x in T3, in which case the value &amp;quot;5&amp;quot; might not be visible to T3&amp;#39;s read, right?&lt;br&gt;
&lt;br&gt;Thank you. I appreciate your help in clarifying.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;Will&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26648434&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Seeking-Interruption-Rule-Clarification-tp26647957p26648434.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26647957</id>
	<title>Seeking Interruption Rule Clarification</title>
	<published>2009-12-04T11:22:48Z</published>
	<updated>2009-12-04T11:22:48Z</updated>
	<author>
		<name>Will McQueen</name>
	</author>
	<content type="html">&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot; style=&quot;font: inherit;&quot;&gt;Hi,&lt;br&gt;&lt;br&gt;On p341 of JCIP, the Interruption Rule states:&lt;br&gt;&quot;A thread calling&lt;span style=&quot;font-style: italic;&quot;&gt; interrupt &lt;/span&gt;on another thread &lt;span style=&quot;font-style: italic;&quot;&gt;happens-before &lt;/span&gt;the interrupted thread detects the interrupt (either by having &lt;span style=&quot;text-decoration: underline;&quot;&gt;InterruptedException &lt;/span&gt;thrown, or invoking &lt;span style=&quot;text-decoration: underline;&quot;&gt;isInterrupted &lt;/span&gt;or &lt;span style=&quot;text-decoration: underline;&quot;&gt;interrupted&lt;/span&gt;)&quot;&lt;br&gt;&lt;br&gt;I'm a little unclear on the specifics. Suppose that we have:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Threads T1, T2, and T3 are alive and the interrupt flag is clear. T3 is executing in a loop, where it does Thread.sleep(10000) and then calls T3.interrupted() to check+clear the flag status.&lt;br&gt;&lt;br&gt;And suppose that we have the following global execution sequence:&lt;br&gt;1) T3 has just called
 Thread.sleep(10000)&lt;br&gt;2) 2 secs later, T1 calls T3.interrupt().&lt;br&gt;3) Another 2 secs later, T2 calls T3.interrupt().&lt;br&gt;4) Now T3's Thread.sleep(10000) call (from step #1) returns, and T3 calls T3.interrupted() and detects the interrupt.&lt;br&gt;&lt;br&gt;In this case which of the following statements can we claim as true?&lt;br&gt;1) There's a HB edge from T1's T3.interrupt() call to T3's T3.interrupt() call.&lt;br&gt;2) There's a HB edge from T2's T3.interrupt() call to T3's T3.interrupt() call.&lt;br&gt;&lt;br&gt;I would guess that we can only claim #1, because T1 is the thread that caused T3's interrupt flag state to change state from false to true. T2's call to T3.interrupt() did not cause a state change to T3's interrupt flag because it was already true before T2 called T3.interrupt(). My assumption can be summed-up as:&lt;br&gt;&lt;br&gt;&quot;The Interruption Rule results in a HB edge from T1's T3.interrupt() call to T3's T3.interrupted() call, only if T1 was the thread responsible for the state
 change to T3's interrupt flag&quot;.&lt;br&gt;&lt;br&gt;But it gets even more complicated, because we could also have the following actual execution sequence (ie, assume that this is the &quot;real&quot; global execution sequence, after any reorderings) between just 2 threads, T1 and T3:&lt;br&gt;&lt;br&gt;1) T3 has just called Thread.sleep(10000)&lt;br&gt;
2) 2 secs later, T1 calls T3.interrupt().&lt;br&gt;3) 2 secs later, T1 executes the statement &quot;x = 5&quot; (stores a value into a mutable shared var)&lt;br&gt;
4) 2 secs later, T1 again calls T3.interrupt()&lt;br&gt;
5) Now T3's Thread.sleep(10000) call (from step #1) returns, and T3 calls T3.interrupted() and detects the interrupt.&lt;br&gt;6) T3 performs a read on var x&lt;br&gt;&lt;br&gt;In this case, the same thread T1 made 2 calls to T3.interrupt() (in steps #2 &amp;amp; #4), but only the call from step #2 is the one that caused the actual state change to T3's interrupt flag, so supposedly this is the only state change that T3 &quot;detected&quot;. Does that mean that there's only a HB left edge from the execution of T1's first T3.interrupt() call rather than from T1's second T3.interrupt() call? If that's true, then it seems that there can be no (transitive) HB edge between the write of var x in T1 and the read of var x in T3, in which case the value &quot;5&quot; might not be visible to T3's read, right?&lt;br&gt;&lt;br&gt;Thank you. I appreciate your help in clarifying.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;Will&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;

&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26647957&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Seeking-Interruption-Rule-Clarification-tp26647957p26647957.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26634577</id>
	<title>Gaurav Kant Tyagi is out of the office.</title>
	<published>2009-12-03T14:31:16Z</published>
	<updated>2009-12-03T14:31:16Z</updated>
	<author>
		<name>Gaurav Kant Tyagi</name>
	</author>
	<content type="html">I will be out of the office starting &amp;nbsp;11/27/2009 and will not return until
&lt;br&gt;12/07/2009.
&lt;br&gt;&lt;br&gt;I will respond to your message when I return.
&lt;br&gt;&lt;br&gt;CST coverage: Yogesh Kulkarni is my back-up for any project related
&lt;br&gt;request.
&lt;br&gt;IST coverage: Ashish Birla will be my back up for project related
&lt;br&gt;activities.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26634577&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Gaurav-Kant-Tyagi-is-out-of-the-office.-tp26634577p26634577.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26620498</id>
	<title>Re: Task Queue ordering</title>
	<published>2009-12-02T19:16:30Z</published>
	<updated>2009-12-02T19:16:30Z</updated>
	<author>
		<name>Joe Bowbeer</name>
	</author>
	<content type="html">If each client&amp;#39;s tasks are executed sequentially, you can use a
SerialExecutor per client.  See the &amp;quot;SerialExecutor&amp;quot; example in the
Executor javadoc.  Each client&amp;#39;s executor would delegate to the shared
thread pool executor.&lt;br&gt;&lt;br&gt;If all tasks can execute in concurrently, but you want to retire them in order, I think there was a useful discussion about this in June &amp;#39;08.  
Search for &amp;quot;Out-of-order execution, in-order retirement&amp;quot;.&lt;br&gt;
&lt;br&gt;(The suggestion was to queue the Futures when the Callables are submitted, and retire the tasks in the order they were enqueued.)&lt;br&gt;
&lt;br&gt;--Joe&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Dec 2, 2009 at 6:32 PM, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620498&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Ken--@...&lt;/a&gt; &lt;span dir=&quot;ltr&quot;&gt;&lt;/span&gt;wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;br&gt;
Hi All,&lt;br&gt;
&lt;br&gt;
I have a Task Queue (ArrayBlockingQueue) with single thread for client&amp;#39;s&lt;br&gt;
task processing. For same client, I  have to guarantee the ordering of task&lt;br&gt;
results as I need the result of previous task to perform next task of the&lt;br&gt;
same client. It&amp;#39;s work for ArrayBlockQueue with single thread as it&amp;#39;s always&lt;br&gt;
FIFO.&lt;br&gt;
&lt;br&gt;
My question is, how to enable multi threads (like ThreadPoolExecutor) for&lt;br&gt;
queue but maintaining the ordering of same client&amp;#39;s tasks? I tried&lt;br&gt;
PriorityBlockingQueue but it just ensure tasks are started in order.&lt;br&gt;
&lt;br&gt;
Any solution? Please help.&lt;br&gt;
&lt;br&gt;
Thanks and Best Regards,&lt;br&gt;
Ken&lt;br&gt;
&lt;br&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26620498&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Task-Queue-ordering-tp26585945p26620498.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26585945</id>
	<title>Task Queue ordering</title>
	<published>2009-11-30T19:23:47Z</published>
	<updated>2009-11-30T19:23:47Z</updated>
	<author>
		<name>Ken--@newsgroupstats.hk</name>
	</author>
	<content type="html">Hi All,
&lt;br&gt;&lt;br&gt;I have a Task Queue (ArrayBlockingQueue) with single thread for client's task processing. For same client, I &amp;nbsp;have to guarantee the ordering of task results as I need the result of previous task to perform next task of the same client. It's work for ArrayBlockQueue with single thread as it's always FIFO.
&lt;br&gt;&lt;br&gt;My question is, how to enable multi threads (like ThreadPoolExecutor) for queue but maintaining the ordering of same client's tasks? I tried PriorityBlockingQueue but it just ensure tasks are started in order.
&lt;br&gt;&lt;br&gt;Any solution? Please help.
&lt;br&gt;&lt;br&gt;Thanks and Best Regards,
&lt;br&gt;Ken
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Task-Queue-ordering-tp26585945p26585945.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26473101</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T21:28:58Z</published>
	<updated>2009-11-22T21:28:58Z</updated>
	<author>
		<name>martinrb</name>
	</author>
	<content type="html">On Sun, Nov 22, 2009 at 20:25, Norman Elton &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26473101&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;normelton@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; Suppose
&lt;br&gt;&amp;gt;&amp;gt; thread 1 is trying to set k -&amp;gt; v1
&lt;br&gt;&amp;gt;&amp;gt; while
&lt;br&gt;&amp;gt;&amp;gt; thread 2 is trying to set k -&amp;gt; v2
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Because the updates of the two maps are independent,
&lt;br&gt;&amp;gt;&amp;gt; and you can't control the scheduler, there is a risk of
&lt;br&gt;&amp;gt;&amp;gt; ending up with
&lt;br&gt;&amp;gt;&amp;gt; k -&amp;gt; v1
&lt;br&gt;&amp;gt;&amp;gt; in the first map, and
&lt;br&gt;&amp;gt;&amp;gt; v2 -&amp;gt; k
&lt;br&gt;&amp;gt;&amp;gt; in the reverse map
&lt;br&gt;&amp;gt;&amp;gt; in the quiescent state.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I've synchronized the put() methods in both directions back to a
&lt;br&gt;&amp;gt; single lock object, so one thread would block while the other
&lt;br&gt;&amp;gt; completes its update. Correct me if I'm wrong, this is definitely my
&lt;br&gt;&amp;gt; knowledge of the inner workings synchronization starts to get fuzzy.
&lt;/div&gt;&lt;br&gt;OK, I think you're mostly fine.
&lt;br&gt;An observer might be able to see an &amp;quot;impossible&amp;quot;
&lt;br&gt;sequence, but users are unlikely to care.
&lt;br&gt;&lt;br&gt;E.g. Perhaps it's an invariant that some key is
&lt;br&gt;only ever modified by having its value incremented,
&lt;br&gt;perhaps by calls to replace(key, value, value+1).
&lt;br&gt;but another thread can observe apparent violations
&lt;br&gt;of monotonicity
&lt;br&gt;k -&amp;gt; 0
&lt;br&gt;k -&amp;gt; 1
&lt;br&gt;reverse map 0 -&amp;gt; k
&lt;br&gt;&lt;br&gt;Martin
&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26473101&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26473101.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26472705</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T20:25:50Z</published>
	<updated>2009-11-22T20:25:50Z</updated>
	<author>
		<name>Norman Elton</name>
	</author>
	<content type="html">&lt;div class='shrinkable-quote'&gt;&amp;gt; Suppose
&lt;br&gt;&amp;gt; thread 1 is trying to set k -&amp;gt; v1
&lt;br&gt;&amp;gt; while
&lt;br&gt;&amp;gt; thread 2 is trying to set k -&amp;gt; v2
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Because the updates of the two maps are independent,
&lt;br&gt;&amp;gt; and you can't control the scheduler, there is a risk of
&lt;br&gt;&amp;gt; ending up with
&lt;br&gt;&amp;gt; k -&amp;gt; v1
&lt;br&gt;&amp;gt; in the first map, and
&lt;br&gt;&amp;gt; v2 -&amp;gt; k
&lt;br&gt;&amp;gt; in the reverse map
&lt;br&gt;&amp;gt; in the quiescent state.
&lt;/div&gt;&lt;br&gt;I've synchronized the put() methods in both directions back to a
&lt;br&gt;single lock object, so one thread would block while the other
&lt;br&gt;completes its update. Correct me if I'm wrong, this is definitely my
&lt;br&gt;knowledge of the inner workings synchronization starts to get fuzzy.
&lt;br&gt;&lt;br&gt;Norman
&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472705&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26472705.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26472599</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T20:01:07Z</published>
	<updated>2009-11-22T20:01:07Z</updated>
	<author>
		<name>martinrb</name>
	</author>
	<content type="html">On Sun, Nov 22, 2009 at 18:37, Norman Elton &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472599&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;normelton@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; From how you describe it, it sounds like there is no consistency issue. If
&lt;br&gt;&amp;gt;&amp;gt; no thread can ever expect to find that:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; v-&amp;gt;k =&amp;gt; k-&amp;gt;v
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; then the fact that the above can fail to hold during a modification to the
&lt;br&gt;&amp;gt;&amp;gt; bi-map seems of little consequence.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Just to clarify... yes, at any given instant, k -&amp;gt; v does imply v -&amp;gt;
&lt;br&gt;&amp;gt; k. But there is no way, that I can see, to atomically access both
&lt;br&gt;&amp;gt; get(k) and get(v).
&lt;/div&gt;&lt;br&gt;Suppose
&lt;br&gt;thread 1 is trying to set k -&amp;gt; v1
&lt;br&gt;while
&lt;br&gt;thread 2 is trying to set k -&amp;gt; v2
&lt;br&gt;&lt;br&gt;Because the updates of the two maps are independent,
&lt;br&gt;and you can't control the scheduler, there is a risk of
&lt;br&gt;ending up with
&lt;br&gt;k -&amp;gt; v1
&lt;br&gt;in the first map, and
&lt;br&gt;v2 -&amp;gt; k
&lt;br&gt;in the reverse map
&lt;br&gt;in the quiescent state.
&lt;br&gt;&lt;br&gt;Martin
&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472599&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26472599.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26472505</id>
	<title>Re: Performance of ReentrantReadWriteLock</title>
	<published>2009-11-22T19:53:51Z</published>
	<updated>2009-11-22T19:53:51Z</updated>
	<author>
		<name>martinrb</name>
	</author>
	<content type="html">Some thoughts:
&lt;br&gt;&lt;br&gt;RRWL has a bunch of overhead related to
&lt;br&gt;keeping track of read hold state, that could
&lt;br&gt;be removed to get something faster but less
&lt;br&gt;debuggable. &amp;nbsp;I've wanted to do something
&lt;br&gt;in this area.
&lt;br&gt;&lt;br&gt;I'd be interested in perf results when you have
&lt;br&gt;lots of writes. &amp;nbsp;What's the overhead of RRWL
&lt;br&gt;over RL when only the writelock is ever acquired?
&lt;br&gt;&lt;br&gt;Do you actually have enough processors to keep
&lt;br&gt;your 5 threads busy?
&lt;br&gt;&lt;br&gt;writing micro-benchmarks is known to be hard,
&lt;br&gt;and for concurrency primitives especially so.
&lt;br&gt;Perhaps you could share your micro-benchmark?
&lt;br&gt;&lt;br&gt;RRWL has seen some implementation improvements
&lt;br&gt;post-JDK6. &amp;nbsp;Try the JDK7, JDK6, JDK5 implementations
&lt;br&gt;with a jdk7 hotspot, perhaps.
&lt;br&gt;&lt;br&gt;Martin
&lt;br&gt;&lt;br&gt;On Wed, Nov 18, 2009 at 20:46, Norman Elton &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472505&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;normelton@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I've done some very basic testing of a ReentrantReadWriteLock vs.
&lt;br&gt;&amp;gt; synchronized. I fired up five threads, each of which is accessing a
&lt;br&gt;&amp;gt; shared Map&amp;lt;Integer,Integer&amp;gt;. At first, I did 99% read operations, then
&lt;br&gt;&amp;gt; 100% read operations. Initial testing, with no locking or
&lt;br&gt;&amp;gt; synchronization, proved about 8M operations per second per thread.
&lt;br&gt;&amp;gt; Super.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Then I tested synchronizing the get() and put() methods. Performance
&lt;br&gt;&amp;gt; dropped to about 700K operations per second. Synchronization obviously
&lt;br&gt;&amp;gt; has a large overhead.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Strange thing is, the ReentrantReadWriteLock performed just about as
&lt;br&gt;&amp;gt; well. Even in a 100% read environment, where I would think threads
&lt;br&gt;&amp;gt; would never have to block for one another.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Am I missing something here? Shouldn't I be seeing significantly
&lt;br&gt;&amp;gt; better numbers for the ReentrantReadWriteLock? Presumably, it's
&lt;br&gt;&amp;gt; allowing multiple threads to hit the hash at the same time. I would
&lt;br&gt;&amp;gt; expect numbers somewhere between the synchronizing hash and the
&lt;br&gt;&amp;gt; completely untouched HashMap.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thoughts? Thanks!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Norman
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Concurrency-interest mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472505&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472505&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Performance-of-ReentrantReadWriteLock-tp26420398p26472505.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26472165</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T18:53:27Z</published>
	<updated>2009-11-22T18:53:27Z</updated>
	<author>
		<name>Dhanji R. Prasanna</name>
	</author>
	<content type="html">Fwiw, I also endorse the view that a Copy-on-write wrapper around guava-libraries BiMap would be more performant (and simpler to write too).&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Dhanji.&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Sun, Nov 22, 2009 at 6:37 PM, Norman Elton &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472165&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;normelton@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;&lt;div class=&quot;im&quot;&gt;&amp;gt; From how you describe it, it sounds like there is no consistency issue. If&lt;br&gt;
&amp;gt; no thread can ever expect to find that:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; v-&amp;gt;k =&amp;gt; k-&amp;gt;v&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; then the fact that the above can fail to hold during a modification to the&lt;br&gt;
&amp;gt; bi-map seems of little consequence.&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;Just to clarify... yes, at any given instant, k -&amp;gt; v does imply v -&amp;gt;&lt;br&gt;
k. But there is no way, that I can see, to atomically access both&lt;br&gt;
get(k) and get(v).&lt;br&gt;
&lt;br&gt;
Thanks all,&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;&lt;br&gt;
Norman&lt;br&gt;
_______________________________________________&lt;br&gt;
Concurrency-interest mailing list&lt;br&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472165&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472165&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26472165.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26472077</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T18:37:36Z</published>
	<updated>2009-11-22T18:37:36Z</updated>
	<author>
		<name>Norman Elton</name>
	</author>
	<content type="html">&amp;gt; From how you describe it, it sounds like there is no consistency issue. If
&lt;br&gt;&amp;gt; no thread can ever expect to find that:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; v-&amp;gt;k =&amp;gt; k-&amp;gt;v
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; then the fact that the above can fail to hold during a modification to the
&lt;br&gt;&amp;gt; bi-map seems of little consequence.
&lt;br&gt;&lt;br&gt;Just to clarify... yes, at any given instant, k -&amp;gt; v does imply v -&amp;gt;
&lt;br&gt;k. But there is no way, that I can see, to atomically access both
&lt;br&gt;get(k) and get(v).
&lt;br&gt;&lt;br&gt;Thanks all,
&lt;br&gt;&lt;br&gt;Norman
&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26472077&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26472077.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26471620</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T17:30:29Z</published>
	<updated>2009-11-22T17:30:29Z</updated>
	<author>
		<name>David Holmes-6</name>
	</author>
	<content type="html">Norman,
&lt;br&gt;&lt;br&gt;&amp;gt;From how you describe it, it sounds like there is no consistency issue. If
&lt;br&gt;no thread can ever expect to find that:
&lt;br&gt;&lt;br&gt;v-&amp;gt;k =&amp;gt; k-&amp;gt;v
&lt;br&gt;&lt;br&gt;then the fact that the above can fail to hold during a modification to the
&lt;br&gt;bi-map seems of little consequence.
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;David
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; -----Original Message-----
&lt;br&gt;&amp;gt; From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471620&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;
&lt;br&gt;&amp;gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471620&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;]On Behalf Of Norman
&lt;br&gt;&amp;gt; Elton
&lt;br&gt;&amp;gt; Sent: Monday, 23 November 2009 11:19 AM
&lt;br&gt;&amp;gt; To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471620&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Subject: Re: [concurrency-interest] Concurrent Bidirectional Map
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Yea, the update to both maps is not atomic because reader threads can
&lt;br&gt;&amp;gt; &amp;gt; interleave between writes to either map. Technically, you won't
&lt;br&gt;&amp;gt; corrupt the
&lt;br&gt;&amp;gt; &amp;gt; map (unlike in the case of a regular HashMap), but that depends
&lt;br&gt;&amp;gt; on what your
&lt;br&gt;&amp;gt; &amp;gt; definition of corruption is (as David says). A read from the
&lt;br&gt;&amp;gt; value-&amp;gt;key map
&lt;br&gt;&amp;gt; &amp;gt; can be inconsistent with a put to the key-&amp;gt;value map.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks David &amp; Dhanji for your thinking on this.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I realize that if two threads hit the map at the same time, one doing
&lt;br&gt;&amp;gt; a look-by-key and another doing a lookup-by-value, while a third
&lt;br&gt;&amp;gt; thread is doing an update, it is possible the two readers will see
&lt;br&gt;&amp;gt; different pairings. But, is this a problem? They are two separate
&lt;br&gt;&amp;gt; threads. How should they expect to be simultaneously seeing the same
&lt;br&gt;&amp;gt; &amp;quot;state&amp;quot; of the map?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Likewise, a single thread that does a lookup-by-key, followed by a
&lt;br&gt;&amp;gt; lookup-by-value, should expect to get two different results, since
&lt;br&gt;&amp;gt; it's entirely feasible that another thread updates the map between the
&lt;br&gt;&amp;gt; two reads.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; My implementation of the BiMap doesn't have any unsynchronized methods
&lt;br&gt;&amp;gt; (I think!) that refer to both maps. All of the reader methods use a
&lt;br&gt;&amp;gt; single of the two CHMs, which represent a valid &amp;quot;snapshot&amp;quot; of the map
&lt;br&gt;&amp;gt; when referenced.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks again, all, for your help on this! Let me know if my reasoning
&lt;br&gt;&amp;gt; is flawed, I've enjoyed thinking though this :-).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Norman
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Concurrency-interest mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471620&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471620&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26471620.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26471505</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T17:19:18Z</published>
	<updated>2009-11-22T17:19:18Z</updated>
	<author>
		<name>Norman Elton</name>
	</author>
	<content type="html">&amp;gt; Yea, the update to both maps is not atomic because reader threads can
&lt;br&gt;&amp;gt; interleave between writes to either map. Technically, you won't corrupt the
&lt;br&gt;&amp;gt; map (unlike in the case of a regular HashMap), but that depends on what your
&lt;br&gt;&amp;gt; definition of corruption is (as David says). A read from the value-&amp;gt;key map
&lt;br&gt;&amp;gt; can be inconsistent with a put to the key-&amp;gt;value map.
&lt;br&gt;&lt;br&gt;Thanks David &amp; Dhanji for your thinking on this.
&lt;br&gt;&lt;br&gt;I realize that if two threads hit the map at the same time, one doing
&lt;br&gt;a look-by-key and another doing a lookup-by-value, while a third
&lt;br&gt;thread is doing an update, it is possible the two readers will see
&lt;br&gt;different pairings. But, is this a problem? They are two separate
&lt;br&gt;threads. How should they expect to be simultaneously seeing the same
&lt;br&gt;&amp;quot;state&amp;quot; of the map?
&lt;br&gt;&lt;br&gt;Likewise, a single thread that does a lookup-by-key, followed by a
&lt;br&gt;lookup-by-value, should expect to get two different results, since
&lt;br&gt;it's entirely feasible that another thread updates the map between the
&lt;br&gt;two reads.
&lt;br&gt;&lt;br&gt;My implementation of the BiMap doesn't have any unsynchronized methods
&lt;br&gt;(I think!) that refer to both maps. All of the reader methods use a
&lt;br&gt;single of the two CHMs, which represent a valid &amp;quot;snapshot&amp;quot; of the map
&lt;br&gt;when referenced.
&lt;br&gt;&lt;br&gt;Thanks again, all, for your help on this! Let me know if my reasoning
&lt;br&gt;is flawed, I've enjoyed thinking though this :-).
&lt;br&gt;&lt;br&gt;Norman
&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471505&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26471505.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26470902</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T15:40:04Z</published>
	<updated>2009-11-22T15:40:04Z</updated>
	<author>
		<name>Jed Wesley-Smith</name>
	</author>
	<content type="html">Norman,
&lt;br&gt;&lt;br&gt;I have found that for this kind of application (read-mostly) a 
&lt;br&gt;copy-on-write approach can work very well (depending on the size of the 
&lt;br&gt;structure as the write is O(n)). We use a CopyOnWriteMap[1] that follows 
&lt;br&gt;a similar scheme to the j.u.c CopyOnWriteArrayList and have found that 
&lt;br&gt;its read performance in highly contended reads is excellent as it is 
&lt;br&gt;completely lock-free, whereas CHM will still do some locking on its 
&lt;br&gt;internal buckets.
&lt;br&gt;&lt;br&gt;Implementing something similar for google-collections BiMap would not be 
&lt;br&gt;difficult (the algorithm is very simple), the only problem being that 
&lt;br&gt;the g.c. Immutable*.Builder implementations don't support removal[2] 
&lt;br&gt;unfortunately, making a COW* implementation that uses them internally 
&lt;br&gt;require two copies per write in the remove/replace cases.
&lt;br&gt;&lt;br&gt;cheers,
&lt;br&gt;jed.
&lt;br&gt;&lt;br&gt;[1] 
&lt;br&gt;&lt;a href=&quot;https://labs.atlassian.com/source/browse/CONCURRENT/trunk/src/main/java/com/atlassian/util/concurrent/CopyOnWriteMap.java?r=2602&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://labs.atlassian.com/source/browse/CONCURRENT/trunk/src/main/java/com/atlassian/util/concurrent/CopyOnWriteMap.java?r=2602&lt;/a&gt;&lt;br&gt;[2] &lt;a href=&quot;http://code.google.com/p/google-collections/issues/detail?id=279&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/p/google-collections/issues/detail?id=279&lt;/a&gt;&lt;br&gt;&lt;br&gt;Norman Elton wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Dhanji,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks for dedicating some brain-cells to looking at this.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; Unfortunately, if you synchronize put() and remove() you lose the
&lt;br&gt;&amp;gt;&amp;gt; concurrency benefits of CHM. All threads will serialize behind the put lock.
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Yep. My application is 99% reads and 1% writes, so I can tolerate
&lt;br&gt;&amp;gt; single-threading put() and remove() operations. One major benefit that
&lt;br&gt;&amp;gt; does remain; however, is that I don't have to worry about concurrent
&lt;br&gt;&amp;gt; modification exceptions when iterating through the map members.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I would love someone with more concurrency kung-fu to implement a real
&lt;br&gt;&amp;gt; BiMap, so that I wouldn't have to rely on synchronization.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; Also, in your implementation, in order for the bi-map-put to be perceived
&lt;br&gt;&amp;gt;&amp;gt; atomically, you would have to synchronize the get method as well =(
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is where I'm a little perplexed. I've synchronized any write
&lt;br&gt;&amp;gt; methods, so that the two CHMs stay &amp;quot;in synch&amp;quot;. Any read operations, as
&lt;br&gt;&amp;gt; I see it, should be safe to fall through to the primary CHM without
&lt;br&gt;&amp;gt; extra synchronization. If one thread is updating the map while another
&lt;br&gt;&amp;gt; is reading, the reading thread will either get the new or the old
&lt;br&gt;&amp;gt; value, but we shouldn't get any exceptions or end up with inconsistent
&lt;br&gt;&amp;gt; CHMs.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Or am I misunderstanding something?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks again,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Norman
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Concurrency-interest mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26470902&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26470902&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26470902.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26471028</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T15:11:57Z</published>
	<updated>2009-11-22T15:11:57Z</updated>
	<author>
		<name>Dhanji R. Prasanna</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Sun, Nov 22, 2009 at 2:52 PM, David Holmes &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471028&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;davidcholmes@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;
Norman,&lt;br&gt;
&lt;br&gt;
Norman Elton writes:&lt;br&gt;
&lt;div class=&quot;im&quot;&gt;&amp;gt; Dhanji R. Prasanna writes:&lt;br&gt;
&amp;gt; &amp;gt; Also, in your implementation, in order for the bi-map-put to be&lt;br&gt;
&amp;gt; &amp;gt; perceived atomically, you would have to synchronize the get&lt;br&gt;
&amp;gt; &amp;gt; method as well =(&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This is where I&amp;#39;m a little perplexed. I&amp;#39;ve synchronized any write&lt;br&gt;
&amp;gt; methods, so that the two CHMs stay &amp;quot;in synch&amp;quot;. Any read operations, as&lt;br&gt;
&amp;gt; I see it, should be safe to fall through to the primary CHM without&lt;br&gt;
&amp;gt; extra synchronization. If one thread is updating the map while another&lt;br&gt;
&amp;gt; is reading, the reading thread will either get the new or the old&lt;br&gt;
&amp;gt; value, but we shouldn&amp;#39;t get any exceptions or end up with inconsistent&lt;br&gt;
&amp;gt; CHMs.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Or am I misunderstanding something?&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;Your reader thread can access the map while only one of the associations is&lt;br&gt;
in effect. &lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Yea, the update to both maps is not atomic because reader threads can interleave between writes to either map. Technically, you won&amp;#39;t corrupt the map (unlike in the case of a regular HashMap), but that depends on what your definition of corruption is (as David says). A read from the value-&amp;gt;key map can be inconsistent with a put to the key-&amp;gt;value map.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Dhanji.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26471028&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26471028.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26470520</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T14:52:52Z</published>
	<updated>2009-11-22T14:52:52Z</updated>
	<author>
		<name>David Holmes-6</name>
	</author>
	<content type="html">Norman,
&lt;br&gt;&lt;br&gt;Norman Elton writes:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Dhanji R. Prasanna writes:
&lt;br&gt;&amp;gt; &amp;gt; Also, in your implementation, in order for the bi-map-put to be
&lt;br&gt;&amp;gt; &amp;gt; perceived atomically, you would have to synchronize the get
&lt;br&gt;&amp;gt; &amp;gt; method as well =(
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is where I'm a little perplexed. I've synchronized any write
&lt;br&gt;&amp;gt; methods, so that the two CHMs stay &amp;quot;in synch&amp;quot;. Any read operations, as
&lt;br&gt;&amp;gt; I see it, should be safe to fall through to the primary CHM without
&lt;br&gt;&amp;gt; extra synchronization. If one thread is updating the map while another
&lt;br&gt;&amp;gt; is reading, the reading thread will either get the new or the old
&lt;br&gt;&amp;gt; value, but we shouldn't get any exceptions or end up with inconsistent
&lt;br&gt;&amp;gt; CHMs.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Or am I misunderstanding something?
&lt;/div&gt;&lt;br&gt;Your reader thread can access the map while only one of the associations is
&lt;br&gt;in effect. Whether that can cause a problem in practice depends on the exact
&lt;br&gt;semantics of the bi-map and how it is used. If you add the value-&amp;gt;key
&lt;br&gt;mapping before the key-&amp;gt;value mapping (and remove in opposite order) then it
&lt;br&gt;will mitigate the ability to see inconsistency - assuming you always lookup
&lt;br&gt;by key, not value.
&lt;br&gt;&lt;br&gt;David Holmes
&lt;br&gt;&lt;br&gt;&amp;gt; Thanks again,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Norman
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Concurrency-interest mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26470520&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26470520&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26470520.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26468947</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-22T11:54:28Z</published>
	<updated>2009-11-22T11:54:28Z</updated>
	<author>
		<name>Norman Elton</name>
	</author>
	<content type="html">Dhanji,
&lt;br&gt;&lt;br&gt;Thanks for dedicating some brain-cells to looking at this.
&lt;br&gt;&lt;br&gt;&amp;gt; Unfortunately, if you synchronize put() and remove() you lose the
&lt;br&gt;&amp;gt; concurrency benefits of CHM. All threads will serialize behind the put lock.
&lt;br&gt;&lt;br&gt;Yep. My application is 99% reads and 1% writes, so I can tolerate
&lt;br&gt;single-threading put() and remove() operations. One major benefit that
&lt;br&gt;does remain; however, is that I don't have to worry about concurrent
&lt;br&gt;modification exceptions when iterating through the map members.
&lt;br&gt;&lt;br&gt;I would love someone with more concurrency kung-fu to implement a real
&lt;br&gt;BiMap, so that I wouldn't have to rely on synchronization.
&lt;br&gt;&lt;br&gt;&amp;gt; Also, in your implementation, in order for the bi-map-put to be perceived
&lt;br&gt;&amp;gt; atomically, you would have to synchronize the get method as well =(
&lt;br&gt;&lt;br&gt;This is where I'm a little perplexed. I've synchronized any write
&lt;br&gt;methods, so that the two CHMs stay &amp;quot;in synch&amp;quot;. Any read operations, as
&lt;br&gt;I see it, should be safe to fall through to the primary CHM without
&lt;br&gt;extra synchronization. If one thread is updating the map while another
&lt;br&gt;is reading, the reading thread will either get the new or the old
&lt;br&gt;value, but we shouldn't get any exceptions or end up with inconsistent
&lt;br&gt;CHMs.
&lt;br&gt;&lt;br&gt;Or am I misunderstanding something?
&lt;br&gt;&lt;br&gt;Thanks again,
&lt;br&gt;&lt;br&gt;Norman
&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26468947&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26468947.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26467472</id>
	<title>Re: park and unpark low-level details</title>
	<published>2009-11-22T09:36:25Z</published>
	<updated>2009-11-22T09:36:25Z</updated>
	<author>
		<name>martinrb</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Nov 20, 2009 at 10:41, Andrew Haley &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26467472&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aph@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Dave Dice wrote:&lt;br&gt;
&lt;div class=&quot;im&quot;&gt;&lt;br&gt;
&amp;gt;&amp;gt; What do you man by this?  I guess there&amp;#39;s a nice way to map park and&lt;br&gt;
&amp;gt;&amp;gt; unpark onto low-level NPTL primitives (futexes, perhaps?)  Did you&lt;br&gt;
&amp;gt;&amp;gt; have a sketch of a design for that?&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&amp;gt; We preferred to use more standardized interfaces.  I experimented&lt;br&gt;
&amp;gt; with using futexes instead of the usual condvar-mutex-flag tuple but&lt;br&gt;
&amp;gt; it wasn&amp;#39;t particularly better.&lt;br&gt;
&lt;br&gt;
I&amp;#39;m not surprised.  I did some profiling, and even with quite heavily&lt;br&gt;
contended locks the time spent in park and unpark is often down in&lt;br&gt;
the noise.  Amazing, really.  :-)&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;Coincidentally, there&amp;#39;s an article on futexes here:&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://lwn.net/Articles/360699/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lwn.net/Articles/360699/&lt;/a&gt;&lt;br&gt;&lt;br&gt;Regarding using standard interfaces:&lt;br&gt;&lt;br&gt;---&lt;br&gt;

Man pages: The current man pages do not include some of the new futex 
operations. They suggest a policy for the value of the futex which has 
led to some confusion regarding usage of futexes. Worst of all, the user 
space &lt;tt&gt;futex()&lt;/tt&gt; definition has been removed from 
&lt;tt&gt;/usr/include/linux/futex.h&lt;/tt&gt;, rendering the man pages not only
incomplete,  
but also inaccurate. Users of futexes must use the syscall interface 
directly.
&lt;br&gt;---&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26467472&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/park-and-unpark-low-level-details-tp26447593p26467472.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26462789</id>
	<title>Re: Concurrent Bidirectional Map</title>
	<published>2009-11-21T20:28:28Z</published>
	<updated>2009-11-21T20:28:28Z</updated>
	<author>
		<name>Dhanji R. Prasanna</name>
	</author>
	<content type="html">Unfortunately, if you synchronize put() and remove() you lose the concurrency benefits of CHM. All threads will serialize behind the put lock. Also, in your implementation, in order for the bi-map-put to be perceived atomically, you would have to synchronize the get method as well =(&lt;div&gt;
&lt;br&gt;&lt;/div&gt;&lt;div&gt;It is an interesting use case, however.&lt;/div&gt;&lt;div&gt;my 2c.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Dhanji.&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Sun, Nov 22, 2009 at 2:54 PM, Norman Elton &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26462789&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;normelton@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;Let me start by saying that I am, by no means, a concurrency guru. But&lt;br&gt;
I did have a use for a concurrent bidirectional map, one that&lt;br&gt;
maintains key-to-value and value-to-key uniqueness. I whipped up a&lt;br&gt;
quick implementation of ConcurrentBiMap built around two&lt;br&gt;
ConcurrentHashMaps. The BiMap implements Map&amp;lt;K,V&amp;gt;, with the single&lt;br&gt;
extra method inverse(), which returns a Map&amp;lt;V,K&amp;gt;.&lt;br&gt;
&lt;br&gt;
I basically synchronized all the modifying methods (clear, put,&lt;br&gt;
remove, etc) so that I could safely change both maps atomically. All&lt;br&gt;
other methods are unsynchronized. The methods that would normally&lt;br&gt;
return modifiable Sets (entrySet, values, keySet) return unmodifiable&lt;br&gt;
versions of their &amp;quot;normal&amp;quot; values, since I have not yet come up with a&lt;br&gt;
way to allow the user to atomically remove a value from such a set.&lt;br&gt;
&lt;br&gt;
I&amp;#39;ll attach both the code and a fairly extensive JUnit test case. A&lt;br&gt;
few questions remain:&lt;br&gt;
&lt;br&gt;
- Have I reinvented the wheel? Is there already a good / better&lt;br&gt;
implementation of a ConcurrentBiMap?&lt;br&gt;
&lt;br&gt;
- Is there a good way to test the atomicity of code? I could fire up&lt;br&gt;
multiple threads and let them simultaneously hammer away at a shared&lt;br&gt;
hash, but I&amp;#39;m not sure this would be a good reproducible test case.&lt;br&gt;
&lt;br&gt;
- Can anyone think of a way to allow the three Set methods (entrySet,&lt;br&gt;
keySet, values) to return modifiable values? That is, if you remove an&lt;br&gt;
item from them, they atomically affect the original BiMap.&lt;br&gt;
&lt;br&gt;
Thanks for any pointers,&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
Norman&lt;br&gt;
&lt;/font&gt;&lt;br&gt;_______________________________________________&lt;br&gt;
Concurrency-interest mailing list&lt;br&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26462789&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26462789&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26462789.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26462669</id>
	<title>Concurrent Bidirectional Map</title>
	<published>2009-11-21T19:54:15Z</published>
	<updated>2009-11-21T19:54:15Z</updated>
	<author>
		<name>Norman Elton</name>
	</author>
	<content type="html">Let me start by saying that I am, by no means, a concurrency guru. But
&lt;br&gt;I did have a use for a concurrent bidirectional map, one that
&lt;br&gt;maintains key-to-value and value-to-key uniqueness. I whipped up a
&lt;br&gt;quick implementation of ConcurrentBiMap built around two
&lt;br&gt;ConcurrentHashMaps. The BiMap implements Map&amp;lt;K,V&amp;gt;, with the single
&lt;br&gt;extra method inverse(), which returns a Map&amp;lt;V,K&amp;gt;.
&lt;br&gt;&lt;br&gt;I basically synchronized all the modifying methods (clear, put,
&lt;br&gt;remove, etc) so that I could safely change both maps atomically. All
&lt;br&gt;other methods are unsynchronized. The methods that would normally
&lt;br&gt;return modifiable Sets (entrySet, values, keySet) return unmodifiable
&lt;br&gt;versions of their &amp;quot;normal&amp;quot; values, since I have not yet come up with a
&lt;br&gt;way to allow the user to atomically remove a value from such a set.
&lt;br&gt;&lt;br&gt;I'll attach both the code and a fairly extensive JUnit test case. A
&lt;br&gt;few questions remain:
&lt;br&gt;&lt;br&gt;- Have I reinvented the wheel? Is there already a good / better
&lt;br&gt;implementation of a ConcurrentBiMap?
&lt;br&gt;&lt;br&gt;- Is there a good way to test the atomicity of code? I could fire up
&lt;br&gt;multiple threads and let them simultaneously hammer away at a shared
&lt;br&gt;hash, but I'm not sure this would be a good reproducible test case.
&lt;br&gt;&lt;br&gt;- Can anyone think of a way to allow the three Set methods (entrySet,
&lt;br&gt;keySet, values) to return modifiable values? That is, if you remove an
&lt;br&gt;item from them, they atomically affect the original BiMap.
&lt;br&gt;&lt;br&gt;Thanks for any pointers,
&lt;br&gt;&lt;br&gt;Norman
&lt;br&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26462669&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;ConcurrentBiMap.java&lt;/strong&gt; (6K) &lt;a href=&quot;http://old.nabble.com/attachment/26462669/0/ConcurrentBiMap.java&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;ConcurrentBiMapTests.java&lt;/strong&gt; (8K) &lt;a href=&quot;http://old.nabble.com/attachment/26462669/1/ConcurrentBiMapTests.java&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Concurrent-Bidirectional-Map-tp26462669p26462669.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26449328</id>
	<title>Re: [CPU Affinity] ThreadPoolExecutor to improve&quot;O.S Scheduler&quot; ?</title>
	<published>2009-11-20T11:45:42Z</published>
	<updated>2009-11-20T11:45:42Z</updated>
	<author>
		<name>R Samuel Klatchko-2</name>
	</author>
	<content type="html">Does this only happen with Java or does it happen with other processes as well?&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Try running multiple copies of some other long lived process and see if they are all running on a single processor.  If they are, you are running into an issue with the OS (most likely a configuration limiting your user to a single processor).&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;samuel&lt;br&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Nov 20, 2009 at 11:35 AM, Safe P. &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;z8sbk@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot; style=&quot;font:inherit&quot;&gt;David, thank you for your answer.&lt;br&gt;
&lt;br&gt;The problem is exactly this:&lt;br&gt;&lt;br&gt;when I run  java -cp . MyProcess &amp;amp; java -cp .MyProcess &amp;amp; ... in a 12-core machine that runs HP-UX, all processes are assign to one processor.&lt;br&gt;&lt;br&gt;That means that an instance must wait until the end of the previous instance to start. I want to run all instances in parallel, using all 12 processors. Is this possibly? Maybe using ThreadPoolExecutor to execute each instance of this &amp;quot;java -cp ..&amp;quot;?&lt;br&gt;
&lt;br&gt;Thank you very much in advance!&lt;br&gt;&lt;br&gt;&lt;br&gt;--- El &lt;b&gt;jue 19-nov-09, David Holmes &lt;i&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;davidcholmes@...&lt;/a&gt;&amp;gt;&lt;/i&gt;&lt;/b&gt; escribió:&lt;br&gt;&lt;blockquote style=&quot;border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px&quot;&gt;
&lt;br&gt;De: David Holmes &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;davidcholmes@...&lt;/a&gt;&amp;gt;&lt;br&gt;Asunto: RE: [concurrency-interest] [CPU Affinity] ThreadPoolExecutor to improve&amp;quot;O.S
 Scheduler&amp;quot; ?&lt;br&gt;Para: &amp;quot;Safe P.&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;z8sbk@...&lt;/a&gt;&amp;gt;, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;&lt;br&gt;
Fecha: jueves, 19 de noviembre de 2009, 9:45 pm&lt;br&gt;&lt;br&gt;&lt;div&gt;

 
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;Matias,&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;I&amp;#39;m not really understanding your problem/issue, but most systems have 
some notion of processing domains that let you allocate resources (memory and 
CPU) to a domain and then run specific processes in specific domains. On Solaris 
this is done with processor sets, while on Linux there are CPU-sets. I don&amp;#39;t 
know what HP-UX has.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;There are no Java API&amp;#39;s to control thread or process affinity (other than 
by exec&amp;#39;ing OS utilities to do it, or calling your own native code 
routines.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;Normally, absent any domains, all processes (and all their threads) can 
run on any available processor/core.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;HTH.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;David Holmes&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;border-left:2px solid rgb(0, 0, 255);padding-left:5px;margin-left:5px&quot;&gt;
  &lt;div dir=&quot;ltr&quot; align=&quot;left&quot;&gt;&lt;font face=&quot;Tahoma&quot; size=&quot;2&quot;&gt;-----Original Message-----&lt;br&gt;&lt;b&gt;From:&lt;/b&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt; 
  [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;]&lt;b&gt;On Behalf Of &lt;/b&gt;Safe 
  P.&lt;br&gt;&lt;b&gt;Sent:&lt;/b&gt; Friday, 20 November 2009 9:35 AM&lt;br&gt;&lt;b&gt;To:&lt;/b&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;&lt;br&gt;&lt;b&gt;Subject:&lt;/b&gt; [concurrency-interest] 
  [CPU Affinity] ThreadPoolExecutor to improve&amp;quot;O.S Scheduler&amp;quot; 
  ?&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;
  &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign=&quot;top&quot;&gt;
        &lt;div&gt;Hi,&lt;br&gt;I&amp;#39;m very new to concurrent programming and I couldn&amp;#39;t find 
        anywhere if this is an issue or just a limitation.&lt;/div&gt;
        &lt;div&gt; &lt;/div&gt;
        &lt;div&gt;I&amp;#39;m running several instances of a java process like &amp;quot;process.sh 
        &amp;amp; process.sh &amp;amp; process.sh ...&amp;quot; in an HP-UX that runs over a 
        12-core machine. &lt;/div&gt;
        &lt;div&gt;&lt;br&gt;When I use sar, top, and other utilities I can see that HP-UX 
        is using just 1 core. It doesn&amp;#39;t manage to assign one processor per 
        process. &lt;/div&gt;
        &lt;div&gt; &lt;/div&gt;
        &lt;div&gt;Can I get this using ThreadPoolExecutor (like one 
        System.Runtime.exec() per thread)? &lt;/div&gt;
        &lt;div&gt; &lt;/div&gt;
        &lt;div&gt;Unfortunately, this machine is a production server so I can&amp;#39;t get 
        access to it in order to do some test and verify that, and of course, if 
        this make a significant time improvement.&lt;/div&gt;
        &lt;div&gt;&lt;br&gt;Thank you very much in 
  advanced.&lt;br&gt;--Matias&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br&gt;
  &lt;hr size=&quot;1&quot;&gt;
  &lt;br&gt;&lt;font face=&quot;Verdana&quot; size=&quot;-2&quot;&gt;Encontra las mejores recetas con Yahoo! Cocina. 
  &lt;br&gt;&lt;a href=&quot;http://ar.mujer.yahoo.com/cocina/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://ar.mujer.yahoo.com/cocina/&lt;/a&gt;&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br&gt;&lt;div class=&quot;hm&quot;&gt;



      &lt;hr size=&quot;1&quot;&gt;&lt;br&gt;&lt;font face=&quot;Verdana&quot; size=&quot;-2&quot;&gt;Encontra las mejores recetas con Yahoo! Cocina.
&lt;br&gt;
&lt;a href=&quot;http://ar.mujer.yahoo.com/cocina/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://ar.mujer.yahoo.com/cocina/&lt;/a&gt;&lt;/font&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________&lt;br&gt;
Concurrency-interest mailing list&lt;br&gt;
&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449328&amp;i=9&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/-CPU-Affinity--ThreadPoolExecutor-to-improve-%22O.S-Scheduler%22---tp26436209p26449328.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26449326</id>
	<title>Re: [CPU Affinity] ThreadPoolExecutor to	improve&quot;O.S Scheduler&quot; ?</title>
	<published>2009-11-20T11:45:05Z</published>
	<updated>2009-11-20T11:45:05Z</updated>
	<author>
		<name>David M. Lloyd-3</name>
	</author>
	<content type="html">He's saying it's probably a config issue with your OS, not a Java problem.
&lt;br&gt;&lt;br&gt;- DML
&lt;br&gt;&lt;br&gt;On 11/20/2009 01:35 PM, Safe P. wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; David, thank you for your answer.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The problem is exactly this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; when I run java -cp . MyProcess &amp; java -cp .MyProcess &amp; ... in a 12-core
&lt;br&gt;&amp;gt; machine that runs HP-UX, all processes are assign to one processor.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; That means that an instance must wait until the end of the previous
&lt;br&gt;&amp;gt; instance to start. I want to run all instances in parallel, using all 12
&lt;br&gt;&amp;gt; processors. Is this possibly? Maybe using ThreadPoolExecutor to execute
&lt;br&gt;&amp;gt; each instance of this &amp;quot;java -cp ..&amp;quot;?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thank you very much in advance!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --- El *jue 19-nov-09, David Holmes /&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;davidcholmes@...&lt;/a&gt;&amp;gt;/* escribió:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; De: David Holmes &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;davidcholmes@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Asunto: RE: [concurrency-interest] [CPU Affinity] ThreadPoolExecutor
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; to improve&amp;quot;O.S Scheduler&amp;quot; ?
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Para: &amp;quot;Safe P.&amp;quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;z8sbk@...&lt;/a&gt;&amp;gt;, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Fecha: jueves, 19 de noviembre de 2009, 9:45 pm
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Matias,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; I'm not really understanding your problem/issue, but most systems
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; have some notion of processing domains that let you allocate
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; resources (memory and CPU) to a domain and then run specific
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; processes in specific domains. On Solaris this is done with
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; processor sets, while on Linux there are CPU-sets. I don't know what
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; HP-UX has.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; There are no Java API's to control thread or process affinity (other
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; than by exec'ing OS utilities to do it, or calling your own native
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; code routines.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Normally, absent any domains, all processes (and all their threads)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; can run on any available processor/core.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; HTH.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; David Holmes
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -----Original Message-----
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *From:* &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;]*On Behalf Of
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *Safe P.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *Sent:* Friday, 20 November 2009 9:35 AM
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *To:* &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *Subject:* [concurrency-interest] [CPU Affinity]
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ThreadPoolExecutor to improve&amp;quot;O.S Scheduler&amp;quot; ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Hi,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I'm very new to concurrent programming and I couldn't find
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; anywhere if this is an issue or just a limitation.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I'm running several instances of a java process like &amp;quot;process.sh
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp; process.sh &amp; process.sh ...&amp;quot; in an HP-UX that runs over a
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12-core machine.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; When I use sar, top, and other utilities I can see that HP-UX is
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using just 1 core. It doesn't manage to assign one processor per
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; process.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Can I get this using ThreadPoolExecutor (like one
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.Runtime.exec() per thread)?
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Unfortunately, this machine is a production server so I can't
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get access to it in order to do some test and verify that, and
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; of course, if this make a significant time improvement.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Thank you very much in advanced.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; --Matias
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Encontra las mejores recetas con Yahoo! Cocina.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://ar.mujer.yahoo.com/cocina/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://ar.mujer.yahoo.com/cocina/&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Encontra las mejores recetas con Yahoo! Cocina.
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://ar.mujer.yahoo.com/cocina/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://ar.mujer.yahoo.com/cocina/&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Concurrency-interest mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;/div&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449326&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/-CPU-Affinity--ThreadPoolExecutor-to-improve-%22O.S-Scheduler%22---tp26436209p26449326.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26449201</id>
	<title>Re: [CPU Affinity] ThreadPoolExecutor to improve&quot;O.S Scheduler&quot; ?</title>
	<published>2009-11-20T11:35:07Z</published>
	<updated>2009-11-20T11:35:07Z</updated>
	<author>
		<name>Safe P.</name>
	</author>
	<content type="html">&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot; style=&quot;font: inherit;&quot;&gt;David, thank you for your answer.&lt;br&gt;&lt;br&gt;The problem is exactly this:&lt;br&gt;&lt;br&gt;when I run&amp;nbsp; java -cp . MyProcess &amp;amp; java -cp .MyProcess &amp;amp; ... in a 12-core machine that runs HP-UX, all processes are assign to one processor.&lt;br&gt;&lt;br&gt;That means that an instance must wait until the end of the previous instance to start. I want to run all instances in parallel, using all 12 processors. Is this possibly? Maybe using ThreadPoolExecutor to execute each instance of this &quot;java -cp ..&quot;?&lt;br&gt;&lt;br&gt;Thank you very much in advance!&lt;br&gt;&lt;br&gt;&lt;br&gt;--- El &lt;b&gt;jue 19-nov-09, David Holmes &lt;i&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449201&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;davidcholmes@...&lt;/a&gt;&amp;gt;&lt;/i&gt;&lt;/b&gt; escribió:&lt;br&gt;&lt;blockquote style=&quot;border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;&quot;&gt;&lt;br&gt;De: David Holmes &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449201&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;davidcholmes@...&lt;/a&gt;&amp;gt;&lt;br&gt;Asunto: RE: [concurrency-interest] [CPU Affinity] ThreadPoolExecutor to improve&quot;O.S
 Scheduler&quot; ?&lt;br&gt;Para: &quot;Safe P.&quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449201&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;z8sbk@...&lt;/a&gt;&amp;gt;, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449201&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;&lt;br&gt;Fecha: jueves, 19 de noviembre de 2009, 9:45 pm&lt;br&gt;&lt;br&gt;&lt;div id=&quot;yiv1760483864&quot;&gt;

 
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;Matias,&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;I'm not really understanding your problem/issue, but most systems have 
some notion of processing domains that let you allocate resources (memory and 
CPU) to a domain and then run specific processes in specific domains. On Solaris 
this is done with processor sets, while on Linux there are CPU-sets. I don't 
know what HP-UX has.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;There are no Java API's to control thread or process affinity (other than 
by exec'ing OS utilities to do it, or calling your own native code 
routines.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;Normally, absent any domains, all processes (and all their threads) can 
run on any available processor/core.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;HTH.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class=&quot;040124123-19112009&quot;&gt;&lt;font color=&quot;#0000ff&quot; face=&quot;Courier New&quot; size=&quot;2&quot;&gt;David Holmes&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px;&quot;&gt;
  &lt;div class=&quot;OutlookMessageHeader&quot; dir=&quot;ltr&quot; align=&quot;left&quot;&gt;&lt;font face=&quot;Tahoma&quot; size=&quot;2&quot;&gt;-----Original Message-----&lt;br&gt;&lt;b&gt;From:&lt;/b&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449201&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt; 
  [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449201&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;]&lt;b&gt;On Behalf Of &lt;/b&gt;Safe 
  P.&lt;br&gt;&lt;b&gt;Sent:&lt;/b&gt; Friday, 20 November 2009 9:35 AM&lt;br&gt;&lt;b&gt;To:&lt;/b&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449201&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;&lt;br&gt;&lt;b&gt;Subject:&lt;/b&gt; [concurrency-interest] 
  [CPU Affinity] ThreadPoolExecutor to improve&quot;O.S Scheduler&quot; 
  ?&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;
  &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
    &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign=&quot;top&quot;&gt;
        &lt;div&gt;Hi,&lt;br&gt;I'm very new to concurrent programming and I couldn't find 
        anywhere if this is an issue or just a limitation.&lt;/div&gt;
        &lt;div&gt;&amp;nbsp;&lt;/div&gt;
        &lt;div&gt;I'm running several instances of a java process like &quot;process.sh 
        &amp;amp; process.sh &amp;amp; process.sh ...&quot; in an HP-UX that runs over a 
        12-core machine. &lt;/div&gt;
        &lt;div&gt;&lt;br&gt;When I use sar, top, and other utilities I can see that HP-UX 
        is using just 1 core. It doesn't manage to assign one processor per 
        process. &lt;/div&gt;
        &lt;div&gt;&amp;nbsp;&lt;/div&gt;
        &lt;div&gt;Can I get this using ThreadPoolExecutor (like one 
        System.Runtime.exec() per thread)? &lt;/div&gt;
        &lt;div&gt;&amp;nbsp;&lt;/div&gt;
        &lt;div&gt;Unfortunately, this machine is a production server so I can't get 
        access to it in order to do some test and verify that, and of course, if 
        this make a significant time improvement.&lt;/div&gt;
        &lt;div&gt;&lt;br&gt;Thank you very much in 
  advanced.&lt;br&gt;--Matias&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br&gt;
  &lt;hr size=&quot;1&quot;&gt;
  &lt;br&gt;&lt;font face=&quot;Verdana&quot; size=&quot;-2&quot;&gt;Encontra las mejores recetas con Yahoo! Cocina. 
  &lt;br&gt;http://ar.mujer.yahoo.com/cocina/&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;



      &lt;hr size=1&gt;&lt;br&gt;&lt;font face=&quot;Verdana&quot; size=&quot;-2&quot;&gt;Encontra las mejores recetas con Yahoo! Cocina.
&lt;br&gt;
http://ar.mujer.yahoo.com/cocina/&lt;/font&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26449201&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/-CPU-Affinity--ThreadPoolExecutor-to-improve-%22O.S-Scheduler%22---tp26436209p26449201.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26448443</id>
	<title>Re: park and unpark low-level details</title>
	<published>2009-11-20T10:41:48Z</published>
	<updated>2009-11-20T10:41:48Z</updated>
	<author>
		<name>Andrew Haley</name>
	</author>
	<content type="html">Dave Dice wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 2009-11-20, at 12:46 PM, Andrew Haley wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Something I've been wondering about.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; In &amp;quot;The java.util.concurrent Synchronizer Framework&amp;quot; Doug writes:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;lt;&amp;lt; This simple mechanism is similar to those used, at some level, in
&lt;br&gt;&amp;gt;&amp;gt; the Solaris-9 thread library [11], in WIN32 &amp;quot;consumable events&amp;quot;, and
&lt;br&gt;&amp;gt;&amp;gt; in the Linux NPTL thread library, and so maps efficiently to each of
&lt;br&gt;&amp;gt;&amp;gt; these on the most common platforms Java runs on. &amp;nbsp;(However, the
&lt;br&gt;&amp;gt;&amp;gt; current Sun Hotspot JVM reference implementation on Solaris and Linux
&lt;br&gt;&amp;gt;&amp;gt; actually uses a pthread condvar in order to fit into the existing
&lt;br&gt;&amp;gt;&amp;gt; runtime design.) &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; What do you man by this? &amp;nbsp;I guess there's a nice way to map park and
&lt;br&gt;&amp;gt;&amp;gt; unpark onto low-level NPTL primitives (futexes, perhaps?) &amp;nbsp;Did you
&lt;br&gt;&amp;gt;&amp;gt; have a sketch of a design for that?
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&amp;gt; We preferred to use more standardized interfaces. &amp;nbsp;I experimented
&lt;br&gt;&amp;gt; with using futexes instead of the usual condvar-mutex-flag tuple but
&lt;br&gt;&amp;gt; it wasn't particularly better.
&lt;br&gt;&lt;br&gt;I'm not surprised. &amp;nbsp;I did some profiling, and even with quite heavily
&lt;br&gt;contended locks the time spent in park and unpark is often down in
&lt;br&gt;the noise. &amp;nbsp;Amazing, really. &amp;nbsp;:-)
&lt;br&gt;&lt;br&gt;&amp;gt; (Likewise, Solaris has low-level __lwp_park and __lwp_park
&lt;br&gt;&amp;gt; interfaces that also work nicely, but they aren't officially exposed
&lt;br&gt;&amp;gt; and subject change from release to release).
&lt;br&gt;&lt;br&gt;&amp;gt; One of the more interesting approaches is to use pipe pairs. &amp;nbsp;(I
&lt;br&gt;&amp;gt; left comments in the code that explain this in more detail).
&lt;br&gt;&amp;gt; Perversely, this is one of the best implementations for Solaris and
&lt;br&gt;&amp;gt; Linux, except that it can consume excessive number of file
&lt;br&gt;&amp;gt; descriptors, which is why we're not using it.
&lt;br&gt;&lt;br&gt;Yes, I read that. &amp;nbsp;I guess you'd use open() with O_NONBLOCK and
&lt;br&gt;select() with a timeout for timed waits. &amp;nbsp;This does have a really nice
&lt;br&gt;feel to it; it's a shame file descriptors turn out to be such a scarce
&lt;br&gt;resource.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; It probably doesn't much matter, given that pthread mutex and conndvar
&lt;br&gt;&amp;gt;&amp;gt; signal a fairly thin wrappers over futexes, but unparking a blocked
&lt;br&gt;&amp;gt;&amp;gt; thread requires three pthread_ calls:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; int status = pthread_mutex_lock(_mutex);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; AnyWaiters = _nParked ;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; status = pthread_mutex_unlock(_mutex);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; if (AnyWaiters != 0) {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;status = pthread_cond_signal(_cond);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&amp;gt; You're apparently looking at the PlatformEvent:: implementation and
&lt;br&gt;&amp;gt; not Parker::. &amp;nbsp;PlatformEvent:: is used by the built-in
&lt;br&gt;&amp;gt; synchronization primitives and native C++ JVM internal mutexes and
&lt;br&gt;&amp;gt; monitors, whereas Parker:: is infrastructure used by LockSupport.
&lt;br&gt;&amp;gt; They're similar -- and someday should be reconciled -- but have
&lt;br&gt;&amp;gt; slightly different semantics.
&lt;br&gt;&lt;br&gt;Ah, my mistake. &amp;nbsp;However, exactly the same is true of Parker::park:
&lt;br&gt;&lt;br&gt;&amp;nbsp; status = pthread_mutex_lock(_mutex);
&lt;br&gt;&amp;nbsp; s = _counter;
&lt;br&gt;&amp;nbsp; _counter = 1;
&lt;br&gt;&amp;nbsp; if (s &amp;lt; 1) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; status = pthread_mutex_unlock(_mutex);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; status = pthread_cond_signal (_cond) ;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; } else {
&lt;br&gt;&amp;nbsp; &amp;nbsp; pthread_mutex_unlock(_mutex);
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;I suppose this question is more to do with the fact that it doesn't
&lt;br&gt;quite feel right (to me) to be using all these pthread calls in the
&lt;br&gt;lowest-level Java primitives, rather than anything real to do with
&lt;br&gt;performance.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Andrew.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26448443&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/park-and-unpark-low-level-details-tp26447593p26448443.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26447593</id>
	<title>park and unpark low-level details</title>
	<published>2009-11-20T09:46:52Z</published>
	<updated>2009-11-20T09:46:52Z</updated>
	<author>
		<name>Andrew Haley</name>
	</author>
	<content type="html">Something I've been wondering about.
&lt;br&gt;&lt;br&gt;In &amp;quot;The java.util.concurrent Synchronizer Framework&amp;quot; Doug writes:
&lt;br&gt;&lt;br&gt;&amp;lt;&amp;lt; This simple mechanism is similar to those used, at some level, in
&lt;br&gt;the Solaris-9 thread library [11], in WIN32 &amp;quot;consumable events&amp;quot;, and
&lt;br&gt;in the Linux NPTL thread library, and so maps efficiently to each of
&lt;br&gt;these on the most common platforms Java runs on. &amp;nbsp;(However, the
&lt;br&gt;current Sun Hotspot JVM reference implementation on Solaris and Linux
&lt;br&gt;actually uses a pthread condvar in order to fit into the existing
&lt;br&gt;runtime design.) &amp;gt;&amp;gt;
&lt;br&gt;&lt;br&gt;What do you man by this? &amp;nbsp;I guess there's a nice way to map park and
&lt;br&gt;unpark onto low-level NPTL primitives (futexes, perhaps?) &amp;nbsp;Did you
&lt;br&gt;have a sketch of a design for that?
&lt;br&gt;&lt;br&gt;It probably doesn't much matter, given that pthread mutex and conndvar
&lt;br&gt;signal a fairly thin wrappers over futexes, but unparking a blocked
&lt;br&gt;thread requires three pthread_ calls:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;int status = pthread_mutex_lock(_mutex);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;AnyWaiters = _nParked ;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;status = pthread_mutex_unlock(_mutex);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (AnyWaiters != 0) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; status = pthread_cond_signal(_cond);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&lt;br&gt;(I realize that the mutex is necessary to prevent a race when signalling
&lt;br&gt;a thread that's parking. &amp;nbsp;I just wondered if you'd had another design in
&lt;br&gt;mind.)
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Andrew.
&lt;br&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26447593&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/park-and-unpark-low-level-details-tp26447593p26447593.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26436351</id>
	<title>Re: [CPU Affinity] ThreadPoolExecutor to improve&quot;O.S Scheduler&quot; ?</title>
	<published>2009-11-19T15:45:22Z</published>
	<updated>2009-11-19T15:45:22Z</updated>
	<author>
		<name>David Holmes-6</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;HTML&gt;&lt;HEAD&gt;
&lt;META http-equiv=Content-Type content=&quot;text/html; charset=iso-8859-1&quot;&gt;
&lt;META content=&quot;MSHTML 6.00.2800.1640&quot; name=GENERATOR&gt;&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;Matias,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;I'm not really understanding your problem/issue, but most systems have 
some notion of processing domains that let you allocate resources (memory and 
CPU) to a domain and then run specific processes in specific domains. On Solaris 
this is done with processor sets, while on Linux there are CPU-sets. I don't 
know what HP-UX has.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;There are no Java API's to control thread or process affinity (other than 
by exec'ing OS utilities to do it, or calling your own native code 
routines.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;Normally, absent any domains, all processes (and all their threads) can 
run on any available processor/core.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;HTH.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=040124123-19112009&gt;&lt;FONT face=&quot;Courier New&quot; color=#0000ff size=2&gt;David Holmes&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BLOCKQUOTE style=&quot;PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid&quot;&gt;
  &lt;DIV class=OutlookMessageHeader dir=ltr align=left&gt;&lt;FONT face=Tahoma size=2&gt;-----Original Message-----&lt;BR&gt;&lt;B&gt;From:&lt;/B&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26436351&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt; 
  [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26436351&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest-bounces@...&lt;/a&gt;]&lt;B&gt;On Behalf Of &lt;/B&gt;Safe 
  P.&lt;BR&gt;&lt;B&gt;Sent:&lt;/B&gt; Friday, 20 November 2009 9:35 AM&lt;BR&gt;&lt;B&gt;To:&lt;/B&gt; 
  &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26436351&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;concurrency-interest@...&lt;/a&gt;&lt;BR&gt;&lt;B&gt;Subject:&lt;/B&gt; [concurrency-interest] 
  [CPU Affinity] ThreadPoolExecutor to improve&quot;O.S Scheduler&quot; 
  ?&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/DIV&gt;
  &lt;TABLE cellSpacing=0 cellPadding=0 border=0&gt;
    &lt;TBODY&gt;
    &lt;TR&gt;
      &lt;TD vAlign=top&gt;
        &lt;DIV&gt;Hi,&lt;BR&gt;I'm very new to concurrent programming and I couldn't find 
        anywhere if this is an issue or just a limitation.&lt;/DIV&gt;
        &lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
        &lt;DIV&gt;I'm running several instances of a java process like &quot;process.sh 
        &amp;amp; process.sh &amp;amp; process.sh ...&quot; in an HP-UX that runs over a 
        12-core machine. &lt;/DIV&gt;
        &lt;DIV&gt;&lt;BR&gt;When I use sar, top, and other utilities I can see that HP-UX 
        is using just 1 core. It doesn't manage to assign one processor per 
        process. &lt;/DIV&gt;
        &lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
        &lt;DIV&gt;Can I get this using ThreadPoolExecutor (like one 
        System.Runtime.exec() per thread)? &lt;/DIV&gt;
        &lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
        &lt;DIV&gt;Unfortunately, this machine is a production server so I can't get 
        access to it in order to do some test and verify that, and of course, if 
        this make a significant time improvement.&lt;/DIV&gt;
        &lt;DIV&gt;&lt;BR&gt;Thank you very much in 
  advanced.&lt;BR&gt;--Matias&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR&gt;
  &lt;HR SIZE=1&gt;
  &lt;BR&gt;&lt;FONT face=Verdana size=-2&gt;Encontra las mejores recetas con Yahoo! Cocina. 
  &lt;BR&gt;http://ar.mujer.yahoo.com/cocina/&lt;/FONT&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26436351&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/-CPU-Affinity--ThreadPoolExecutor-to-improve-%22O.S-Scheduler%22---tp26436209p26436351.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26436209</id>
	<title>[CPU Affinity] ThreadPoolExecutor to improve &quot;O.S Scheduler&quot; ?</title>
	<published>2009-11-19T15:34:32Z</published>
	<updated>2009-11-19T15:34:32Z</updated>
	<author>
		<name>Safe P.</name>
	</author>
	<content type="html">&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot; style=&quot;font: inherit;&quot;&gt;&lt;DIV&gt;Hi,&lt;BR&gt;I'm very new to concurrent programming and I couldn't find anywhere if this is an issue or just a limitation.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I'm running several instances of a java process like &quot;process.sh &amp;amp; process.sh &amp;amp; process.sh ...&quot; in an HP-UX that runs over a 12-core machine. &lt;/DIV&gt;
&lt;DIV&gt;&lt;BR&gt;When I use sar, top, and other utilities I can see that HP-UX is using just 1 core. It doesn't manage to assign one processor per process. &lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Can I get this using ThreadPoolExecutor (like one System.Runtime.exec() per thread)? &lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Unfortunately, this machine is a production server so I can't get access to it in order to do some test and verify that, and of course, if this make a significant time improvement.&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR&gt;Thank you very much in advanced.&lt;BR&gt;--Matias&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;



      &lt;hr size=1&gt;&lt;br&gt;&lt;font face=&quot;Verdana&quot; size=&quot;-2&quot;&gt;Encontra las mejores recetas con Yahoo! Cocina.
&lt;br&gt;
http://ar.mujer.yahoo.com/cocina/&lt;/font&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26436209&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/-CPU-Affinity--ThreadPoolExecutor-to-improve-%22O.S-Scheduler%22---tp26436209p26436209.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26422435</id>
	<title>Re: Conja-- an accidental jsr166y alternative</title>
	<published>2009-11-19T00:19:16Z</published>
	<updated>2009-11-19T00:19:16Z</updated>
	<author>
		<name>i30817</name>
	</author>
	<content type="html">One main thing obviously. Sorry about the misinformation.&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Concurrency-interest mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26422435&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Concurrency-interest@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://cs.oswego.edu/mailman/listinfo/concurrency-interest&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Conja---an-accidental-jsr166y-alternative-tp26420751p26422435.html" />
</entry>

</feed>
