A fork is a lock
Only one person can hold a fork at a time. If you have it, your neighbour has to wait. That's exactly what a lock does in code: it lets just one task use something at once.
A lock (or mutex — "mutual exclusion") guarantees only one thread enters a critical section at a time.