Main Loop

Upon startup, all children execute recvfrom function. The process will enter the kernel mode. When there is no data to be processed at the moment, the kernel will put the process on list of processes waiting for data and the process will be put asleep.

When data to be processed was received, the first process on the list will be removed from the list and woken up. After the process finished processing of the data, it will call recvfrom again and will be put by the kernel at the end of the list.

When next data arrives, the first process on the list will be removed, processes the data and will be put on the end of the list again. And so on...

The main loop logic can be found in function udp_rcv_loop in file udp_server.c.

The message is received using recvfrom function. The received data is stored in buffer and zero terminated.

If configured so, basic sanity checks over the received message will be performed.

The message is then processed by receive_msg function and recvfrom is called again.

receive_msg Function

The function can be found in receive.c file.