ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
How multi processing is achieved in JAVA?
 Question Submitted By :: Varsha
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How multi processing is achieved in JAVA?
Answer
# 1
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 ?    1 Yes 3 No
Rajashree
 
  Re: How multi processing is achieved in JAVA?
Answer
# 2
by multi threading
 
Is This Answer Correct ?    4 Yes 2 No
Simran
 
 
 
  Re: How multi processing is achieved in JAVA?
Answer
# 3
We can achieve this in java by using Interface conscept.
 
Is This Answer Correct ?    0 Yes 3 No
Dipil T T
 
  Re: How multi processing is achieved in JAVA?
Answer
# 4
First of all, MultiProcessing is different from 
MultiThreading. In MultiThreading the same processor 
executes the different threads. However there is no 
parallel processing of any thread done because finally, one 
processor can handle only one task at a time. You feel the 
computer is doing many tasks together because of the very 
small amount of time between task switching but the 
processor is actually doing only a single task. But how 
fast the processor is completing all the queued tasks 
depends upon the major factor that is the clock speed and 
many others too. But when you employ more than one 
processor, as in Servers with Multiple CPUs or in the 
latest Core2Duo or Core2Quad machines, MultiProcessing 
(technically known as Parallel Computing) comes into 
picture, where each thread of the same process is assigned 
to different processors (or cores in case of the multi core 
architectures) using fork-and-join method. In this case two 
threads of the same process is parallely executed by two 
processors (in case of 2 processors). In C/C++ Parallel 
Processing (MultiProcessing ) can be achieved by using the 
OpenMP library which is shipped with the latest Visual 
Studio compilers and the other compilers like GNU v4.2 and 
above and IBM and Intel compilers. You have to write the 
programs using the appropriate #pragma statements to fork 
and join for loops and also compile the programs with 
special flags. Multiple processor or multicore cpus are 
useless unless the software you write utilizes them.
My answer does not tell you how to do the same in Java but 
you will definitely understand what to search for i.e. 
libraries supporting MultiProcessing in Java.
 
Is This Answer Correct ?    0 Yes 1 No
Sharjith N.
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
what is Assertion? Wipro2
What are the similarities between an array and an ArrayList?  2
Can we place the any object to key attribute of HashMap<key,value>? HCL3
what is java  9
how to call One constructor from another; Innodata-Isogen7
Can we access a database using applets?  2
What are packages and name a few?  4
Name the class that used to read objects directly from a stream? Wipro2
Explain final, finalize() and finally?  6
What are teh sub-classes of a component class?  2
We can write any Java Logics in our JSP. Then why we are using servlets(Controller Layer) to interact with the DAO ? TCS2
what is stringtolennizer with example? Symphony1
What is object  6
Have you used any version control ? if so explain about it?  1
What is a native method?  2
EDS (Electronic Data Systems India Pvt Ltd) at Chennai on 16-12-2006. EDS1
What happens when a main method is declared as private? Sun-Microsystems8
Is 'sizeof' a keyword?  5
how can u create the object with out new operator  2
Howmany classes that package java.applet.* contains? TCS1
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com