Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

Has the team been empowered to prioritize the issues?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago

Question

c. How is trust demonstrated?

Answered: 1 week ago