How multi processing is achieved in JAVA?

Answer Posted / rajashree

A thread pool is a collection of threads, which you
keep "alive" and use/reuse to process incoming "tasks".
When a new tasks arrives (a typical example is a request to
an HTTP server) you try to find a thread from the
collection, which is idle, and handle the task to it. If no
such thread exists you either wait for one to become
available or add a new thread to the pool (usually there is
an upper limit, though). After the thread has finished
processing the task, it is not terminated, only marked as
idle and ready to be reused for another task.

The main advantages of using a thread pool as opposed to
creating a new thread to handle each new task are:

1) By reusing threads you save the thread
creation/destruction overhead.

2) You have control over the maximum number of tasks that
are being processed in parallel (= number of threads in the
pool).

Is This Answer Correct ?    8 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the principle concepts of oops?

515


How do you convert an int to a double in java?

573


What are the 6 boolean operators?

533


How do you use substring in java?

519


What is data type in java?

473






What is the difference between dom and sax parser in java?

509


Is boolean a data type in java?

499


Why do you canvas?

588


I want to print “hello” even before main is executed. How will you acheive that?

623


How big is a boolean?

549


What is broken and continue statement?

510


What are the important features of Java 11 release?

562


What is JDBC Driver interface?How can you retrieve data from the ResultSet

1485


How do I know if java is installed?

490


What does @override mean?

512