what is the child program and parent program for this?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

what is the child program and parent program for this?

Child program:
Each random number will be created by a child process (a separate program) and
returned as the exit status.
1. Create a child program that generates a random number between 1 and 100
(inclusive).
1. If you are using C++, you might consider std::mt19937
2. This is a Mersenne Twister which generates 32-bit numbers with a
state size of 19937 bytes.
3. See: https://en.wikipedia.org/wiki/Mersenne_Twister
4. Links to an external site.
5.
2. Your program should introduce a delay within a random interval of 200-600
microseconds.
1. You may utilize usleep(3) for this delay.
3. Your program will return the generated number as the exit status from the
main() function.
1. You can return this value.
2. You can also pass it as a parameter to exit(2)
4. You can test your program by running it from the shell.
1. Echo '$?' in the shell to display the exit status of the last executed
program.
Transcribed Image Text:Child program: Each random number will be created by a child process (a separate program) and returned as the exit status. 1. Create a child program that generates a random number between 1 and 100 (inclusive). 1. If you are using C++, you might consider std::mt19937 2. This is a Mersenne Twister which generates 32-bit numbers with a state size of 19937 bytes. 3. See: https://en.wikipedia.org/wiki/Mersenne_Twister 4. Links to an external site. 5. 2. Your program should introduce a delay within a random interval of 200-600 microseconds. 1. You may utilize usleep(3) for this delay. 3. Your program will return the generated number as the exit status from the main() function. 1. You can return this value. 2. You can also pass it as a parameter to exit(2) 4. You can test your program by running it from the shell. 1. Echo '$?' in the shell to display the exit status of the last executed program.
Parent program:
The parent program will create 100 child processes, each running the program created
above.
1. You must create all 100 processes before doing anything else.
1. The fork(2) and execve(2) system calls should be used.
2. After creating ALL of the child processes, the parent program will wait for
each child to exit.
1. Your children will exit in a random order.
2. Use the wait (2) system call to obtain the exit status.
3. Add this to your running total.
4. Keep track of how many children are still running (or how many
have exited)
3. After ALL of the child processes have exited, print out the sum of their
generated values.
Transcribed Image Text:Parent program: The parent program will create 100 child processes, each running the program created above. 1. You must create all 100 processes before doing anything else. 1. The fork(2) and execve(2) system calls should be used. 2. After creating ALL of the child processes, the parent program will wait for each child to exit. 1. Your children will exit in a random order. 2. Use the wait (2) system call to obtain the exit status. 3. Add this to your running total. 4. Keep track of how many children are still running (or how many have exited) 3. After ALL of the child processes have exited, print out the sum of their generated values.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Top down approach design
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education