What is thread?

Answer Posted / javamasque

Threads are lightweight process which lives inside process. These are independently running programs which have concurrent path of execution. Each thread has its own 1. Java stack 2. Program counter and 3. Native stack but have common heap space. Multiple threads with in same process share same variables and objects. They allocates objects from same heap and even they can share same instructions (execution code) at particular time. As a result above common access they can easily share information to each other.

Every program has at least one thread i.e. main thread. JVM creates main thread which calls main method to execute whole program. The main thread is non-daemon thread. Any thread created by main method is non-daemon thread by default.

JVM has daemon threads for garbage collection, object finalization and other housekeeping jobs.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define iterator and methods in iterator?

552


What package is math in java?

541


What is the major drawback of internal iteration over external iteration?

595


What is independent and dependent variables in research?

476


Write a function for palindrome and factorial and explain?

669






What are the major drawbacks of external iteration?

582


What is the final class modifier?

567


What is an object in java and how is it created?

595


What is lossy conversion in java?

573


Can we override singleton class?

542


What is a module function?

568


How to create packages in java?

537


Which package has light weight components in java programming?

687


Can we make the abstract methods static in java?

601


What is the relationship between clipping and repainting under awt?

630