Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Running multiple threads together

Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
Squanch that. And squanch this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic