• Post Reply Bookmark Topic Watch Topic
  • New Topic

Running multiple threads together  RSS feed

 
JPraveen Kumar
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If an application had multiple threads and one of them tried to make a network call to access a CD drive. Normally such an operation would take a couple of seconds. Do the other threads keep working or do they hang because of this?

As I understand, standard Java threads are simulations of multi-processes not actual OS processes. Each thread runs in a context of one main thread controlling the JVM. The OS sees that the JVM thread made a call and decides to put it to wait till it gets a response. I guess unless the threads were mapped to actual OS processes using p-threads or green threads, they should hang.

Is this reasoning correct?

Thanks Praveen.
 
Tor Henning Post
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If one thread is blocked because of i.e IO operations the other threads will run. unless you have them wait for data provided by the thread that does IO operations.

This is one of the advantages using threads, your application can keep working and not just sleep until IO is complete

And threads are native and scheduled by the OS.

Ann BTW green threads are not in use anymore. Green threads were running inside the jvm process and therefore could not utilize a multiprocessor (core) system.

take a look at this page
[ March 23, 2007: Message edited by: Tor Henning Post ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!