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


Groups > comp.lang.java.programmer > #28105

Re: thread pool with CachedThreadPool

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: thread pool with CachedThreadPool
Date Wed, 16 Apr 2014 17:55:37 +0200
Lines 36
Message-ID <br7nfqFbmbrU1@mid.individual.net> (permalink)
References <liirm6$1vl6$1@ariadne.rz.tu-clausthal.de> <12vmb157ulwwb.1cmusyz7wuuyi$.dlg@40tude.net> <lij2aj$217t$1@ariadne.rz.tu-clausthal.de> <H2i3v.81309$aK5.58575@fx24.iad> <br6n5eF4pmgU1@mid.individual.net> <lilmqh$feh$1@gregory.bnet.hr>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net 6li7otCFrODTdMkqBXZgDAQI/dWNIE4b3WmT6SC6CT0gRAg6c=
Cancel-Lock sha1:HaNJ0XgSvxb+1HFTzGob+cqA+tA=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
In-Reply-To <lilmqh$feh$1@gregory.bnet.hr>
Xref csiph.com comp.lang.java.programmer:28105

Show key headers only | View raw


On 16.04.2014 12:42, Josip Almasi wrote:
> On 04/16/2014 08:43 AM, Robert Klemme wrote:
>> On 16.04.2014 00:05, Daniel Pitts wrote:
>>
>>> "Threads" with nothing to do take up very little CPU.  They may take up
>>> memory or other resources, but they can be made to do nothing until
>>> called for.
>>
>> What do they take CPU for other than that negligible amount of time the
>> kernel takes for administering them?  I'd say for all practical purposes
>> you can assume a blocked thread to take up zero %CPU.  Or am I missing
>> something?
>
> Blocked thread itself spends no cpu time.
> Running thread may spend some more cpu time though, for lock checks.
> Real issue is flushing pipeline to ensure cache coherency among all cpu
> cores.
> So, more 'synchronized' statements your single running thread
> encounters, more cpu stalls. It's not really 'taking' cpu time, it's
> wasting it.

I don't think this applies.  We were talking about threads idling in the 
pool.

> I have to admit, intel pipeline is complete mistery to me:)
> But that's why have atomics and other non-blocking thread-safe magic.

The straightforward implementation will block them so there is no CPU 
consumption.  Custom implementations of thread pools may employ spin 
locks but that usually is only done if you expect to always have work 
for all threads.

Cheers

	robert

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

thread pool with CachedThreadPool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-04-15 10:47 +0200
  Re: thread pool with CachedThreadPool Joerg Meier <joergmmeier@arcor.de> - 2014-04-15 12:02 +0200
    Re: thread pool with CachedThreadPool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-04-15 12:40 +0200
      Re: thread pool with CachedThreadPool Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2014-04-15 15:05 -0700
        Re: thread pool with CachedThreadPool Robert Klemme <shortcutter@googlemail.com> - 2014-04-16 08:43 +0200
          Re: thread pool with CachedThreadPool Josip Almasi <joe@vrspace.org> - 2014-04-16 12:42 +0200
            Re: thread pool with CachedThreadPool Robert Klemme <shortcutter@googlemail.com> - 2014-04-16 17:55 +0200
              Re: thread pool with CachedThreadPool Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2014-04-16 22:11 -0700
                Re: thread pool with CachedThreadPool Josip Almasi <joe@vrspace.org> - 2014-04-17 12:12 +0200

csiph-web