Search code examples
multithreadingconcurrencyoperating-systemmutexmutual-exclusion

Mutual Exclusion Conditions


I was reading about Mutual Exclusion Conditions, which are as follows

  1. No two processes may at the same moment inside their critical sections.
  2. No assumptions are made about relative speeds of processes or number of CPUs.
  3. No process should outside its critical section should block other processes.
  4. No process should wait arbitrary long to enter its critical section.

Can someone explain me the meaning of 2nd point ?


Solution

  • To me, it means that you cannot decide something is correct because it is only a {small number} of instructions. A process may be pre-empted, a cpu may become suspended, suffer an interrupt, or other delay which mocks these assumptions.

    Concurrent code has to be correct with any possible instruction interleaving.