• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Question regarding threads

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

Suppose i have 3 threads t1, t2, t3.
To get a multithreaded behavioyur can i just invoke the start() methods on each of the threads one after the other ( assuming i have written code in the run method to do the necessary task).
Or do i have to esnuer that each thread sleeps for a while so that other threads will take control and not get starved.
In other words is it essentila that each thread sleep for a while to geta multithreaded behaviour?

Regards,
Saj
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sajee,

As per my knowledge it is upto the underlying implementation (OS) to give the threads CPU time. It might be "Round robin scheduling" or some other scheduling mechanism. Even if you make the threads sleep, it does guarantee that they get the CPU time immediately, they only return to the runnable state from where it is upto the underlying scheduling algorithm to give it a shot at CPU time.

Hope this clarifies.
Regards
Bajji Pat
[ April 12, 2005: Message edited by: Bajji Pat ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic