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?
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 ]