Explain how multi-threading and asynchronous programming work, and how you prevent race conditions in production systems.