So guys, now let us go through some points to note regarding this project.
The hash function which returns node number for some key value k.
You can take the hash function as simple as k mod n where n is the total number of nodes in the ring
topology.
If your node numbers in the ring topology starts with zero, then you can omit plus one to this hash
function.
Otherwise add just by adding plus one to this hash function definition.
Each node in the ring.
Topology is a TCP server UDP server as well as TCP client and UDP client also.
So it means that you can see that each node in your ring topology is playing four roles at the same
time.
That is TCP server, UDP server as well as TCP client and UDP client.
Client is any process which initiates the communication.
So as I explained while discussing the pseudocode that you should open TCP master socket, UDP socket
and monitor both in select system call.
Also, your nodes should also be able to accept users put get requests from console console act as a
client with communication file descriptor as zero.
So always keep zero as member to your read set and monitor the file descriptor zero in select system
call as well.
Note that you have to write exactly one C file and not as many C programs as number of nodes in the
topology.
I have noticed that students get confused and they think that they have to write as many C programs
as the number of nodes in the topology.
No, you have to write just one C program and that particular C program actually represent a generic
node of the ring topology.
You have to supply command line argument while running your project.
Those command line arguments will define that the process that you have just started represent actually
which node of the ring topology.
We have already discussed about the command line arguments that you should pass right in the beginning.
So good luck guys.
Take your time to understand and design your application.
Take your own assumptions wherever necessary.
For example, overwrite the value of X for duplicate x request.
So it simply means that it might be possible that earlier the user has issued the request, say 22 and
35.
Right?
And at some point of time later the user again issues the request 20 to 45.
Right.
So earlier for K is equal to 22.
The value of X was 35, which was saved in the hash table of some node in the ring topology.
Now again, if the user issues the put request for the same key but with a different x value, then
you are free to override the x value in the hash table of the node which stores the previous value of
k and x.
So I have some rough solution of this project.
You can download the solution from here to get some idea about implementing this project, but I would
encourage you to implement this project by your own without looking at this source code.
But if you get stuck or simply you are not getting an idea how to move forward, you can download this
source code and browse the source code if possible to see how you will implement your solution.