learning multithreading and synchronization