Prepare a c program using the fork() system call

Assignment Help C/C++ Programming
Reference no: EM13707303

Question: The Collatz conjecture concerns what happens when we take any positive integer n and apply the subsequent algorithm:

n= n/2, if n is even

3 × n + 1, if n is odd

The conjecture states that when this algorithm is continually applied, all positive integers will eventually reach 1.

For case, if n = 35, the sequence is 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1

Prepare a C program using the fork() system call that generates this sequence in the child process. The starting number will be provided from the command line.

For case, if 8 is passed as a parameter on the command line, the child process will output 8, 4, 2, 1. Because the parent and child processes have their own copies of the data, it will be required for the child to output the sequence. Have the parent invoke the wait() call to wait for the child process to complete before exiting the program.

Perform required error checking to ensure that a positive integer is passed on the command line.

You need to prepare a program to make a system call - Use the c programming language to prepare this program.

Reference no: EM13707303

Questions Cloud

Establish shared-memory object between parent and child : the child process must output the sequence of numbers generated from the algorithm specified by the Collatz conjecture because the parent and child have their own copies of the data.
Write a program to implement a linear linked list : Write a C/C++ program to implement a singly linear Linked List
Function that will accept the three sides of a triangle : Create a function that will accept the three sides of a triangle (a, b, c) as scalar values, calculate the angles that correspond to these sides (alpha, beta, gamma), and return these angles to the function call in the script file.
Determine the total resistance of a number of resistors : Prepare a function that will determine the total resistance of a number of resistors that are connected in parallel.
Prepare a c program using the fork() system call : Perform required error checking to ensure that a positive integer is passed on the command line - Prepare a C program using the fork() system call that generates this sequence in the child process. The starting number will be provided from the comm..
Make a tundish model showing molten metal flowing : Make a tundish model showing molten metal flowing into a beaker kept below the tundish.
Describe process of setting the seimens pid block : Explain the process of setting the Seimens S7-12000 PID Block's status manual, to automatic. Be specific
Program that uses a library database of books : Write a Java program that uses a library database of books and patron data, as described in Exercise R22.2. Patrons should be able to check out and return books.
Write a program for keeping a course list : Write a program for keeping a course list for each student in a college. The information about each student should be kept in an object that contains the student's name and a list of courses completed by the student.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd