2 classic concurrency and synchronization problems implemented in C