Process Synchronization
Race condition
We would arrive at this incorrect state because we allowed both processes to manipulate the variable counter concurrently. A situation like this, where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called a race condition. To guard against the race condition above, we need to ensure that only one process at a time can be manipulating the variable counter. To make such a guarantee, we require that the processes be synchronized in some way.
Race condition
We would arrive at this incorrect state because we allowed both processes to manipulate the variable counter concurrently. A situation like this, where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called a race condition. To guard against the race condition above, we need to ensure that only one process at a time can be manipulating the variable counter. To make such a guarantee, we require that the processes be synchronized in some way.
Situations such as the one just described occur frequently
in operating systems as different parts of the system manipulate resources.
Furthermore, as we have emphasized in earlier chapters, the growing importance
of multicore systems has brought an increased emphasis on developing
multithreaded applications. In such applications, several threads—which are
quite possibly sharing data—are running in parallel on different processing
cores.