Interprocess messaging with physical time.
Description is available in Russian (original) and English (translated and shorted).
Simple banking system implemented using library from previous task.
System consists of one parent process and up to ten child processes. Architecture is similar to one from previous task.
This time every child process has an initial balance. In its second phase child process is doing transfers from C(hild)src to C(hild)dst. All transfers are orchestrated by parent process. After getting a TRANSFER message Csrc subtract a stated amount from its balance and sends TRANSFER message to Cdst. Csrc and Cdst ids with amount to be transfered are within TRANSFER message body. Each transfer is tracked by child process and marked with timestamp.
After begin synchronization phase parent process run bank_robbery() function wich executes a series of transfers between child processes. After that it sends STOP message to all child processes, waits until the end of end synchronization and prints all their balance histories.
All events are printed to events.log file.
clang -std=c99 -Wall -pedantic *.c -L. -lruntime
export LD_LIBRARY_PATH="LD_LIBRARY_PATH:/path/to/pa2/dir";
### empty line
LD_PRELOAD=/full/path/to/llibruntime.so ./pa2 -p <proc_num> <proc_balance_1 ... proc_balalance_n>