(Solved) : Operating Systems Programming Help C C Please Help Help Provided Appreciated Implement So Q41374837 . . .

Operating Systems Programming Help (C/C++). Please Help. Anyhelp provided is appreciated.

Implement a software system which involve 4 programs executingconcurrently: ProbeA, ProbeB, ProbeC and DataHub. The Hub receivesdata from the 3 probes. It outputs the identity (PID) of the probeand the data that was sent from its probe. The Hub needs to executein a manner which does not arbitrarily delays the execution of anyprobe software.

BEHAVIOR OF EACH PROBE

Each probe produces its own reading4 to send to the DataHub,until the probe terminates. While each probe sends the Hub itsvalid reading (see below) it produces, each probe behavesdifferently: For each reading ProbeA sends to the Hub, it waits toreceive an acknowledgement (return message) from the Hub, before itcontinues to generate its next reading. Unlike ProbeA, the other 2probes must not receive any acknowledgement from the Hub.

VALID READING

A valid reading is defined as: A random integer5 that isdivisible by its magic_seed6 (see footnote). Thatis, any randominteger which is not divisible by any magic_seed is discarded. The3 magic_seeds (alpha, beta, rho) must satisfy this mathematicalcondition: alpha > 3 * beta > rho. ProbeA would use alpha asits magic_seed, beta is used in ProbB and rho goes with ProbeC.Furthermore, each magic_seed needs to be chosen to be sufficientlylarge, depending on the speed of your CPU7. You maytry 997, 257,251 initially, although there may require some experimentation inchoosing them. Choose alpha, beta and rho that are sufficientlysmall to avoid filling the queue instantly

PROBE TERMINATION

Each probe terminates differently. ProbeA terminates when itproduces a random integer smaller than 100. After the Hub hadreceived a total of 10,000 messages, the Hub forces ProbeB to exit.This requires using the force_patch file provided. Lastly, the useruses a kill command in a separate terminal to kill ProbeC. Thisrequires using the kill_patch file provided. Finally, the DataHubterminates after all 3 probes had exited.There are a number of waysto design8 (e.g., handling non-existing queue exception, protocolfor exchanging messages) & implement this system. Each designlikely has advantages & disadvantages. Therefore, it isimportant that students explain the rationale of their chosendesign & implementation.

Kill Patch Header File

#include<iostream>#include<signal.h>#include<unistd.h>#include <sys/types.h> // the function sends one message to the queue, when the user enters the kill command (SIGUSR1) & terminates the process// qid – id of attached queue (retval from msgget)// exitmsg – pointer to message object contains the exit message to its recipient// size – size of the message object// mtype – mtype associated with this message objectvoid kill_patch(int qid, struct msgbuf *exitmsg, int size, long mtype);

Force Patch Header File

#include <sys/types.h>#include <signal.h> // the function signals the process to terminate (SIGKILL)// pid of the process to terminateint force_patch(pid_t pid);

Expert Answer


Answer to Operating Systems Programming Help (C/C++). Please Help. Any help provided is appreciated. Implement a software system w…