Purchase Solution

C program to synchronize parent and child processes

Not what you're looking for?

Ask Custom Question

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.

Attachments
Purchase this Solution

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.

Solution Preview

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

Purchase this Solution


Free BrainMass Quizzes
C# variables and classes

This quiz contains questions about C# classes and variables.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.