Multi Threading

1) What are the two types of multitasking?

1.process-based 2.Thread-based

2) What are the two ways to create the thread? implementing Runnable extending Thread

3) What is the signature of the constructor of a thread class?

Thread(Runnable threadob,String threadName)

4) What are all the methods available in the Runnable Interface?


5) What is the data type for the method isAlive() and this method is available in which class?

boolean, Thread

6) What are all the methods available in the Thread class?

1.isAlive() 2.join() 3.resume() 4.suspend() 5.stop() 6.start() 7.sleep() 8.destroy()

7) What are all the methods used for Inter Thread communication and what is the class in which these methods are defined?

1. wait(),notify() & notifyall() 2. Object class

8) What is the mechanism defind by java for the Resources to be used by only one Thread at a time?


9) What is the procedure to own the moniter by many threads?

not possible

10) What is the data type for the parameter of the sleep() method?


11) What are all the values for the following level? max-priority min-priority normal-priority


12) What is the method available for setting the priority?


13) What is the default thread at the time of starting the program?

main thread

14) Which priority Thread can prompt the lower primary Thread?

Higher Priority

15) How many threads at a time can access a monitor?


16) What are all the four states associated in the thread?

1. new 2. runnable 3. blocked 4. dead

17) Which method waits for the thread to die ?

join() method

18) Garbage collector thread belongs to which priority?


19) What is meant by timeslicing or time sharing?

Timeslicing is the method of allocating CPU time to individual threads in a priority schedule.

20) What is meant by daemon thread? In java runtime, what is it's role?

Daemon thread is a low priority thread which runs intermittently in the background doing the garbage collection operation for the java runtime system.