Question

Compare fork (process creation) and thread creation, especially regarding the resource sharing. Explain what is race...

Compare fork (process creation) and thread creation, especially regarding the resource sharing.

Explain what is race condition, and how to prevent race conditions

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer)
The instance of the application which is running on the system is known as the process. Forking the process means we want to duplicate it from the current point of execution. So the new process or child process is created and will have the same state as it's the parent at the time it was forked. Unlike threads created, each of the forked processes has their own memory to which the information is copied. Thus processes are thread safe. When the process is forked, the new child process will go on its own execution path.
Threads are small processes which and are created by an application and this shares the same state and memory space. Creating threads require less memory than new processes, and all threads share the same application data.
The race condition occurs when one thread tries to access the same resource at the same time and minimum 2 or more than 2 process try to access the resources at the same time. We can solve race conditions by using the synchronized block or synchronized method.

Add a comment
Know the answer?
Add Answer to:
Compare fork (process creation) and thread creation, especially regarding the resource sharing. Explain what is race...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT