Lab Assignment #3 Solution



Points to note:

This assignment will contribute to 5% of the total grade/marks in this course.

This is a strict deadline and no extensions will be given, unless there are medical or other extenuating circumstances.

Any act of plagiarism will result in zero marks for the entire assignment.

Consider any website, where users can post review comments on products and/or services. Given N nodes, suppose each of the nodes generates a text comment with a probability of 0.7 periodically every T seconds.

Required: Aggregate all of the text comments posted by all of the N nodes and show these comments as outputs in a file. The output file should contain the node ID, which posted the comment, and the comment itself.

For purposes of this assignment, any given comment could simply be a string of characters.

The value of N should be at least 5.

The sequence of the comments is not relevant for this assignment, but you need to ensure that all of the comments are reflected in the output file along with the corresponding node IDs.

Note: You can either simulate N processes in a single machine or you could use N different machines to complete the above assignment.

A potential solution: Designate a node as a Master node (clientserver architecture). Each process/node writes the comments along with its node ID in a separate file. Periodically, each process/node sends its file to the Master node. The Master node then collates/aggregates all of these individual output files to produce the final output file.

You can also please feel free to explore other solutions.