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


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

Re: java thread question

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Nigel Wade <nmw@ion.le.ac.uk>
Newsgroups comp.lang.java.programmer
Subject Re: java thread question
Date Thu, 03 Apr 2014 16:17:34 +0100
Lines 15
Message-ID <bq5cceF2nakU1@mid.individual.net> (permalink)
References <ffb65076-f551-432b-b548-303a884abd44@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net GmLF/01TUi6DmAnficaJFg81oq3DoLVFAfWyv7Mmuy/sJD4ilH
Cancel-Lock sha1:uDU6W2s0/Zq2sfO3pt/Q+68F6es=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5
In-Reply-To <ffb65076-f551-432b-b548-303a884abd44@googlegroups.com>
Xref csiph.com comp.lang.java.programmer:27943

Show key headers only | View raw


On 03/04/14 15:51, mcheung63@gmail.com wrote:
> Hi All
>      I have write a little program to keep running some threads, i got questions:
> 1) All threads are running within one process (ps command show me this), but it will eat up all cpu cores, how to explain this?

Because the OS can normally schedule any runnable process/thread to run on any available CPU core.
If your process has sufficient threads which are runnable then every core will be used.
One of the main purposes of threads is that they offer concurrent execution.

> 2) If thread will eat multiple cpu core, why wee need fork/join in java?

Fork starts another process, and this may run an entirely different executable.

If your only goal is to consume CPU then you don't require fork.

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


Thread

java thread question mcheung63@gmail.com - 2014-04-03 07:51 -0700
  Re: java thread question Nigel Wade <nmw@ion.le.ac.uk> - 2014-04-03 16:17 +0100
  Re: java thread question Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-04-03 11:43 -0400
    Re: java thread question mcheung63@gmail.com - 2014-04-03 15:10 -0700
      Re: java thread question Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-04-03 19:00 -0400
        Re: java thread question mcheung63@gmail.com - 2014-04-04 09:29 -0700
  Re: java thread question Roedy Green <see_website@mindprod.com.invalid> - 2014-04-03 17:52 -0700
    Re: java thread question mcheung63@gmail.com - 2014-04-04 09:31 -0700
    Re: java thread question Roedy Green <see_website@mindprod.com.invalid> - 2014-04-04 09:49 -0700
      Re: java thread question mcheung63@gmail.com - 2014-04-05 09:41 -0700

csiph-web