Write a C program that create parent-child processes using the fork() system call. The child process should do the following tasks: Printout its PID and the PID of its parent. Check whether the value provided by the parent is a prime number or not. Return 0 to the parent if the number is not prime, otherwise 1. The child uses PIPEs to communicate the result to the parent. The parent process should do the following: Ask the user to enter an integer < 100. Create a child, and pass the user’s entered value using PIPEs. Wait until the child finish execution, and returns either 0 or 1 to the parent. Printout whether the entered value was prime or not
Write a C program that create parent-child processes using the fork() system call. The child process should do the following tasks: Printout its PID and the PID of its parent. Check whether the value provided by the parent is a prime number or not. Return 0 to the parent if the number is not prime, otherwise 1. The child uses PIPEs to communicate the result to the parent. The parent process should do the following: Ask the user to enter an integer < 100. Create a child, and pass the user’s entered value using PIPEs. Wait until the child finish execution, and returns either 0 or 1 to the parent. Printout whether the entered value was prime or not
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
Related questions
Question
Write a C program that create parent-child processes using the fork() system call.
The child process should do the following tasks:
Printout its PID and the PID of its parent.
Check whether the value provided by the parent is a prime number or not.
Return 0 to the parent if the number is not prime, otherwise 1.
The child uses PIPEs to communicate the result to the parent.
The parent process should do the following:
Ask the user to enter an integer < 100.
Create a child, and pass the user’s entered value using PIPEs.
Wait until the child finish execution, and returns either 0 or 1 to the parent.
Printout whether the entered value was prime or not
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images
Knowledge Booster
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
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning