What is the difference between Process and Threads?
Answers were Sorted based on User's Feedback
Answer / rekha
A Procees is an execution of program but a thread is a
single execution sequence within a process(and so called
a "light weight process").
A process can contain n number of threads.
Is This Answer Correct ? | 168 Yes | 11 No |
Answer / sathya
Process are heavy weight programs which consume considerable
amnt of memory for execution and are heavily dependent on
system resources for their execution
Threads are light weight and use the min available sys
resources as a whole and can execute simultaneously to
acheive a given task.
Is This Answer Correct ? | 130 Yes | 23 No |
Answer / shani kr. gupta
Process is a program in execution.
Suppose there r two processes that means that occurs at
different-different memory location. and the context
switching b/w process is more expensive.bcz it will take
more time from one memory allocation to other memory
allocation.that is why Process is called HEAVY WEIGHT PROCESS.
Thread is smallest part of program.and It is independent
sequential path of execution with in a program.
Suppose there r two threads that means that occurs at same
memory location bcz of smallest part of program.
and the context switching b/w threads is less expensive
rather than process.that is why Thraed is called Light
WEIGHT PROCESS.
Is This Answer Correct ? | 84 Yes | 9 No |
Answer / biswajit padhan
The major difference between threads and processes is
1.Threads(Light weight Processes) share the address space
of the process that created it; processes have their own
address
.2.Threads have direct access to the data segment of its
process; processes have their own copy of the data segment
of the parent process.
3.Threads can directly communicate with other threads of
its process; processes must use interprocess communication
to communicate with sibling processes.
4.Threads have almost no overhead; processes have
considerable overhead.
5.New threads are easily created; new processes require
duplication of the parent process.
6.Threads can exercise considerable control over threads of
the same process; processes can only exercise control over
child processes.
7.Changes to the main thread (cancellation, priority
change, etc.) may affect the behavior of the other threads
of the process; changes to the parent process does not
affect child processes.If we consider running a word
processing program to be a process, then the auto-save and
spell check features that occur in the background are
different threads of that process which are all operating
on the same data set (your document).
Is This Answer Correct ? | 62 Yes | 7 No |
Answer / dinesh tiwari
A process is an instance of an running application.
And a Thread is the execution stream of the process.
A process can have multiple threads.
Is This Answer Correct ? | 30 Yes | 6 No |
Answer / shilpi
In Process switching time consume
but thread does not consume switching time.
Is This Answer Correct ? | 20 Yes | 11 No |
Answer / srinivas
Thread is nothing but functionality(group of statements)
which could be executed simultaneously with the other part
of the program, with the concept of each other.
Where as a process is nothing but 'a program which is under
execution'. Thread is a part of the process
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / kamran
The key difference is that processes are fully isolated
from each other; threads share (heap) memory with other
threads running in the same application.
Is This Answer Correct ? | 17 Yes | 12 No |
Answer / alok mmmec gkp
THE BASIC DIFFERENCE B/W THREADS AND PROCESSS IS THAT
THREAD CONTAINS A STACK IN WHICH USER N KERNAL PROCESS ADDRESS
ARE STORED
FOR EVERY STEP A NEW PROCESS IS CREATED IN THE PLACE OF IT
THREADS USES ITS STACK
Is This Answer Correct ? | 28 Yes | 24 No |
Answer / yash modi
In threading environment,one portion of program can run
independently of other portions.
Is This Answer Correct ? | 4 Yes | 1 No |
what's the main difference between unix os and linux os?
How to get an image from db2 database plz help as soon as possible
What are the different algorithms used for clustering?
what we can't do in jdbc but can do hibernate?
What is scalable, portability in the view of J2EE?
What happens when a thread cannot acquire a lock on an object?
JMS based on what technology?
Name the eight primitive java types.
1) which method of the RequestDispatcher cannot be called once the output is sent to the client? a. forward b. include c. both a&b 2) which interface should an object implement to get notified of changes to the list of active sessions in a web application? a. HttpSessionListener b. HttpSessionActivationListener c. HttpSessionAttributeLIstener 3) A user can select multiple locations from a list box on an HTML form, which of the following methods can be used to retrieve all the selected location? a. getParameter() b. getParameterValues() c. getParamValues() 4) which of the following methods should be used to send character text to the client? a. ServletResponse.getWriter() b. ServletResponse.getOutputStream() c. ServletResponse.getOut() 5) which implicit object is always available in a JSP page? a. exception b. session c. out 6) which inclusion mechanism doesn't include the source of the page, rather the output of the page. a. include directive b. jsp:include action c. Bothe a& b 7) which attribute of the page controls whether a page participates in session or not? a. session-allowed b. session c. isSession
Is the session factory thread safe?
java is fully object oriented languages or not? why?
What are the high-level thread states?