Create a main program that accept as command line parameter

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

Create a main program (C or C++) in Linux that will accept (as a command line parameter) a number of seconds that the main process is to run, as well as a number of work processes to be created. The function of the main program will be to create a number of new work processes that will generate prime numbers starting at a given number. (For example, if I create 3 processes, the first would identify primes from 1000 to 2000, the second would identify pri mes from 2000 to 3000, etc.) .When the main program starts, it should start an alarm timer set to the length of time specified on the command line. The main program should then create the desired number of new processes and assign a "range" to each. At this point, the program is multiprocessing. I should have several active processes running in the kernel. I should use an alarm timer and a signal handler to catch a signal when the alarm times out. After the main process has created all of its processes, it needs to wait around until the timer expires. When the timer expires the main program should explicitly kill all of its child processes and then terminate itself. The output should be as below: In process 1 found another prime number 1009 A new process is created with process id 32177 In process 2 found another prime number 2003 A new process is created with process id 32178 In process 3 found another prime number 3001 A new process is created with process id 32179 Number of processes created from this program is 3 In process 1 found another prime number 1013 In process 2 found another prime number 2011 In process 3 found another prime number 3011 In process 1 found another prime number 1019 continued

Reference no: EM131103993

Questions Cloud

What will happen to the amount of apples : What will happen to the amount of apples and oranges that you choose to consume? Explain.
Write a research paper about suicide : Write a research paper about Suicide. Complete the following assignment by filling in all pertinent areas of research. You will need to utilize SPSS for this assignment. You may complete this assignment using the variables and topic.
Tools & techniques of financial planning : 1.  Rahul and Miranda want to make a lump-sum investment for their newborn's college education, and their goal is to accumulate $80,000 in 18 years. What is the amount they must invest today to reach their goal if the annual rate of return is 8%?
What impact will the substitution effect and income effect : What impact will the substitution effect and income effect have on the quantity demanded of coffee if coffee is an inferior good? Explain.
Create a main program that accept as command line parameter : Create a main program (C or C++) in Linux that will accept (as a command line parameter) a number of seconds that the main process is to run, as well as a number of work processes to be created. The function of the main program will be to create a nu..
Estimate the average number of cigarettes smoked per person : Use the regression line to estimate the average number of cigarettes smoked per person in 2001, to the nearest integer. Show some work. In what year (to the nearest year) does the regression line estimate an average number of cigarettes smoked per p..
How would you go about deciding whether person : How would you go about deciding whether person A or person B gets more personal benefit from each of the following:
Which likely to be nearly perfect complements explain : Which of the pairs of goods above is likely to be nearly perfect substitutes and which likely to be nearly perfect complements? Explain.
Vendor sells newspapers and tries to maximize profits : A news vendor sells newspapers and tries to maximize profits. The number of papers sold each day is a random variable. However, analysis of the past month's data shows the distribution of daily demand in Table 16. A paper costs the vendor 20¢. The..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  C++ program that reads in two positive integers

Write a C++ program that reads in two positive integers that are 20 or fewer digits in length and outputs the sum of the two numbers.

  Write an interactive c program to process the exam scores

Write an interactive C program to process the exam scores for a group of students in a C programming course. Begin by specifying the number of exam scores for each student.

  Program on basic arithmetic operation

Two integers must be compared before the arithmetic operation and Subtract the two integers provided the first integer is greater than the second integer, otherwise add the two integers and subtract the second integer from the first integer.

  Enter the temperature at noon of each of the five days

Write a program that allows each employee to enter the temperature at noon of each of the five days and displays the highest, lowest, and average (mean) temps.

  Function to compute total motion for single signal input

A control system applies a force to an actuator proportional to the voltage of a signal coming into the control system. It is desired not to allow actuator to quiver back and forth in the presence of small corrections near zero-force point. More f..

  Create a two-dimensional array

Describe a problem where you might need to create a two-dimensional array to accurately model the data, and describe how you would use the data to help solve the problem.

  Write a program that simulates inventory bins in a warehouse

In C++, write a program that simulates inventory bins in a warehouse. Each bin holds a number of the same type of parts. The program should use a structure that keeps the following data:

  Write a declaration for s structure named car

Write a declaration for s structure named cars. The fields in the record should include make, model, year and cost. Include a constructor to initialize the value in the structure.

  How to declare c++

How to declare C++

  Write a class with the following static methods

Wordcount: This method should accept a reference to a String object as an argument and return the number of words contained in the object.

  What is a cell reference

What is a cell reference (also called a cell address) and what is the significance of being able to use them in spreadsheet formulas?

  Write a small program scropy

You are supposed to write a small program scropy, which takes two arguments on the command line: the names of a source file and a destination file.

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