Explain the concept of multi-threading. How do you prevent race conditions in a shared-resource environment?