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

Design and implement an “event tracking” system in C++. Events (a random number

ID: 3589483 • Letter: D

Question

Design and implement an “event tracking” system in C++. Events (a random number that is divisible by some pre-assigned "marker" integer) are generated internally by 3 software components. The receiver program is notified whenever a sender program observes an event – a random number that is divisible by its marker value. Assume an infinite message storage capacity (obviously not true). State and document additional constraints and assumptions in your design and implementation.

This assignment consist of 5 separate components/programs that execute concurrently. Three programs are sending data to 2 receiving programs. The sender generates random numbers (full range from rand function). Each sender is assigned one of 3 markers (251, 997 or 257) & sends any random number that is a divisible by its marker to the appropriate receiver. The 997 sender terminates when it gets/observes a random number smaller than 100, and it requires acknowledgement for each data item from both receivers (that its data is received) before it continues. The other 2 senders do not accept ack message and terminate after its receiver had terminated. The 251 sender terminates by 'kill' command and the 257 sender terminates when its receiver had terminated.

Each receiver repeatedly gets a message & display its (along with the identity of the sender). One receiver gets messages with any random value that is a multiple 251 or 997. This receiver only terminates after both of its sender had terminated. The second receiver gets messages with a random value that is a multiple of 997 or 257. This second receiver terminates after it has received a total of 5000 messages. (Also, remember to send the ack.)

Explanation / Answer

a. For Sender Programme

b. For Receiver Programme

3.Compile Both programmes

4. We will create 5 process like

a. Run Sender Programme 3 times in different Shell (Command line Editor) with different Marker values   

  (251/257/977)

b. Run Receiver programme 2 time with different Reciever type (1/2)

5. Each sender will create a POSIX Message Queue with ID (251/257/977) based on the Marker value

6. Each server will do following in infinete loop

a. Generate a Random value

b. Divide by its Marker , sedn a Message to Message Queue if reminder is 0

Receivers will receive it

7. Each receiver will do following

a. Open Message queue with Id as Senders Marker value

b. Receive Messages infinetly in loop and print the Events received

The below programmes are not tested completely due to no time. tomorrow i will test . Please understand by Comments in Code and Comment if any problems

Sender Programme (sender.cpp)

----------------------------------------------------------

Receiver Programme (receiver.cpp) :-

----------------------------------------------------------------

How to Run :-

---------------------

compile each one

   1. g++ sender.cpp -o sender

   g++ receiver.cpp -o receiver

Run sender 3 times as below in different command line windows (with markers 251/257/977)

   $ ./sender 251

     $ ./sender 257

     $ ./sender 977

Run 2 receivers as below

   $ ./receiver 1

  $ ./receiver 2

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