Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #15311 > unrolled thread

Recommendations for Lightweight Threading?

Started by"Aaron W. Hsu" <arcfide@sacrideo.us>
First post2012-06-15 17:33 -0500
Last post2012-06-19 07:46 -0700
Articles 4 on this page of 84 — 19 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Recommendations for Lightweight Threading? "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-15 17:33 -0500
    Re: Recommendations for Lightweight Threading? markspace <-@.> - 2012-06-15 15:55 -0700
      Re: Recommendations for Lightweight Threading? "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-15 18:12 -0500
        Re: Recommendations for Lightweight Threading? markspace <-@.> - 2012-06-15 16:31 -0700
          Re: Recommendations for Lightweight Threading? "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-15 20:00 -0500
          Re: Recommendations for Lightweight Threading? Robert Klemme <shortcutter@googlemail.com> - 2012-06-16 14:39 +0200
            Re: Recommendations for Lightweight Threading? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-16 12:13 -0700
        Re: Recommendations for Lightweight Threading? Roedy Green <see_website@mindprod.com.invalid> - 2012-06-16 00:57 -0700
    Re: Recommendations for Lightweight Threading? Lew <lewbloch@gmail.com> - 2012-06-15 15:57 -0700
      Re: Recommendations for Lightweight Threading? "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-15 18:12 -0500
    Re: Recommendations for Lightweight Threading? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-15 20:19 -0400
      Re: Recommendations for Lightweight Threading? "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-15 19:59 -0500
        Re: Recommendations for Lightweight Threading? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-15 21:37 -0400
          Controlling the Garbage Collector "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-16 11:51 -0500
            Re: Controlling the Garbage Collector Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-16 14:24 -0400
              Re: Controlling the Garbage Collector markspace <-@.> - 2012-06-16 12:24 -0700
                Re: Controlling the Garbage Collector Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-16 13:14 -0700
                  Re: Controlling the Garbage Collector Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-16 16:35 -0400
                    Re: Controlling the Garbage Collector "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-16 19:43 -0500
                    Re: Controlling the Garbage Collector Wanja Gayk <brixomatic@yahoo.com> - 2012-06-23 13:36 +0200
                      Re: Controlling the Garbage Collector Robert Klemme <shortcutter@googlemail.com> - 2012-06-23 15:39 +0200
                  Re: Controlling the Garbage Collector markspace <-@.> - 2012-06-16 14:34 -0700
            Re: Controlling the Garbage Collector Robert Klemme <shortcutter@googlemail.com> - 2012-06-18 04:32 -0700
              Re: Controlling the Garbage Collector Roedy Green <see_website@mindprod.com.invalid> - 2012-06-24 14:31 -0700
            Re: Controlling the Garbage Collector Arne Vajhøj <arne@vajhoej.dk> - 2012-06-20 21:19 -0400
              Re: Controlling the Garbage Collector "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-21 13:24 -0500
                Re: Controlling the Garbage Collector Lew <lewbloch@gmail.com> - 2012-06-21 11:37 -0700
                  Re: Controlling the Garbage Collector Fred Greer <fggreer@nospam.invalid> - 2012-06-21 21:20 +0000
                Re: Controlling the Garbage Collector Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-21 15:24 -0400
                Re: Controlling the Garbage Collector Robert Klemme <shortcutter@googlemail.com> - 2012-06-21 23:46 +0200
                  Re: Controlling the Garbage Collector Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2012-06-25 15:28 +0300
                    Re: Controlling the Garbage Collector Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-25 09:05 -0400
                      Re: Controlling the Garbage Collector Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-25 17:01 +0000
                        Re: Controlling the Garbage Collector Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-25 13:45 -0400
                          Re: Controlling the Garbage Collector Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-25 13:49 -0400
                          Re: Controlling the Garbage Collector Robert Klemme <shortcutter@googlemail.com> - 2012-06-25 20:41 +0200
                            Re: Controlling the Garbage Collector Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-26 12:25 +0000
                              Re: Controlling the Garbage Collector Robert Klemme <shortcutter@googlemail.com> - 2012-06-26 06:46 -0700
                                Re: Controlling the Garbage Collector Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-26 16:26 +0000
                                  Re: Controlling the Garbage Collector Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-26 13:07 -0400
                                    Re: Controlling the Garbage Collector Robert Klemme <shortcutter@googlemail.com> - 2012-06-26 22:28 +0200
                                    Re: Controlling the Garbage Collector Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-26 23:49 +0000
                                      Re: Controlling the Garbage Collector Lew <lewbloch@gmail.com> - 2012-06-26 18:20 -0700
                                        Re: Controlling the Garbage Collector Highway to Hell <HtH49439112@gmail.com> - 2012-06-26 21:52 -0400
                                          Re: Controlling the Garbage Collector Gene Wirchenko <genew@ocis.net> - 2012-06-26 20:01 -0700
                                            Re: Controlling the Garbage Collector Highway to Hell <HtH49439112@gmail.com> - 2012-06-26 23:23 -0400
                                              Re: Controlling the Garbage Collector Gene Wirchenko <genew@ocis.net> - 2012-06-27 09:05 -0700
                                                Re: Controlling the Garbage Collector Martin Gregorie <martin@address-in-sig.invalid> - 2012-06-27 20:15 +0000
                                                  Re: Controlling the Garbage Collector Gene Wirchenko <genew@ocis.net> - 2012-06-27 13:52 -0700
                                                  Re: Controlling the Garbage Collector Lew <lewbloch@gmail.com> - 2012-06-27 13:41 -0700
                                                    Re: Controlling the Garbage Collector Gene Wirchenko <genew@ocis.net> - 2012-06-27 19:02 -0700
                                                    Re: Controlling the Garbage Collector Martin Gregorie <martin@address-in-sig.invalid> - 2012-06-28 21:45 +0000
                                                      Re: [OT] Driver's license restrictions (Was: Controlling the Garbage Collector) Lew <lewbloch@gmail.com> - 2012-06-28 15:16 -0700
                                                        Re: [OT] Driver's license restrictions (Was: Controlling the Garbage Collector) Martin Gregorie <martin@address-in-sig.invalid> - 2012-06-29 02:10 +0000
                                                        Re: [OT] Driver's license restrictions (Was: Controlling the Garbage Collector) Gene Wirchenko <genew@ocis.net> - 2012-06-28 19:57 -0700
                                                          Re: [OT] Driver's license restrictions glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-06-29 04:06 +0000
                                                            Re: [OT] Driver's license restrictions Tim Slattery <Slattery_T@bls.gov> - 2012-06-29 08:35 -0400
                                                          Re: [OT] Driver's license restrictions (Was: Controlling the Garbage Collector) Tim Slattery <Slattery_T@bls.gov> - 2012-06-29 08:33 -0400
                                                      Re: Controlling the Garbage Collector Tim Slattery <Slattery_T@bls.gov> - 2012-06-29 08:30 -0400
                                                        Re: Controlling the Garbage Collector Martin Gregorie <martin@address-in-sig.invalid> - 2012-06-29 23:04 +0000
                                                Re: Controlling the Garbage Collector Highway to Hell <HtH49439112@gmail.com> - 2012-06-27 16:53 -0400
                                              Re: Controlling the Garbage Collector Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-27 11:32 -0500
                                                Re: Controlling the Garbage Collector Highway to Hell <HtH49439112@gmail.com> - 2012-06-27 16:54 -0400
                                          Re: Controlling the Garbage Collector Lew <lewbloch@gmail.com> - 2012-06-27 11:45 -0700
                                            Re: Controlling the Garbage Collector Highway to Hell <HtH49439112@gmail.com> - 2012-06-27 16:55 -0400
                                        Re: Controlling the Garbage Collector glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-06-27 02:06 +0000
                                      Re: Controlling the Garbage Collector Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-27 16:34 +0000
                                      Re: Controlling the Garbage Collector Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-27 11:45 -0500
                                      Re: Controlling the Garbage Collector Wanja Gayk <brixomatic@yahoo.com> - 2012-07-02 11:21 +0200
                              Re: Controlling the Garbage Collector Lew <lewbloch@gmail.com> - 2012-06-26 13:52 -0700
                                Re: Controlling the Garbage Collector Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-06-26 23:40 +0000
                                  Re: Controlling the Garbage Collector Lew <lewbloch@gmail.com> - 2012-06-26 16:48 -0700
                Re: Controlling the Garbage Collector markspace <-@.> - 2012-06-21 15:15 -0700
                  Re: Controlling the Garbage Collector Lew <lewbloch@gmail.com> - 2012-06-21 15:33 -0700
                    Re: Controlling the Garbage Collector "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-21 21:24 -0500
                Re: Controlling the Garbage Collector markspace <-@.> - 2012-06-21 15:23 -0700
          Re: Recommendations for Lightweight Threading? Wanja Gayk <brixomatic@yahoo.com> - 2012-06-17 15:49 +0200
      Re: Recommendations for Lightweight Threading? Roedy Green <see_website@mindprod.com.invalid> - 2012-06-16 01:00 -0700
        Re: Recommendations for Lightweight Threading? Roedy Green <see_website@mindprod.com.invalid> - 2012-06-16 01:04 -0700
    Re: Recommendations for Lightweight Threading? Wanja Gayk <brixomatic@yahoo.com> - 2012-06-16 04:03 +0200
    Re: Recommendations for Lightweight Threading? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2012-06-15 22:27 -0700
      Re: Recommendations for Lightweight Threading? Robert Klemme <shortcutter@googlemail.com> - 2012-06-16 14:39 +0200
        Re: Recommendations for Lightweight Threading? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2012-06-18 19:37 -0700
          Re: Recommendations for Lightweight Threading? Robert Klemme <shortcutter@googlemail.com> - 2012-06-19 07:46 -0700

Page 5 of 5 — ← Prev page 1 2 3 4 [5]


#15323

FromKevin McMurtrie <mcmurtrie@pixelmemory.us>
Date2012-06-15 22:27 -0700
Message-ID<4fdc1941$0$86808$742ec2ed@news.sonic.net>
In reply to#15311
In article <YvmdncQlVsKmJUbSnZ2dnUVZ_t4AAAAA@giganews.com>,
 "Aaron W. Hsu" <arcfide@sacrideo.us> wrote:

> I am considering moving one of my projects from C to Java, but I am 
> hoping to find a high-performance threading implementation, or something 
> along the lines of libqthread, which offers Fill-Empty bit blocking and 
> good cooperative lightweight threading as a library.
> 
> Is there a current "best" solution when doing many threaded programs in 
> Java?  By many threads I mean many more than the cores or machines on the 
> network.  Something that scales up efficiently to distributed computing 
> would be nice as well.

It's possible to roll your own concurrency classes using compare-and-set 
or safe races.  Custom code with reduced functionality can beat the 
general JVM classes by a lot.

Minimizing thread interaction in high-performance code helps even more.  
Writing to shared memory results in a hardware stall to sync CPU caches. 
The bigger the system, the worse those cache syncs are.
-- 
I will not see posts from Google because I must filter them as spam

[toc] | [prev] | [next] | [standalone]


#15329

FromRobert Klemme <shortcutter@googlemail.com>
Date2012-06-16 14:39 +0200
Message-ID<a43d3iF1ajU1@mid.individual.net>
In reply to#15323
On 16.06.2012 07:27, Kevin McMurtrie wrote:

> It's possible to roll your own concurrency classes using compare-and-set
> or safe races.  Custom code with reduced functionality can beat the
> general JVM classes by a lot.

That sounds interesting: please share concrete examples where you were 
able to beat std lib "by a lot".

> Minimizing thread interaction in high-performance code helps even more.
> Writing to shared memory results in a hardware stall to sync CPU caches.
> The bigger the system, the worse those cache syncs are.

Well, that's one of the basic principles Doug Lea calls "thread 
confinement".  Not sharing is always more efficient than sharing when it 
comes to multiple threads.

Kind regards

	robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

[toc] | [prev] | [next] | [standalone]


#15406

FromKevin McMurtrie <mcmurtrie@pixelmemory.us>
Date2012-06-18 19:37 -0700
Message-ID<4fdfe5cd$0$34406$742ec2ed@news.sonic.net>
In reply to#15329
In article <a43d3iF1ajU1@mid.individual.net>,
 Robert Klemme <shortcutter@googlemail.com> wrote:

> On 16.06.2012 07:27, Kevin McMurtrie wrote:
> 
> > It's possible to roll your own concurrency classes using compare-and-set
> > or safe races.  Custom code with reduced functionality can beat the
> > general JVM classes by a lot.
> 
> That sounds interesting: please share concrete examples where you were 
> able to beat std lib "by a lot".

Many of the utility classes in the concurrency package use locking 
because it's required for implementing general List, Map, and the 
blocking APIs.  If you needed only a small subset of features, you could 
eliminate the locks.  Eliminating the locks would reduce overhead and, 
in many cases, improve the JIT compiler optimizations.

The classic example is data that has an incredibly high read to write 
ratio.  That makes it possible to use copy-on-write rather than locking.

You can also eliminate locks for blocking methods when there is one 
thread that may block.  The blocking thread calls LockSupport.park() and 
the unblocking thread calls LockSupport.unpark().  This comes in handy 
for one worker thread performing many very small tasks.  The Java 
classes don't have this drastic limitation of a single thread so they 
need locking.  (This can work for multiple threads but the complexity 
and overhead may get out of control.)

> 
> > Minimizing thread interaction in high-performance code helps even more.
> > Writing to shared memory results in a hardware stall to sync CPU caches.
> > The bigger the system, the worse those cache syncs are.
> 
> Well, that's one of the basic principles Doug Lea calls "thread 
> confinement".  Not sharing is always more efficient than sharing when it 
> comes to multiple threads.
> 
> Kind regards
> 
> 	robert
-- 
I will not see posts from Google because I must filter them as spam

[toc] | [prev] | [next] | [standalone]


#15417

FromRobert Klemme <shortcutter@googlemail.com>
Date2012-06-19 07:46 -0700
Message-ID<31ca1101-5c32-49e8-ba9f-57eac03abd43@googlegroups.com>
In reply to#15406
On Tuesday, June 19, 2012 4:37:00 AM UTC+2, Kevin McMurtrie wrote:
> In article <a43d3iF1ajU1@mid.individual.net>,
>  Robert Klemme <shortcutter@googlemail.com> wrote:
> 
> > On 16.06.2012 07:27, Kevin McMurtrie wrote:
> > 
> > > It's possible to roll your own concurrency classes using compare-and-set
> > > or safe races.  Custom code with reduced functionality can beat the
> > > general JVM classes by a lot.
> > 
> > That sounds interesting: please share concrete examples where you were 
> > able to beat std lib "by a lot".
> 
> Many of the utility classes in the concurrency package use locking 
> because it's required for implementing general List, Map, and the 
> blocking APIs.  If you needed only a small subset of features, you could 
> eliminate the locks.  Eliminating the locks would reduce overhead and, 
> in many cases, improve the JIT compiler optimizations.
> 
> The classic example is data that has an incredibly high read to write 
> ratio.  That makes it possible to use copy-on-write rather than locking.

In which cases did these classes not work or not work well for you?
java.util.concurrent.CopyOnWriteArrayList
java.util.concurrent.CopyOnWriteArraySet
etc.
http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/package-summary.html

java.util.concurrent.atomic.AtomicReferenceArray
etc.
http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/package-summary.html

> You can also eliminate locks for blocking methods when there is one 
> thread that may block.  The blocking thread calls LockSupport.park() and 
> the unblocking thread calls LockSupport.unpark().  This comes in handy 
> for one worker thread performing many very small tasks.  The Java 
> classes don't have this drastic limitation of a single thread so they 
> need locking.  (This can work for multiple threads but the complexity 
> and overhead may get out of control.)

I see.  Thank you!

Kind regards

robert

[toc] | [prev] | [standalone]


Page 5 of 5 — ← Prev page 1 2 3 4 [5]

Back to top | Article view | comp.lang.java.programmer


csiph-web