Concurrent computing (source code)

= Concurrent computing
{wiki}

<Concurrent computing> organizes computations whose execution intervals can overlap. They may interleave on one processor or run simultaneously on several; concurrency therefore differs from hardware <parallel computing>. Two workers incrementing a shared counter by separate read-modify-write steps can lose an update if both read the same old value. <Synchronization> constrains such interactions, while <message passing> organizes communication through explicit exchanges. A correct concurrent program must account for permitted schedules, not merely the particular order seen during one successful run.