Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
Locks: Introduction From the last note, we saw that we had a fundamental problem
 

Summary: 26
Locks: Introduction
From the last note, we saw that we had a fundamental problem
in concurrent programming: we would like to execute a series
of instructions atomically, but due to the presence of interrupts,
we couldn't. In this note, we thus attack the problem of how
to provide what is called a lock: basically, what we are trying
to do is put some code around these critical sections and thus
enable them to appear to execute as if they were a single atomic
instruction.
As an example, assume our critical section was code that
looked like this:
balance = balance + 1;
We would then add some code around it to achieve the de-
sired effect:
lock();
balance = balance + 1;
unlock();
Note that sometimes a lock is called a mutex, as it is used to
provide mutual exclusion. Thus, when you see the following

  

Source: Arpaci-Dusseau, Remzi - Department of Computer Sciences, Department of Computer Sciences, University of Wisconsin at Madison

 

Collections: Computer Technologies and Information Sciences