Question

In: Computer Science

Explain five differences between a fork and thread

Explain five differences between a fork and thread

Solutions

Expert Solution

Solution:

Fork Thread
  • A fork is used for giving a new process which itself is the copy of current process having code segment same as current process with separate memory space.
  • A process can have multiple threads ,and the execution of all the threads of any process takes place parallely
  • There is no shareing of memory between the two processes (because they both have different behaviour),So both the processes are assigned separate memory.
  • There is no separate memory for threads ,memory and all other resouces are shared between the threads.So we can easily access shared data
  • Forks look same as the parent process but they have different process id and separate memory
  • Threads have unique thread id and same process id
  • The file lock that the parent process has set ,the child process does not inherit it
  • File locks set by parent process is also inherited by thread
  • Forking result in more overhead when compared to threads because we have to assign new separate memory and environment for the process
  • Thread has less overhead when compared to forking because thread does not require any separate memory and environment for the process execution
  • fork are the copy of parent process so it look same as the parent process
  • Thread is a light weigted process
  • forking is faster as their is no need of context switching
  • Threads are slow because we need to perform context switching between the threads while execution. It is faster in case of multithreaded system
  • The portability of fork is more when compared to threads
  • Threads are less portable than fork
  • Debugging of code is easy on fork
  • Debugging is hard in threads
  • The crash of one process does not affect other process
  • The crash in one affect the other because they have same memory space
  • forking is more secure than threading due to separate memory space
  • Threading is less secure than fork because of shared memory
  • Inter process communivcation is costly in forks
  • Interprocess communication between threads is easy and less costly
  • Forking is easy to program when compared to threads
  • Threads are hard to program

Note: If you dont need all the above differences mentioned,you can choose any five differences that you want

If you find my answer helpful,please give thumbs up.


Related Solutions

Explain FIVE differences between a financial statement and an internal audit engagement.
Explain FIVE differences between a financial statement and an internal audit engagement.
1. Explain FIVE functional differences between commercial and commercial banks investment bank.
1. Explain FIVE functional differences between commercial and commercial banks investment bank.
Explain in details five (5) differences between target pricing and cost-plus pricing.
Explain in details five (5) differences between target pricing and cost-plus pricing.
Process & Thread Management differences in Windows10, Linux, and Andriod.
Process & Thread Management differences in Windows10, Linux, and Andriod.
In tabular from explain any five differences between break-even point and shutdown point.
In tabular from explain any five differences between break-even point and shutdown point.
Employees in Québec receive both a T4 and a RL-1 information slip. Explain five differences between...
Employees in Québec receive both a T4 and a RL-1 information slip. Explain five differences between the two slips.
Post a discussion thread distinguishing between the micro and macro views of marketing. Then explain how...
Post a discussion thread distinguishing between the micro and macro views of marketing. Then explain how they are interrelated, if they are. Your post should be thorough, utilizing the text, your personal experience, and any other information you are able to garner through research. A minimum of 150 words is expected to achieve full credit.
Explain the differences between copyright and plagiarism
Explain the differences between copyright and plagiarism
What are the five main differences between a Income statement that is produced by a for-profit...
What are the five main differences between a Income statement that is produced by a for-profit company versus a local government Statements of Revenue, Expenditures and Changes in Fund Balances?
Similarities and differences between the five-stage model and punctuated equilibrium model?
Similarities and differences between the five-stage model and punctuated equilibrium model?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT