|
![](/i/fill.gif) |
Am 15.08.2012 13:17, schrieb Invisible:
> On 10/08/2012 06:37 PM, Darren New wrote:
>> The bakery algorithm is called that because you "take a number" just
>> like at the bakery.
>
> Maybe I missed it, but... how does the algorithm guarantee that no two
> people take the same number?
It doesn't.
"Due to the limitations of computer architecture, some parts of
Lamport's analogy need slight modification. It is possible that more
than one thread will get the same number when they request it; this
cannot be avoided. Therefore, it is assumed that the thread identifier i
is also a priority . A lower value of i means a higher priority and
threads with higher priority will enter the critical section first."
(from Wikipedia, which is one of your friends)
Post a reply to this message
|
![](/i/fill.gif) |