Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Section 1 Write a program in C/C++ that: • Spawns two processes. • Each process

ID: 3676438 • Letter: S

Question

Section 1
Write a program in C/C++ that:
• Spawns two processes.
• Each process executes an infinite loop and waits for the parent process to send them a signal.
• After 5 seconds, the parent sends the signal SIGINT to both children.
• Upon receiving the signal, the children print their own pid and the pid of the parent and terminate.
Section 2
Modify the program from Section 1 so that upon receiving the signal:
• the first child process, lists all the elements in the “/home” directory
• the second child process, sends a SIGQUIT signal to the parent
• when the parent receives the SIGQUIT signal it prints the message “Now I have to terminate” and exits. The parent should not terminate otherwise.
Section 3
Write a program that creates three processes and gets as an input from command line an integer number N (N > 10).
• The first process prints the numbers [0, N/3) continuously (the process should never finish).
• The second process prints the numbers [N/3, 2N/3) continuously (the process should never finish).
• The third process prints the numbers [2N/3, N] continuously (the process should never finish).
• After 5 seconds the father should send a SIGKILL signal to the three children.

Explanation / Answer

///////////////////////////////////////////////////////////////////////////////////

section 3:

  

SIGINT Terminate process Terminal line hangup
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote