Explore BrainMass

Explore BrainMass

    C program to synchronize parent and child processes

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a C program that synchronizes a parent and a child process in such a way that the output of the program will be:

    Child process, iteration: 1
    Parent process, iteration: 1
    Child process, iteration: 2
    Parent process, iteration: 2
    Child process, iteration: 3
    Parent process, iteration: 3
    Child process, iteration: 4
    Parent process, iteration: 4
    Child process, iteration: 5
    Parent process, iteration: 5
    Child process, iteration: 6
    Parent process, iteration: 6
    Child process, iteration: 7
    Parent process, iteration: 7
    Child process, iteration: 8
    Parent process, iteration: 8
    Child process, iteration: 9
    Parent process, iteration: 9

    Please use the attached example file, and change it accordingly.

    You must use ONLY SIGNALS for synchronization between the child and the parent processes. The use of "sleep()" system call is not allowed.

    © BrainMass Inc. brainmass.com March 4, 2021, 9:37 pm ad1c9bdddf
    https://brainmass.com/computer-science/c/c-program-to-synchronize-parent-and-child-processes-259597

    Attachments

    Solution Preview

    Attached sample implementation 259597.c has been tested working on Fedora 7 Linux installation after ...

    Solution Summary

    Code assumes no loss of signals delivered to the program. Sometimes signals delivered to the program can get lost, in which case the program is likely to hang.

    $2.49

    ADVERTISEMENT