|
Multi-threading - Oct 29, 2008, 17:35 pm by Amit Satpute
Define Thread.
Threads are small processes that for parts of a larger process. A thread is
contained inside a process. Different threads in the same process share some
resources.
What are the advantages of using Thread?
Some advantages of using threads are:
- A process switching takes a longer time than that by threads.
- They can execute in parallel on a multiprocessor.
- Threads can share address spaces.
Compare Thread and process.
Threads
Share address space
Have direct access to data segment of its process
Can communicate with other threads of the same process
Have no overhead
If a main thread gets affected, other threads to can get affected
Processes
Have own address space
Have own copy of data segment of the parent process
Processes must use IPC for communication within sibling processes
Have considerable overhead
Change in a parent process has no effect on the child processes.
-
Define Thread.
-
What are the advantages of using Thread.
-
Compare Thread and process.
|