Posts

Showing posts from March 28, 2019

Interprocess Communication in a Farmer-Worker setup

Image
up vote 15 down vote favorite 1 The following code is my first C program I have made for an university assignment about Interprocess Communication. This involved creating a parent process, the farmer, and then creating a certain number of forked processes, the workers, and we had to let the workers calculate something and use message queues to communicate it from the parent to the worker and vica versa. The computations were chosen to be Mandelbrot computations by the teacher. The goal of the assignment was to get familiar with the POSIX libraries. These were the functional requirements, in my own words: The program must use the settings from settings.h The farmer starts NROF_WORKER worker processes The message queues have a size of MQ_MAX_MESSAGES messages The names of the message queues had to include the student name a