Create a main program c or c in linux that will accept as a


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

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create a main program c or c in linux that will accept as a
Reference No:- TGS01481994

Now Priced at $30 (50% Discount)

Recommended (92%)

Rated (4.4/5)