Question: This is an Operating systems problem. Please modify the following C-code to do the following things: Things to modify the code with:: 1.the child process

This is an Operating systems problem. Please modify the following C-code to do the following things:

Things to modify the code with::

1.the child process generates this sequence of numbers{ 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1} instead of simply printing out a message

2.The child process should take the user input n from the command line and print out the sequence of numbers.

Here is more background info to help with number 2 of the modification:

This is an Operating systems problem. Please modify the following C-code to

3. The parent invoke the wait() call to wait for the child process to complete before exiting the program

4.The parent process to take the user input n and send it to the child process using the named pipe. Once receiving the user input from the parent process, the child process should print out the sequence of numbers.

C Code to modify:

#include #include // for wait() #include // for fork()

int main() { int n = fork(); if (n > 0) //when n is not 0, then it is parent process { wait(NULL); std::cout

return 0; }

The Collatz conjecture concerns what happens when we take any positive integer n and apply the following algorithm: 11 = { n/2, if n is even 3 x n +1, if n is odd The conjecture states that when this algorithm is continually applied, all positive integers will eventually reach 1. The Collatz conjecture concerns what happens when we take any positive integer n and apply the following algorithm: 11 = { n/2, if n is even 3 x n +1, if n is odd The conjecture states that when this algorithm is continually applied, all positive integers will eventually reach 1

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 Databases Questions!