Docsity

Simulation of Transport Layer - Advanced Operating Systems - Assignment, Exercises of Advanced Operating Systems

Toggle sidebar
bg1
Assignment #1
Simulation of Transport Layer
In this assignment you will use the Unix fork and wait system calls, as well as IPC using pipes to
simulate a transport layer protocol like TCP.
Your first process will read lines of input from the keyboard until the user enters the string
“STOP”. The user will enter an IP address in dot notation, a port number, and then a message (a string
of text). This first process will have forked off two other processes to play the parts of the endpoints of
communication. Upon receiving a line of input the first process (the controller) passes the data to the
second process (the sender). The sender process packetizes the data (breaks the string into packets four
bytes long), adds a header (containing at least a source and a destination address). And then sends the
packets to the receiver process who strips off the headers, reassembles the message and then echoes that
message. You should convert the IP address from dot notation to a 32-bit value. You can make up any
IP address you want for the sender. The header should also contain a “checksum” function computed
over the packet body (to make sure the packet body doesn’t get corrupted in transmission). The receiver
should verify the checksum for each incoming packet and request the packet be resent if necessary.
To model the working of the network layer, you will need to arrange for packets to sometimes
arrive out of order and sometimes to be lost. You should do this by queuing all of the packets before
sending them and then generating a random number in the range 0-k where k is the number of packets in
the message. If the number generated is i, you send the ith packet. If the random number is 0, you lose
the packet. Your program should handle both lost and out of order packets.
When all of a message has arrived at the destination, it should be reassembled and printed. The
controller program should prompt the user to close down the program by entering the command
“STOP”. At that time the controller program sends signals to each host program. On receiving the
signal, each program will print out a message saying that it is shutting down. The controller program
should print the exit status of each of the child processes.
Your programs should have two modes – debug, in which complete information about each
packet sent and received is printed, and normal, in which only information about each message is sent
(not individual packets).
I will test your program with my own data. Your program must be submitted as described in the
syllabus. Make sure that you document the procedure to be used to test your program (i.e. the sequence
of commands to be entered). Any deviation from the description given here or from the description of
the submission process given in the syllabus will cause you to lose points. Programs will be examined
for copying. Your program should be written in C using gcc on the departmental Linux machines. It
must have Unix style end of line characters (not Windows style).
Make sure you clearly document the format of packets (both header and body) as well as the
“checksum” function you use.
Docsity.com

Partial preview of the text

Download Simulation of Transport Layer - Advanced Operating Systems - Assignment and more Exercises Advanced Operating Systems in PDF only on Docsity!

Assignment

Simulation of Transport Layer

In this assignment you will use the Unix fork and wait system calls, as well as IPC using pipes to simulate a transport layer protocol like TCP. Your first process will read lines of input from the keyboard until the user enters the string “STOP”. The user will enter an IP address in dot notation, a port number, and then a message (a string of text). This first process will have forked off two other processes to play the parts of the endpoints of communication. Upon receiving a line of input the first process (the controller) passes the data to the second process (the sender). The sender process packetizes the data (breaks the string into packets four bytes long), adds a header (containing at least a source and a destination address). And then sends the packets to the receiver process who strips off the headers, reassembles the message and then echoes that message. You should convert the IP address from dot notation to a 32-bit value. You can make up any IP address you want for the sender. The header should also contain a “checksum” function computed over the packet body (to make sure the packet body doesn’t get corrupted in transmission). The receiver should verify the checksum for each incoming packet and request the packet be resent if necessary. To model the working of the network layer, you will need to arrange for packets to sometimes arrive out of order and sometimes to be lost. You should do this by queuing all of the packets before sending them and then generating a random number in the range 0- k where k is the number of packets in the message. If the number generated is i , you send the i th packet. If the random number is 0, you lose the packet. Your program should handle both lost and out of order packets. When all of a message has arrived at the destination, it should be reassembled and printed. The controller program should prompt the user to close down the program by entering the command “STOP”. At that time the controller program sends signals to each host program. On receiving the signal, each program will print out a message saying that it is shutting down. The controller program should print the exit status of each of the child processes. Your programs should have two modes – debug, in which complete information about each packet sent and received is printed, and normal, in which only information about each message is sent (not individual packets). I will test your program with my own data. Your program must be submitted as described in the syllabus. Make sure that you document the procedure to be used to test your program (i.e. the sequence of commands to be entered). Any deviation from the description given here or from the description of the submission process given in the syllabus will cause you to lose points. Programs will be examined for copying. Your program should be written in C using gcc on the departmental Linux machines. It must have Unix style end of line characters (not Windows style). Make sure you clearly document the format of packets (both header and body) as well as the “checksum” function you use.

Docsity.com