top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is a Thread and how it is different from Process?

+3 votes
763 views
What is a Thread and how it is different from Process?
posted Jul 18, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Process is nothing but a program in execution. Memory layout of a program consists of
1. Text Section : This section contains the code of a program.
2. Initialized Data Section : This section contains initialized global data.
3. Uninitialized Data Section : This section contains uninitialized global data.
4. Stack : This section contains auto variables.
5. Heap : This section is used to get memory dynamically.

If you have only a single process with main() thread only then there will be a single flow of execution and parallel execution can't be
achieved even having multiple functions.

Thread is a light weight process and by using multiple threads within a program, multiple function or the same function can be run simultaneously. There is a minimum overhead of a thread creation comparison to process creation. A thread shares code, data (initialized and uninitialized) and heap section with main thread / process.

answer Jul 18, 2015 by Neeraj Mishra
0 votes

Adding on top of what Neeraj has suggested -

A thread is a flow of execution through the process code, with its own program counter, system registers and stack. A thread is also called a light weight process. Threads provide a way to improve application performance through parallelism. Threads represent a software approach to improving performance of operating system by reducing the overhead thread is equivalent to a classical process.

Thread vs Process

answer Jul 18, 2015 by Salil Agrawal
Similar Questions
0 votes

I heard the term "worker thread" and other types of threads such as "system thread" and "user thread".
For me a thread is nothing but a lite weight process and multi-threaded design is chosen for a software development when there are multiple task in the application/system and those tasks can be executed independently.
I want to know when these different terms are used like worker thread, user thread and system thread ?

...