Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When you apply a fork(), the parent and child
a) Share memory
b) Do not share memory
c) Share a small part of the memory
d) They can communicate via arrays


Given this piece of code int fd[2];pipe(fd); this means that
a) The parent can write in fd[1] and the child can also write in fd[1]
b) If the parent read from from fd[0] , the child also can read from fd[0]
c) If the parent wrote in fd[1] , the child can read from fd[0]
d) All of the above are correct and sounds logical


What I have tried:

Question 1 I think that when you apply fork they share memory
Question 2 N/A
Posted
Updated 11-Jul-21 22:21pm
Comments
[no name] 11-Jul-21 13:50pm    
1) Processes don't share memory.
2) fd[0] is for reading; fd[1] for writing; so, all of the above.

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

We are not here to answer your exams for you ...
 
Share this answer
 
You need to understand that basic command to apply it the right way in your career. So watch this Tutorial about fork to learn.
 
Share this answer
 
See my (partial) answer at I'am facing trouble solving this question .[^]. You could solve this for yourself by actually writing and testing some code.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900