Example and demo of multi-threading and synchronization