Task , Process & Thread are interlinked hierarchy , yet they are different .
this hierarchy can be
represented as...
- A Task is set of program instructions that are loaded in memory.
- A Process is an instance of a computer program being executed. It conatins the program code and its current activity .
- A Thread of execution results from a fork of a computer program into two or more concurrently running task.
HOW THREADS ARE DIFFERENT FROM PROCESS
A thread is contained inside
process. Multiple threads can exist witin the same process and share resources
such as memory , while different process do not share these resources.
A thread what CPU actually runs , its about
scheduling access to shared resources e.g. CPU .
A process is the allocated memory
for instruction data (a process needs one or more threads because that is what
is run by CPU ) , simply we hink of thread as a slice of time and a process as
a slice of space .
shortly............. :)
- processes are typically independent , while threads exists as subset of process.
- processes have seprate address spaces , where as threads share their adress spaces .
WHAT DO U MEAN BY SHARING OF ADDRESS SPACE???
ReplyDeleteHOW AN ADRESS SPACE WILL BE SHAREED BY A THREAD???
both process and threads are independent sequence of execution . typical difference is that threads (of same process) run in a shared memory space while process run in seperate memory space. thread are an operating environment feature , rather then cpu feature .
ReplyDeletesharing of add. space term is used for threads only..... could be explain furthur
thank u ..shubham
Deleteas for improving the interprocessing within a process threads are formed (these r light weight process ) . There is one address space for whole process & different threads(belong to same process) share everything like objects , heaps etc... to reduce context switching time and reusing info required for processing again and again.
ReplyDeleteok....agree with ur explaination.. !!!
ReplyDelete