Concurrent data structure

In computer science, a concurrent data structure (also called shared data structure) is a data structure designed for access and modification by multiple computing threads (or processes or nodes) on a computer, for example concurrent queues, concurrent stacks etc. The concurrent data structure is typically considered to reside in an abstract storage environment known as shared memory, which may be physically implemented as either a tightly coupled or a distributed collection of storage modules. [1][2]

Basic principles

Concurrent data structures, intended for use in parallel or distributed computing environments, differ from "sequential" data structures, intended for use on a uni-processor machine, in several ways.[3] Most notably, in a sequential environment one specifies the data structure's properties and checks that they are implemented correctly, by providing safety properties. In a concurrent environment, the specification must also describe liveness properties which an implementation must provide. Safety properties usually state that something bad never happens, while liveness properties state that something good keeps happening. These properties can be expressed, for example, using Linear Temporal Logic.

The type of liveness requirements tend to define the data structure. The method calls can be blocking or non-blocking. Data structures are not restricted to one type or the other, and can allow combinations where some method calls are blocking and others are non-blocking (examples can be found in the Java concurrency software library).

The safety properties of concurrent data structures must capture their behavior given the many possible interleavings of methods called by different threads. It is quite intuitive to specify how abstract data structures behave in a sequential setting in which there are no interleavings. Therefore, many mainstream approaches for arguing the safety properties of a concurrent data structure (such as serializability, linearizability, sequential consistency, and quiescent consistency[3]) specify the structures properties sequentially, and map its concurrent executions to a collection of sequential ones.

To guarantee the safety and liveness properties, concurrent data structures must typically (though not always) allow threads to reach consensus as to the results of their simultaneous data access and modification requests. To support such agreement, concurrent data structures are implemented using special primitive synchronization operations (see synchronization primitives) available on modern multiprocessor machines that allow multiple threads to reach consensus. This consensus can be achieved in a blocking manner by using locks, or without locks, in which case it is non-blocking. There is a wide body of theory on the design of concurrent data structures (see bibliographical references).

Design and implementation

Concurrent data structures are significantly more difficult to design and to verify as being correct than their sequential counterparts.

The primary source of this additional difficulty is concurrency, exacerbated by the fact that threads must be thought of as being completely asynchronous: they are subject to operating system preemption, page faults, interrupts, and so on.

On today's machines, the layout of processors and memory, the layout of data in memory, the communication load on the various elements of the multiprocessor architecture all influence performance. Furthermore, there is a tension between correctness and performance: algorithmic enhancements that seek to improve performance often make it more difficult to design and verify a correct data structure implementation.[4]

A key measure for performance is scalability, captured by the speedup of the implementation. Speedup is a measure of how effectively the application is using the machine it is running on. On a machine with P processors, the speedup is the ratio of the structures execution time on a single processor to its execution time on P processors. Ideally, we want linear speedup: we would like to achieve a speedup of P when using P processors. Data structures whose speedup grows with P are called scalable. The extent to which one can scale the performance of a concurrent data structure is captured by a formula known as Amdahl's law and more refined versions of it such as Gustafson's law.

A key issue with the performance of concurrent data structures is the level of memory contention: the overhead in traffic to and from memory as a result of multiple threads concurrently attempting to access the same locations in memory. This issue is most acute with blocking implementations in which locks control access to memory. In order to acquire a lock, a thread must repeatedly attempt to modify that location. On a cache-coherent multiprocessor (one in which processors have local caches that are updated by hardware to keep them consistent with the latest values stored) this results in long waiting times for each attempt to modify the location, and is exacerbated by the additional memory traffic associated with unsuccessful attempts to acquire the lock.

.NET

.NET have ConcurrentDictionary,[5] ConcurrentQueue[6] and ConcurrentStack[7] in the System.Collections.Concurrent namespace.

UML class diagram of System.Collections.Concurrent in .NET

Rust

Rust instead wraps data structures in Arc and Mutex.[8]

let counter = Arc::new(Mutex::new(0));

See also

References

  1. ^ A VLSI Architecture for Concurrent Data Structures. ISBN 9781461319955.
  2. ^ 23nd International Symposium on Distributed Computing, DISC. Springer Science & Business Media. 2009.
  3. ^ a b Mark Moir; Nir Shavit (2007). "Concurrent Data Structures" (PDF). In Dinesh Metha; Sartaj Sahni (eds.). Handbook of Data Structures and Applications. Chapman and Hall/CRC Press. pp. 47-14–47-30. Archived from the original (PDF) on 1 April 2011.
  4. ^ Gramoli, V. (2015). "More than you ever wanted to know about synchronization: Synchrobench, measuring the impact of the synchronization on concurrent algorithms" (PDF). Proceedings of the 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. ACM. pp. 1–10. Archived from the original (PDF) on 10 April 2015.
  5. ^ "ConcurrentDictionary Class (System.Collections.Concurrent)". learn.microsoft.com. Retrieved 26 November 2024.
  6. ^ "ConcurrentQueue Class (System.Collections.Concurrent)". learn.microsoft.com. Retrieved 26 November 2024.
  7. ^ "ConcurrentStack Class (System.Collections.Concurrent)". learn.microsoft.com. Retrieved 26 November 2024.
  8. ^ "Shared-State Concurrency - The Rust Programming Language". doc.rust-lang.org. Retrieved 26 November 2024.

Further reading

  • Nancy Lynch "Distributed Computing"
  • Hagit Attiya and Jennifer Welch "Distributed Computing: Fundamentals, Simulations And Advanced Topics, 2nd Ed"
  • Doug Lea, "Concurrent Programming in Java: Design Principles and Patterns"
  • Maurice Herlihy and Nir Shavit, "The Art of Multiprocessor Programming"
  • Mattson, Sanders, and Massingil "Patterns for Parallel Programming"

Read other articles:

Foto del Jardín CarlvonLinne. La Sociedad linneana sueca (en sueco: Svenska Linnésällskapet) es una Sociedad científica dedicada al estudio del naturalista del siglo XVIII Carlos Linneo. Fue fundada en una reunión que tuvo lugar en Hammarby, la casa de campo de Linnaeus en las afueras de Uppsala, el 23 de mayo de 1917, el 210.º cumpleaños de Carl Linnaeus. En 1918 asumió el control del jardín botánico viejo en Uppsala y a partir de 1918 y hasta 1923 lo restauraron según los pr...

 

64. Eurovision Song Contest Motto Dare to Dream! (dt.: „Trau dich zu träumen!“) Datum 14. Mai 2019 (Halbfinale 1)16. Mai 2019 (Halbfinale 2)18. Mai 2019 (Finale) Austragungsland Israel Israel Austragungsort Tel Aviv Convention Center, Tel Aviv Austragender Fernsehsender Moderation Assi Azar, Bar Refaeli, Lucy Ayoub und Erez Tal Eröffnungsact Erstes Halbfinale: Netta: Toy[1]Finale: Dana International: Medley Tel Aviv & Diva, Ilanit: Ey sham, Nadav Guedj: Golden Boy[1...

 

Abies religiosa Охоронний статус Найменший ризик (МСОП 3.1) Біологічна класифікація Царство: Рослини (Plantae) Клада: Судинні рослини (Tracheophyta) Клада: Голонасінні (Gymnosperms) Відділ: Хвойні (Pinophyta) Клас: Хвойні (Pinopsida) Порядок: Соснові (Pinales) Родина: Соснові (Pinaceae) Рід: Ялиця (Abies) Вид: A. religiosa

GlioblastomaHasil pindaian MRI yang menunjukkan glioblastoma pada seorang remaja lelaki berusia 15 tahunInformasi umumNama lainGlioblastoma multiforme, grade IV astrocytomaSpesialisasiOnkologi, bedah sarafPenyebabBiasanya tidak jelas[1]Faktor risikoPenyakit genetik (neurofibromatosis, sindrom Li–Fraumeni), pernah menjalani terapi radiasi[1][2]Aspek klinisGejala dan tandaAwalnya tidak spesifik, sakit kepala, perubahan kepribadian, mual, gejala seperti stroke[3]...

 

Comic book series Marvel Zombies 5Cover of Marvel Zombies 5 1 (June 2010), art by Rafa GarresPublication informationPublisherMarvel ComicsScheduleMonthlyFormatLimited seriesGenre Superhero Publication dateJune – October 2010No. of issues5Main character(s)MorbiusMachine ManHoward the DuckJacali KaneCreative teamWritten byFred Van LentePenciller(s)Jose Angel Cano LopezInker(s)Thomas Palmer Sr.Alvaro LopezLetterer(s)Simon BowlandColorist(s)Val StaplesEditor(s)Michael HorwitzMark Pani...

 

Mallatang Alfred TambunanAnggota Dewan Perwakilan RakyatMasa jabatan1 Oktober 1997 – 1 Oktober 1999PresidenSoehartoB.J. HabibieGrup parlemenFraksi GolkarDaerah pemilihanSumatera UtaraMasa jabatan1 Oktober 1987 – 1 Mei 1994PresidenSoehartoPenggantiBonard MaruhumGrup parlemenFraksi ABRI Informasi pribadiLahir(1936-09-15)15 September 1936Muara, Tapanuli Utara, Hindia BelandaMeninggal20 Juli 2002(2002-07-20) (umur 65)Partai politikGolkarKarier militerPihak Indonesi...

This article is about the town in Scotland. For other places named Dalkeith, see Dalkeith (disambiguation). Eskbank redirects here. For the hamlet in Canada, see Eskbank, Saskatchewan. Human settlement in ScotlandDalkeithScottish Gaelic: Dail CheithDalkeithLocation within MidlothianPopulation14,330 (mid-2020 est.)[1]Council areaMidlothianLieutenancy areaMidlothianCountryScotlandSovereign stateUnited KingdomPost townDALKEITHPostcode districtEH22Dialling...

 

Tuanku Imam BonjolGambar Tuanku Imam Bonjol oleh Hubert de Stuers (sekitar 1820)Pemimpin Perang PadriMasa jabatank.1821 – k.1837Penguasa monarkiPagaruyung Informasi pribadiLahir1772 Bonjol, Luhak Agam, MinangkabauMeninggal6 November 1864 (umur 92)Lotta, Pineleng, Minahasa, Hindia BelandaKebangsaan MinangkabauSunting kotak info • L • B Tuanku Imam Bonjol (lahir di Bonjol, Luhak Agam, Pagaruyung, 1772 – wafat dalam pengasingan dan dimakamkan di Lotta, Pineleng, Minaha...

 

ParkstadionParkstadion pada 12 September 1998LokasiGelsenkirchen, JermanKapasitas62.004 (pertandingan liga)55.877 (pertandingan internasional)PermukaanRumputKonstruksiMulai pembangunan29 Agustus 1969Dibuka4 Agustus 1973Direnovasi1998Ditutup2008PemakaiFC Schalke 04 (1973–2001) Parkstadion adalah sebuah stadion yang terletak di Gelsenkirchen, Jerman. Stadion ini umumnya dipergunakan untuk menggelar pertandingan sepak bola dan menjadi markas FC Schalke 04 sejak tahun 1973 hingga 2001. Stadion ...

PetrucciCountryRepublic of SienaFoundedmid 15th centuryTitlesLord of SienaDissolution1525 (exile of Fabio Petrucci) The Petrucci Family was the ruling family of Siena in Italy from 1487 to 1525 during the Renaissance. History The Petrucci family ruled the Italian city-state of Siena from 1487 to 1525. Pandolfo Petrucci[1] was the first ruler and brought prosperity to Siena. Returning from exile, he seized many political offices until he became the first absolute ruler of Siena. Pandol...

 

Football match2022 Bulgarian Cup finalФинал на Sesame Купа на България 2022Event2021–22 Bulgarian Cup CSKA Sofia Levski Sofia 0 1 Date15 May 2022 (2022-05-15)VenueVasil Levski, SofiaRefereeNikola Popov (Sofia)Attendance40,600WeatherClear25 °C (77 °F)[1]← 2021 2023 → The 2022 Bulgarian Cup final was the final match of the 2021–22 Bulgarian Cup and the 82nd final of the Bulgarian Cup. The final originally should have been o...

 

Міжнародний кінофестиваль у Токіо Логотип Міжнародного Токійського кінофестивалю 2011Місце проведення Токіо,  ЯпоніяГоловний приз «Сакура Токіо»Заснування 1985 роціДата проведення щорічно у жовтніtiff-jp.net  Токійський міжнародний кінофестиваль у Вікісховищі Міжнаро...

Ottoman massacre of Bulgarian civilians The Stara Zagora massacre (Bulgarian: Старозагорско клане) was the mass murder of approx. 14,000 civilian Bulgarians, accompanied by the burning and complete destruction of the City of Stara Zagora on 31 July–2 August [O.S. 19–21 July] 1877, committed by regular Ottoman troops commanded by Süleyman Hüsnü Pasha, during the eponymous battle of the Russo-Turkish War (1877-1878).[1][2][3] ...

 

This article does not cite any sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Guerilla Disco – news · newspapers · books · scholar · JSTOR (February 2012) (Learn how and when to remove this template message) 2004 studio album by QuarashiGuerilla DiscoThe Icelandic cover art of Guerilla Disco.Studio album by QuarashiReleasedIceland - 2004 / Japan -...

 

Season of television series Gilmore GirlsSeason 6Season 6 DVD coverStarring Lauren Graham Alexis Bledel Melissa McCarthy Scott Patterson Keiko Agena Yanic Truesdale Liza Weil Sean Gunn Matt Czuchry Kelly Bishop Edward Herrmann Country of originUnited StatesNo. of episodes22ReleaseOriginal networkThe WBOriginal releaseSeptember 13, 2005 (2005-09-13) –May 9, 2006 (2006-05-09)Season chronology← PreviousSeason 5 Next →Season 7 List of episodes The sixth season of Gi...

American hip hop group The Saturday KnightsThe Saturday Knights at Bumbershoot 2008. Left to right: DJ Suspence, Tilson, BarflyBackground informationGenresHip-hop, Indie rockLabelsLight In The AtticMembersBarflyTilsonDJ Suspence The Saturday Knights are a Seattle[1] and Tacoma,[2] Washington-based musical group whose music spans many genres, ranging from hip hop to pop music.[3] Their debut full-length CD, Mingle (2008) features guest appearances from the Dap-Kings, Ch...

 

Antonio Colonnello nel 1984 Antonio Colonnello (Milano, 8 gennaio 1938 – Roma, 30 maggio 2005) è stato un attore teatrale e doppiatore italiano. È stato il doppiatore di Fonzie, il protagonista del telefilm Happy Days (interpretato da Henry Winkler) e di J.R. Ewing (interpretato da Larry Hagman, che incontrò anche di persona), personaggio del serial televisivo Dallas. Ha prestato la voce anche a Clint Eastwood e Steven Seagal. Indice 1 Biografia 2 Doppiaggio 2.1 Film 2.2 Televisione 3 No...

 

Ode an die FreudeOda do radości 12 strona z oryginału dzieła Beethovena Organizacja międzynarodowa  Unia Europejska Muzyka Ludwig van Beethoven, Herbert von Karajan Lata obowiązywania od 1972 Hymn Europy Multimedia w Wikimedia Commons Hymn Europy – instrumentalna wersja Ody do radości pochodzącej z finału IX symfonii Beethovena w opracowaniu Herberta von Karajana, zaaprobowana przez Radę Europy i Unię Europejską. Z racji wielojęzycznego charakteru obu organizacji hymn Europ...

Dieser Artikel behandelt eine seit 1945 in Berlin erscheinende Tageszeitung. Zu weiteren gleichnamigen Publikationen siehe Berliner Zeitung (Begriffsklärung). Berliner Zeitung Beschreibung Tageszeitung Sprache Deutsch Verlag Berliner Verlag (Deutschland) Hauptsitz Berlin Erstausgabe 21. Mai 1945 Erscheinungsweise täglich außer sonntags Verkaufte Auflage 81.613 Exemplare (IVW Q1/2021) Reichweite 0,28 Mio. Leser (MA 2019 II) Chefredakteur Tomasz Kurianowicz Herausgeber Mi...

 

Пятилетки СССРПлакат первой пятилеткиУправление ВСНХ СССР • Госплан СССР Пятилетние планы Первая пятилетка (1928—1932) Вторая пятилетка (1933—1937) Третья пятилетка (1938—1942) Четвёртая пятилетка (1946—1950) Пятая пятилетка (1951—1955) Шестая пятилетка (1956—1960) Седьмая пятилетка (семиле...

 

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