Cigarette smokers problem

The cigarette smokers problem is a concurrency problem in computer science, originally described in 1971 by Suhas Patil. The problem has been criticized for having "restrictions which cannot be justified by practical considerations."[1]

Problem description

Patil's problem includes a "quite arbitrary"[1] "restriction that the process which supplies the ingredients cannot be changed and that no conditional statements may be used."[2]

Assume a cigarette requires three ingredients to make and smoke: tobacco, paper, and matches. There are three smokers around a table, each of whom has an infinite supply of one of the three ingredients — one smoker has an infinite supply of tobacco, another has paper, and the third has matches.

There is also a non-smoking agent who enables the smokers to make their cigarettes by arbitrarily (non-deterministically) selecting two of the supplies to place on the table. The smoker who has the third supply should remove the two items from the table, using them (along with their own supply) to make a cigarette, which they smoke for a while. Once the smoker has finished his cigarette, the agent places two new random items on the table. This process continues forever.

Three semaphores are used to represent the items on the table; the agent increases the appropriate semaphore to signal that an item has been placed on the table, and smokers decrement the semaphore when removing items. Also, each smoker has an associated semaphore that they use to signal to the agent that the particular smoker is done smoking; the agent has a process that waits on each smoker's semaphore to let the agent know that it can place the new items on the table.

A simple pseudocode implementation of the smoker who has the supply of tobacco might look like the following:

def tobacco_smoker():
    repeat:
        paper.wait()
        matches.wait()
        smoke()
        tobacco_smoker_done.signal()

However, this can lead to deadlock; if the agent places paper and tobacco on the table, the smoker with tobacco may remove the paper and the smoker with matches may take the tobacco, leaving both unable to make their cigarette. The solution is to define additional processes and semaphores that prevent deadlock, without modifying the agent.

Criticism

Patil placed the following constraints on the cigarette smokers problem:

  1. The agent code is not modifiable.
  2. The solution is not allowed to use conditional statements.

Patil used a proof in terms of Petri nets to claim that a solution to the cigarette smokers problem using Edsger Dijkstra's semaphore primitives is impossible, and to suggest that a more powerful primitive is necessary.[3][2] However, David Parnas demonstrated that Patil's proof is inadequate if arrays of semaphores are used, offering a solution that uses helper processes that do arithmetic to signal the appropriate smoker to proceed.[1]

According to Allen B. Downey, the first restriction makes sense, because if the agent represents an operating system, it would be unreasonable or impossible to modify it every time a new application came along.[4] However, Parnas argues that the second restriction is unjustified:

The limitations reported by Patil are limitations of his primitives, but they are not limitations on the primitives described by Dijkstra. … It is important, however, that such an investigation [of Dijkstra primitives] not investigate the power of these primitives under artificial restrictions. By artificial we mean restrictions which cannot be justified by practical considerations. In this author's opinion, restrictions prohibiting either conditionals or semaphore arrays are artificial.[1]

See also

References

  1. ^ a b c d Parnas, David L. (March 1975). "On a solution to the cigarette smokers' problem (without conditional statements)" (PDF). Communications of the ACM. 18 (3): 181–183. doi:10.1145/360680.360709. S2CID 24066507.
  2. ^ a b Patil, Suhas. "Limitations and Capabilities of Dijkstra's Semaphore Primitives for Coordination among Processes" (PDF). Retrieved 20 February 2022.
  3. ^ Patil, Suhas S. (February 1971). Limitations and Capabilities of Dijkstra's Semaphore Primitives for Coordination among Processes (Technical report). MIT, Project MAC, Computation Structures Group. Memo 57.
  4. ^ Downey, Allen B. The Little Book of Semaphores (2nd ed.). Retrieved 29 June 2015.

Read other articles:

2010 edition of the FIBA World Championship 2010 FIBA World Championship2010 FIBA Dünya Basketbol ŞampiyonasıTournament detailsHost countryTurkeyDates28 August – 12 SeptemberOfficially opened byAbdullah GülTeams24 (from 5 confederations)Venue(s)5 (in 4 host cities)Final positionsChampions United States (4th title)Runners-up TurkeyThird place LithuaniaFourth place SerbiaTournament statisticsGames played80MVP Kevin DurantTop scorer Luis Scola (27.1 point...

 

315e régiment d'infanterie Création 2 août 1914 Dissolution 5 décembre 1917 Pays France Branche Armée de terre Type régiment d'infanterie Rôle infanterie Inscriptionssur l’emblème Champagne 1915Verdun 1916 Guerres Première Guerre mondiale Décorations Aucune citation au régiment modifier  Le 315e régiment d'infanterie (315e RI) est un régiment d'infanterie de l'Armée de terre française constitué en 1914 avec les bataillons de réserve du 115e régiment d'infant...

 

Tarakan TengahKecamatanKantor kecamatan Tarakan TengahPeta lokasi Kecamatan Tarakan TengahNegara IndonesiaProvinsiKalimantan UtaraKotaTarakanPemerintahan • Camat...Populasi • Total... jiwa jiwaKode Kemendagri65.71.02 Kode BPS6571020 Luas... km²Desa/kelurahan-/5 Tarakan Tengah adalah salah satu kecamatan di Kota Tarakan, Provinsi Kalimantan Utara, Indonesia. Kelurahan di Kecamatan Tarakan Tengah Kelurahan Lurah Pamusian Nany Fitriati, A.Md. Kampung 1 Skip Chaizir ...

Explanation of phrases from the book by Douglas Adams The Hitchhiker's Guide to the Galaxy is a comic science fiction series created by Douglas Adams that has become popular among fans of the genre and members of the scientific community. Phrases from it are widely recognised and often used in reference to, but outside the context of, the source material. Many writers on popular science, such as Fred Alan Wolf, Paul Davies, and Michio Kaku, have used quotations in their books to illustrate fa...

 

Село Ґулувпол. Gułów Координати 51°44′35″ пн. ш. 22°13′27″ сх. д. / 51.74305556002777706° пн. ш. 22.22444444002777786° сх. д. / 51.74305556002777706; 22.22444444002777786Координати: 51°44′35″ пн. ш. 22°13′27″ сх. д. / 51.74305556002777706° пн. ш. 22.22444444002777786° сх. д. / 51.743055...

 

Wahiawā Lage auf Hawaii Wahiawā (Hawaii) Wahiawā Basisdaten Staat: Vereinigte Staaten Bundesstaat: Hawaii County: Honolulu County Koordinaten: 21° 30′ N, 158° 1′ W21.5025-158.02305555556287Koordinaten: 21° 30′ N, 158° 1′ W Zeitzone: Hawaii-Aleutian Standard Time (UTC−10) Einwohner: 18.658 (Stand: 2020) Haushalte: 5.810 (Stand: 2020) Fläche: 6,2 km² (ca. 2 mi²)davon 5,5 km² (ca. 2 mi...

North Carolina Central Eagles 2023–24 North Carolina Central Eagles men's basketball team UniversityNorth Carolina Central UniversityHead coachLeVelle Moton (11th season)ConferenceMEACLocationDurham, North CarolinaArenaMcDougald–McLendon Arena (Capacity: 3,056)NicknameEaglesColorsMaroon and gray[1]   NCAA tournament champions1989*NCAA tournament Final Four1989*NCAA tournament Elite Eight1989*, 1993*NCAA tournament Sweet Sixteen1989*, 1993*NCAA tournament s...

 

8th episode of the 6th season of Adventure Time Furniture & MeatAdventure Time episodeEpisode no.Season 6Episode 8Directed by Elizabeth Ito[a] Nick Jennings[b] Written byCole SanchezAndy RistainoStory byKent OsbornePendleton WardJack PendarvisAdam MutoProduced byKelly CrewsProduction code1025-171Original air dateJune 19, 2014 (2014 -06-19)Running time11 minutesGuest appearances Steve Agee as Ancient Psychic Tandem War Elephant Andy Milonakis as Neptr, W...

 

Tahu gejrotTempat asalCirebonDaerahJawa Barat  Media: Tahu gejrot Tahu gejrot (Hanacaraka: ꦠꦲꦸ​ꦒꦼꦗꦿꦺꦴꦠ꧀) adalah makanan khas Cirebon, Jawa Barat, Indonesia yang terbuat dari tahu dan bumbu lainnya.[1] Tahu gejrot terdiri dari tahu yang sudah digoreng kemudian dipotong agak kecil lalu dimakan dengan kuah yang bumbunya terdiri dari cabai, bawang putih, bawang merah, dan gula.[1] Biasanya disajikan di layah kecil.[1] Tahu gejrot juga merup...

Parc Central du LacGéographiePays  ItalieRégion LatiumVille métropolitaine ville métropolitaine de Rome CapitaleCapitale RomeCoordonnées 41° 49′ 42″ N, 12° 28′ 04″ ESuperficie 0,2 km2AdministrationType Jardin public, lac artificielCréation 1936Site web (it) www.eurspa.it/it/asset-property/patrimonio/parchi-e-giardini/parco-centrale-lago Géolocalisation sur la carte : Italie Géolocalisation sur la carte : Latium modifier - mod...

 

Two 1490 portrait panels by Albrecht Dürer Portrait of Barbara Dürer, née Holper, c. 1490. Oil on pine panel, 47 cm x 36 cm. Germanisches Nationalmuseum, NurembergAlbrecht Dürer the Elder with a Rosary, 1490. Oil on softwood panel, 47.5 cm x 39.5 cm. Uffizi Gallery, Florence Portrait Diptych of Dürer's Parents (or Dürer's Parents with Rosaries) is the collective name for two late-15th century portrait panels by the German painter and printmaker Albrecht Dürer. They show the artist...

 

Running and cycling athletic event Not to be confused with Biathlon, Biathle, or Winter duathlon. This article uses bare URLs, which are uninformative and vulnerable to link rot. Please consider converting them to full citations to ensure the article remains verifiable and maintains a consistent citation style. Several templates and tools are available to assist in formatting, such as reFill (documentation) and Citation bot (documentation). (September 2022) (Learn how and when to remove this ...

This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: Asian Forum of Parliamentarians on Population and Development – news · newspapers · books · scholar · JSTOR (September 2011) (Learn how and when to remove this template message)Asian Forum of Parliamentarians on Population and DevelopmentAbbreviationAFPPDFormation1981TypeNGOLocationBangkok, Thailand (Secre...

 

Enrique XVIII Príncipe de Reuss (línea menor) Información personalNacimiento 25 de noviembre de 1864Kowary, Reino de PrusiaFallecimiento 23 de marzo de 1939 (63 años)Kowary, Alemania naziSepultura Parque del Castillo de Neuhoff, KowaryFamiliaDinastía Reuss (línea menor)Padre Enrique IX de Reuss (línea menor)Madre Ana de Zedlitz y LeipeCónyuge Feodora de Sajonia-Meiningen[editar datos en Wikidata]El príncipe Enrique XXX de Reuss (línea menor) (Kowary, 25 de noviembre de 186...

 

American racing driver Dev GoreGore in 2022Nationality AmericanBorn (1997-07-31) 31 July 1997 (age 26)Oklahoma City, Oklahoma, United StatesDeutsche Tourenwagen Masters careerDebut season2021Current teamTeam RosbergRacing licence FIA SilverCar number12Starts29Championships0Wins0Podiums1Poles0Fastest laps0Finished last season17thPrevious series2019201920182017Blancpain GT Endurance CupToyota Racing SeriesEuroformula Open ChampionshipU.S. F2000 National Championship Dev Gore (born 31 July ...

Pakistani politician Mehmood-ur-RasheedProvincial Minister of Punjab for Housing, Urban Development and Public Health EngineeringIn office27 August 2018 – 28 March 2022 Leader of the Opposition PunjabIn office11 June 2013 – 31 May 2018Member of the Provincial Assembly of the PunjabIn office15 August 2018 – 14 January 2023ConstituencyPP-160 Lahore-XVIIIn office29 May 2013 – 31 May 2018ConstituencyPP-151 (Lahore-XV)In office1988–1993ConstituencyPP-1...

 

This article needs a plot summary. Please add one in your own words. (November 2021) (Learn how and when to remove this template message) 2013 American filmThe Happy HousePosterDirected byD. W. YoungWritten byD. W. YoungProduced byJudith MizrachyStarringKhan BaykalAya CashMarceline HugotKathleen McNennyOliver HenzlerMike HoustonCharles BorlandCinematographyArlene MullerEdited byD. W. YoungMusic byDavid UllmannRelease date May 3, 2013 (2013-05-03) (Cinema Village)[1]...

 

Lebanese adherents of Shia Islam Mutawālī redirects here. Not to be confused with mutawallī. Lebanese Shia Muslimsالمسلمون الشيعة اللبنانيونDistribution of Shi'a Muslims in LebanonTotal population~1,800,000LanguagesVernacular:Lebanese ArabicReligionIslam (Shia Islam) Part of a series of articles onLebanese peopleEmblem of Lebanon(Lebanese cedar) Lebanese people Lebanese people by religion: Lebanese Muslims Shia Sunni Druze Lebanese Christians Maronite Greek Orthodox...

Luxemburgo en los Juegos Olímpicos Bandera de LuxemburgoCódigo COI LUXCON Comité Olímpico y Deportivo Luxemburgués(pág. web)Juegos Olímpicos de Montreal 1976Deportistas 8 en 4 deportesAbanderado Robert SchielMedallas 0 0 0 0 Historia olímpicaJuegos de verano 1896 • 1900 • 1904 • 1908 • 1912 • 1920 • 1924 • 1928 • 1932 • 1936 • 1948 • 1952 • 1956 ...

 

Constituency of the National Assembly of France 15th constituency of Bouches-du-RhôneinlineConstituency of the National Assembly of FranceConstituency in Bouches-du-Rhône Department (white area is the Étang de Berre lagoon)Bouches-du-Rhône in FranceDeputyRomain BaubryRNDepartmentBouches-du-Rhône Politics of France Political parties Elections Previous Next The 15th constituency of Bouches-du-Rhône is a French legislative constituency in Bouches-du-Rhône. Deputies Election Member Party 1...

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!