Difference between running and starting a thread [duplicate]
Solution 1:
Thread.run()
does not spawn a new thread whereas Thread.start()
does, i.e Thread.run
actually runs on the same thread as that of the caller whereas Thread.start()
creates a new thread on which the task is run.
Solution 2:
When you call run
, you're just executing the run
method in the current thread. You code thus won't be multi-threaded.
If you call start
, this will start a new thread and the run
method will be executed on this new thread.
Solution 3:
A thread goes through various stages during its life cycle. When you call start() method thread goes in the runnable state and not the running state.
Then the scheduler pics up one thread from pool of thread waiting to get executed and puts it in the running stage. At this actual execution of the thread takes place.