Friday, 22 April 2016

Does JVM creates thread if there is no thread created explicitly ?


When JVM starts, it itself creates threads even there is no explicit thread created by program :
  1. Main thread - for running main() method
  2. Garbage collection
  3. Finalization

Apart from JVM itself, different APIs and Framework creates threads for different purposes.
Examples
 1. AWT / Swing : for event handling
 2. Timer : for scheduling task execution
 3. RMI : for calling remote object
 4. Web servers : for managing multiple requests

No comments:

Post a Comment

Note: only a member of this blog may post a comment.