Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27948
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: java thread question |
| Date | 2014-04-03 17:52 -0700 |
| Organization | Canadian Mind Products |
| Message-ID | <9c0sj9li5pmdsvmp8ivesq8cuh9m6t31c8@4ax.com> (permalink) |
| References | <ffb65076-f551-432b-b548-303a884abd44@googlegroups.com> |
On Thu, 3 Apr 2014 07:51:16 -0700 (PDT), mcheung63@gmail.com wrote, quoted or indirectly quoted someone who said : > 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? >2) If thread will eat multiple cpu core, why wee need fork/join in java? what do you mean by "eat"? Threads join the queue of processes to execute. the OS schedules them on the next available CPU core. So if you have 7 threads and 4 cores, you can have 4 of those threads running at once. Your threads compute just like independent jobs, though the OS can do proprietary clever things. When you exec/fork, you spin off a separate job than runs independently in a separate address space. The spawner can fail and the child keeps going. The child can be written in a different language. The child have very limited ability to communicate with the spawner. A thread has access to the shared address space directly. -- Roedy Green Canadian Mind Products http://mindprod.com "The question of whether machines can think is about as relevant as the question of whether submarines can swim" ~ Edsger Wybe Dijkstra (born: 1930-05-11 died: 2002-08-06 at age: 72)
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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