If we could travel back in time to 1974, perhaps we would have found Leslie Lamport at his busy local neighborhood bakery, grappling with the following issue. The bakery had several cashiers, but if more than one person approached a single cashier at the same time, that cashier would try to talk to all of them at once and become confused. Lamport realized that there needed to be some way to guarantee that people approached cashiers one at a time. This problem reminded Lamport of an issue which has been posed in an earlier article by computer scientist Edsger Dijkstra on another mundane issue: how to share dinner utensils around a dining table. One of the coordination challenges was to guarantee that each utensil was used by at most one diner at a time, which came to be generalized as the mutual exclusion problem, exactly the challenge Lamport faced at the bakery. One morning in 1974, an idea came to Lamport on how the bakery customers could solve mutual exclusion among themselves, without relying on the bakery for help. It worked roughly like this: people choose numbers when they enter the bakery, and then get served at the cashier according to their number ordering. To choose a number, a customer asks for the number of everyone around her and chooses a number higher than all the others. This simple idea became an elegant algorithm for solving the mutual exclusion problem without requiring any lower-level indivisible operations. It also was a rich source of future ideas, since many issues had to be worked out. For example, some bakery customers took a long time to check other numbers, and meanwhile more customers arrived and selected additional numbers. Another time, the manager of the bakery wanted to get a snapshot of all the customer numbers in order to prepare enough pastries. Lamport later said "For a couple of years after my discovery of the bakery algorithm, everything I learned about concurrency came from studying it." [1] The Bakery Algorithm and Lamport's other pioneering works -- many with amusing names and associated parables -- have become pillars of computer science. His collection forms the foundation of broad areas in concurrency, and has influenced the specification, development, and verification of concurrent systems. --- Se potessimo viaggiare indietro nel tempo fino al 1974, forse avremmo trovato Leslie Lamport nella sua affollata pasticceria di quartiere, alle prese con il seguente problema. La pasticceria aveva diversi cassieri, ma se più persone si avvicinavano contemporaneamente allo stesso cassiere, quest'ultimo cercava di parlare con tutti contemporaneamente, finendo per confondersi. Lamport si rese conto che era necessario trovare un modo per garantire che le persone si avvicinassero ai cassieri una alla volta. Questo problema gli ricordò una questione posta in un articolo dal celebre informatico Edsger Dijkstra su un altro problema apparentemente banale: come condividere le posate attorno a un tavolo da pranzo. Una delle sfide di coordinazione era garantire che ogni posata fosse utilizzata da un solo commensale alla volta, una questione che fu successivamente generalizzata come problema della mutua esclusione, esattamente la sfida che Lamport vedeva nella pasticceria. Una mattina del 1974, a Lamport venne un'idea su come i clienti della pasticceria potessero risolvere il problema della mutua esclusione, senza dover fare affidamento sull'aiuto del negozio. Il meccanismo funzionava pressappoco così: i clienti sceglievano un numero quando entravano nella pasticceria, e venivano serviti dal cassiere in base all'ordine dei numeri. Per scegliere un numero, un cliente chiedeva il numero a tutte le persone intorno e ne sceglieva uno più alto di tutti gli altri. Questa semplice idea divenne un elegante algoritmo per risolvere il problema della mutua esclusione senza richiedere operazioni indivisibili a livello più basso. Inoltre, fu una ricca fonte di idee future, poiché la realizzazione di questo algoritmo richideva la risoluzioni di molti altri sotto-problemi. Ad esempio, alcuni clienti della pasticceria impiegavano molto tempo a controllare gli altri numeri, e nel frattempo arrivavano altri clienti che sceglievano ulteriori numeri. In un'altra occasione, il gestore della pasticceria voleva ottenere una panoramica di tutti i numeri dei clienti per preparare un numero sufficiente di pasticcini. Lamport disse in seguito: "Per un paio d'anni dopo la mia scoperta dell'algoritmo della pasticceria, tutto ciò che imparavo sulla concorrenza derivava dallo studio di esso." L'algoritmo della pasticceria e gli altri lavori pionieristici di Lamport - molti con nomi divertenti e associati a parabole - sono diventati pilastri dell'informatica. La sua collezione forma la base di ampie aree di ricerca nella concorrenza e ha influenzato la specifica, lo sviluppo e la verifica dei sistemi concorrenti.