ECE428 Machine Programming 0


Rate this product

Page 1

ECE428 Machine Programming 0

The objective of this MP0 is to create a simple network application. You can receive up to 5
marks for this MP, if you work yourself or with another student, and 2.5% (2%) if you work in a
group of 3 (4) students. You can use any programming language, however, please contact the
TA first, if you want to use language other than C/C++, Java or Python.
Task 1
Event logging is fundamental for monitoring the operation and performance of processes in
distributed systems. It enables debugging and diagnostics, and creates understanding of what is
happening. In this MP, the task is to implement a simple logger that receives messages from
multiple network nodes, and store them in a centralized log. This will be useful in the next MP.
The network node should use the Python script, which generates messages for
random events. The generator script can be given two input arguments. The first argument
defines the average rate of generated events/messages, and the second argument limits the
total number of generated events/messages. For instance, the rate 0.1 events/second means
that, on average, there is one event every ten seconds. The messages are represented by
random string of characters preceded by timestamps. The timestamps are expressed as the
fractional number of seconds since January 1st 1970 (Unix standard).
The centralized logger should allow other network nodes to send their messages to the logger
using TCP protocol on a port specified as a command-line argument. For instance, the
command logger 1234 starts the logger, and it then accepts the node connections and their
messages at port 1234. The logger should write into a log file the node name and its connection
time, its messages, and when the node disconnects. A sample log file may look like this:
1579666871.892629 – node1 connected
1579666871.9974 node1
1579666872.10252 node1
1579666872.2044811 – node2 connected
1579666872.307186 node1
1579666872.409765 node2
1579666872.514535 – node2 disconnected
1579666872.614976 node1
1579666872.7168908 – node3 connected
1579666872.820116 node3
The network nodes can be implemented as receiving the messages/events from the standard
input, and their main task is to send the messages to the centralized logger:
Page 2
% python3 -u 0.1 | node node1 1234
The first argument of command node is the node name, and the second and the third arguments
are the IP address and the port number of the centralized logger. Note that if the port number
specified here is different from the one that was used to start the logger, no messages can be
received by the logger.
The overall procedure is to first start the logger, and have it listening for messages at a given
port. Then launch several network nodes locally on the same machine as the logger using
standard IP for a local host. Multiple nodes can be launched in different sub-shells
using &✁, or in different terminal shells.
Task 2
Once the network (distributed) system is working, we can evaluate the produced log file. For
instance, we can track the following two metrics: (1) the time difference or delay between the
time the event was generated, and when it was recorded in the log file, (2) the network
bandwidth used by the logger. For instance, the logger can use the current time when the
messages are being written to a log file, and also count the number of bytes received in all
messages from all the network nodes over time. The metric values can be directly stored by the
logger into a separate file, or send to a standard output, and redirected into a file by the shell.
For instance, the output file with the two metrics may look like this:
# node, delay [sec], bandwidth [bytes/sec]
A, 0.532, 835.333
A, 0.388, 953.237
B, 0.120, 1340.640
A, 0.622, 380.333
More specifically, perform the following experiment. Setup three nodes A, B and C. The nodes B
and C each generate 100 messages at the fixed average rate RB=1.0 and RC=2.0, respectively.
The node A also generates 100 messages at the fixed average rate RA={ 0.1, 0.2, ✂, 1.0 }. Plot
the average, maximum, and minimum delays and the bandwidth used by the logger as a
function of RA. Comment on the plots whether any interesting behavior can be observed.
The MP assignment is submitted in Blackboard as a single zip file containing all the files and
codes created. Only the latest submission will be graded. There is a 2% penalty per each
starting hour, if the MP has been submitted after the stated deadline. The TA will unzip the zip
file on their laptop, check the codes and other outputs, and assign the marks. When the marks
for the MP are released, you have 48 hours to request the regarding. The written regarding
request must be submitted by email directly to the TA, explaining the reasons.

For this MP0, please submit:
– a typed report outlining the Python (or other language) codes created, instructions for
building/compiling the code and running it to demonstrate that the tasks defined in MP0
were accomplished. Explicitly list any packages or libraries that are required to run your
code. It is recommended to use Makefile for complied languages.
– it is highly recommended to include a test code that demonstrate the overall functionality
– description how to measure the delay and bandwidth defined in Task 2 above
– plots for the average, maximum, minimum delay and bandwidth as defined above

ECE428 Machine Programming 0
Open chat
Need help?
Can we help?