A mutex, short for mutual exclusion, is a program object that allows multiple program threads to share the same resource, such as file access, but not simultaneously. When a program is running, only one thread can hold the mutex. It prevents race conditions when multiple threads attempt to update the same resource.