Question: This question requires you to implement a user program in xv 6 - riscv. This program will make use of system calls fork, pipe, read,

This question requires you to implement a user program in xv6-riscv. This program will
make use of system calls fork, pipe, read, and write.
Task: Write a user program in xv6, name it pingpong. It should do the following:
(a) Create a child process.
(b) The parent will send an integer to this child process.
(c) Upon receiving this integer, the child process prints its PID followed by the value of
the integer it received.
(d) The child process should multiply the received integer by 4 and send the resulting
integer back to the parent.
(e) The parent prints its PID followed by the value of the integer it received from the
child.
Example of usage:
$ pingpong
4 Integer from parent =4
3 Integer from child =16
Requirements: Communication between the parent and child process should be
through pipe. Your implementation must only establish a single pipe. Marks could be
deducted for lack of comments in your program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!