Question: I am using a windows computer with vagrant VM to use UNIX . I have no idea where to start with this. Am I basically
Our first (non-trivial) program! Now we can create something non-trivial. The objective in the programming exercise is to communicate text between processes. Later, we will find elegant ways to do this, but for now, one method that will work is to use text files stored on disk as a medium of exchange. I would like you to write a program as follows: Generate and store I would like you to write a program with the following behavior: Prompt the user to enter some text After text is entered, use fork to create a new process. Make sure the child is aware of the text that has been entered. Let's call this string userData. At this point the main routine goes back to waiting for new user input. User input of "Done" should terminate the main process and all its children. Each child process should open a separate text file on the hard disk. The name of the file is up to you, so long as it allows you to distinguish one process from another (tip: use getpid()). Once per second, the child should write the new string, userData, that it received at the fork to the file on a new line. Example: I typed in 2 different inputs, I should have 2 children. Each of these children has their own userData writing in their own separate files. o Children never terminate unless externally killed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
