Share to: share facebook share twitter share wa share telegram print page

Transactional memory

In computer science and engineering, transactional memory attempts to simplify concurrent programming by allowing a group of load and store instructions to execute in an atomic way. It is a concurrency control mechanism analogous to database transactions for controlling access to shared memory in concurrent computing. Transactional memory systems provide high-level abstraction as an alternative to low-level thread synchronization. This abstraction allows for coordination between concurrent reads and writes of shared data in parallel systems.[1]

Motivation

Atomicity between two parallel transactions with a conflict

In concurrent programming, synchronization is required when parallel threads attempt to access a shared resource. Low-level thread synchronization constructs such as locks are pessimistic and prohibit threads that are outside a critical section from running the code protected by the critical section. The process of applying and releasing locks often functions as an additional overhead in workloads with little conflict among threads. Transactional memory provides optimistic concurrency control by allowing threads to run in parallel with minimal interference.[2] The goal of transactional memory systems is to transparently support regions of code marked as transactions by enforcing atomicity, consistency and isolation.

A transaction is a collection of operations that can execute and commit changes as long as a conflict is not present. When a conflict is detected, a transaction will revert to its initial state (prior to any changes) and will rerun until all conflicts are removed. Before a successful commit, the outcome of any operation is purely speculative inside a transaction. In contrast to lock-based synchronization where operations are serialized to prevent data corruption, transactions allow for additional parallelism as long as few operations attempt to modify a shared resource. Since the programmer is not responsible for explicitly identifying locks or the order in which they are acquired, programs that utilize transactional memory cannot produce a deadlock.[2]

With these constructs in place, transactional memory provides a high-level programming abstraction by allowing programmers to enclose their methods within transactional blocks. Correct implementations ensure that data cannot be shared between threads without going through a transaction and produce a serializable outcome. For example, code can be written as:

def transfer_money(from_account, to_account, amount):
    """Transfer money from one account to another."""
    with transaction():
        from_account.balance -= amount
        to_account.balance   += amount

In the code, the block defined by "transaction" is guaranteed atomicity, consistency and isolation by the underlying transactional memory implementation and is transparent to the programmer. The variables within the transaction are protected from external conflicts, ensuring that either the correct amount is transferred or no action is taken at all. Note that concurrency related bugs are still possible in programs that use a large number of transactions, especially in software implementations where the library provided by the language is unable to enforce correct use. Bugs introduced through transactions can often be difficult to debug since breakpoints cannot be placed within a transaction.[2]

Transactional memory is limited in that it requires a shared-memory abstraction. Although transactional memory programs cannot produce a deadlock, programs may still suffer from a livelock or resource starvation. For example, longer transactions may repeatedly revert in response to multiple smaller transactions, wasting both time and energy.[2]

Hardware vs. software

Hardware transactional memory using read and write bits

The abstraction of atomicity in transactional memory requires a hardware mechanism to detect conflicts and undo any changes made to shared data.[3] Hardware transactional memory systems may comprise modifications in processors, cache and bus protocol to support transactions.[4][5][6][7][8] Speculative values in a transaction must be buffered and remain unseen by other threads until commit time. Large buffers are used to store speculative values while avoiding write propagation through the underlying cache coherence protocol. Traditionally, buffers have been implemented using different structures within the memory hierarchy such as store queues or caches. Buffers further away from the processor, such as the L2 cache, can hold more speculative values (up to a few megabytes). The optimal size of a buffer is still under debate due to the limited use of transactions in commercial programs.[3] In a cache implementation, the cache lines are generally augmented with read and write bits. When the hardware controller receives a request, the controller uses these bits to detect a conflict. If a serializability conflict is detected from a parallel transaction, then the speculative values are discarded. When caches are used, the system may introduce the risk of false conflicts due to the use of cache line granularity.[3] Load-link/store-conditional (LL/SC) offered by many RISC processors can be viewed as the most basic transactional memory support; however, LL/SC usually operates on data that is the size of a native machine word, so only single-word transactions are supported.[4] Although hardware transactional memory provides maximal performance compared to software alternatives, limited use has been seen at this time.

Software transactional memory provides transactional memory semantics in a software runtime library or the programming language,[9] and requires minimal hardware support (typically an atomic compare and swap operation, or equivalent). As the downside, software implementations usually come with a performance penalty, when compared to hardware solutions. Hardware acceleration can reduce some of the overheads associated with software transactional memory.

Owing to the more limited nature of hardware transactional memory (in current implementations), software using it may require fairly extensive tuning to fully benefit from it. For example, the dynamic memory allocator may have a significant influence on performance and likewise structure padding may affect performance (owing to cache alignment and false sharing issues); in the context of a virtual machine, various background threads may cause unexpected transaction aborts.[10]

History

One of the earliest implementations of transactional memory was the gated store buffer used in Transmeta's Crusoe and Efficeon processors. However, this was only used to facilitate speculative optimizations for binary translation, rather than any form of speculative multithreading, or exposing it directly to programmers. Azul Systems also implemented hardware transactional memory to accelerate their Java appliances, but this was similarly hidden from outsiders.[11]

Sun Microsystems implemented hardware transactional memory and a limited form of speculative multithreading in its high-end Rock processor. This implementation proved that it could be used for lock elision and more complex hybrid transactional memory systems, where transactions are handled with a combination of hardware and software. The Rock processor was canceled in 2009, just before the acquisition by Oracle; while the actual products were never released, a number of prototype systems were available to researchers.[11]

In 2009, AMD proposed the Advanced Synchronization Facility (ASF), a set of x86 extensions that provide a very limited form of hardware transactional memory support. The goal was to provide hardware primitives that could be used for higher-level synchronization, such as software transactional memory or lock-free algorithms. However, AMD has not announced whether ASF will be used in products, and if so, in what timeframe.[11]

More recently, IBM announced in 2011 that Blue Gene/Q had hardware support for both transactional memory and speculative multithreading. The transactional memory could be configured in two modes; the first is an unordered and single-version mode, where a write from one transaction causes a conflict with any transactions reading the same memory address. The second mode is for speculative multithreading, providing an ordered, multi-versioned transactional memory. Speculative threads can have different versions of the same memory address, and hardware implementation keeps track of the age for each thread. The younger threads can access data from older threads (but not the other way around), and writes to the same address are based on the thread order. In some cases, dependencies between threads can cause the younger versions to abort.[11]

Intel's Transactional Synchronization Extensions (TSX) is available in some of the Skylake processors. It was earlier implemented in Haswell and Broadwell processors as well, but the implementations turned out both times to be defective and support for TSX was disabled. The TSX specification describes the transactional memory API for use by software developers, but withholds details on technical implementation.[11] ARM architecture has a similar extension.[12]

As of GCC 4.7, an experimental library for transactional memory is available which utilizes a hybrid implementation. The PyPy variant of Python also introduces transactional memory to the language.

Available implementations

See also

References

  1. ^ Harris, Tim; Larus, James; Rajwar, Ravi (2010-06-02). "Transactional Memory, 2nd edition". Synthesis Lectures on Computer Architecture. 5 (1): 1–263. doi:10.2200/S00272ED1V01Y201006CAC011. ISSN 1935-3235.
  2. ^ a b c d "Transactional Memory: History and Development". Kukuruku Hub. Retrieved 2016-11-16.
  3. ^ a b c Solihin, Yan (2016). Fundamentals of Parallel Multicore Architecture. Berkeley, California: Chapman & Hall. pp. 287–292. ISBN 978-1-4822-1118-4.
  4. ^ a b Herlihy, Maurice; Moss, J. Eliot B. (1993). "Transactional memory: Architectural support for lock-free data structures" (PDF). Proceedings of the 20th International Symposium on Computer Architecture (ISCA). pp. 289–300.
  5. ^ Stone, J.M.; Stone, H.S.; Heidelberger, P.; Turek, J. (1993). "Multiple Reservations and the Oklahoma Update". IEEE Parallel & Distributed Technology: Systems & Applications. 1 (4): 58–71. doi:10.1109/88.260295. S2CID 11017196.
  6. ^ Hammond, L; Wong, V.; Chen, M.; Carlstrom, B.D.; Davis, J.D.; Hertzberg, B.; Prabhu, M.K.; Honggo Wijaya; Kozyrakis, C.; Olukotun, K. (2004). "Transactional memory coherence and consistency". Proceedings of the 31st annual International Symposium on Computer Architecture (ISCA). pp. 102–13. doi:10.1109/ISCA.2004.1310767.
  7. ^ Ananian, C.S.; Asanovic, K.; Kuszmaul, B.C.; Leiserson, C.E.; Lie, S. (2005). "Unbounded transactional memory". 11th International Symposium on High-Performance Computer Architecture. pp. 316–327. doi:10.1109/HPCA.2005.41. ISBN 0-7695-2275-0.
  8. ^ "LogTM: Log-based transactional memory" (PDF). WISC.
  9. ^ "The ATOMOΣ Transactional Programming Language" (PDF). Stanford. Archived from the original (PDF) on 2008-05-21. Retrieved 2009-06-15.
  10. ^ Odaira, R.; Castanos, J. G.; Nakaike, T. (2013). "Do C and Java programs scale differently on Hardware Transactional Memory?". 2013 IEEE International Symposium on Workload Characterization (IISWC). p. 34. doi:10.1109/IISWC.2013.6704668. ISBN 978-1-4799-0555-3.
  11. ^ a b c d e David Kanter (2012-08-21). "Analysis of Haswell's Transactional Memory". Real World Technologies. Retrieved 2013-11-19.
  12. ^ "Arm releases SVE2 and TME for A-profile architecture - Processors blog - Processors - Arm Community". community.arm.com. 18 April 2019. Retrieved 2019-05-25.
  13. ^ "Transactional Memory Extension (TME) intrinsics". Retrieved 2020-05-05.
  14. ^ "IBM plants transactional memory in CPU". EE Times.
  15. ^ Brian Hall; Ryan Arnold; Peter Bergner; Wainer dos Santos Moschetta; Robert Enenkel; Pat Haugen; Michael R. Meissner; Alex Mericas; Philipp Oehler; Berni Schiefer; Brian F. Veale; Suresh Warrier; Daniel Zabawa; Adhemerval Zanella (2014). Performance Optimization and Tuning Techniques for IBM Processors, including IBM POWER8 (PDF). IBM Redbooks. pp. 37–40. ISBN 978-0-7384-3972-3.
  16. ^ Wei Li, IBM XL compiler hardware transactional memory built-in functions for IBM AIX on IBM POWER8 processor-based systems
  17. ^ "Power ISA Version 3.1". openpowerfoundation.org. 2020-05-01. Retrieved 2020-10-10.
  18. ^ Java on a 1000 Cores – Tales of Hardware/Software CoDesign on YouTube
  19. ^ "Control.Monad.STM". hackage.haskell.org. Retrieved 2020-02-06.
  20. ^ "STMX Homepage".
  21. ^ Wong, Michael. "Transactional Language Constructs for C++" (PDF). Retrieved 12 Jan 2011.
  22. ^ "Brief Transactional Memory GCC tutorial".
  23. ^ "C Dialect Options - Using the GNU Compiler Collection (GCC)".
  24. ^ "TransactionalMemory - GCC Wiki".
  25. ^ Rigo, Armin. "Using All These Cores: Transactional Memory in PyPy". europython.eu. Retrieved 7 April 2015.
  26. ^ "picotm - Portable Integrated Customizable and Open Transaction Manager".
  27. ^ "Concurrent::TVar".

Further reading

  • Harris, Tim; Larus, James R.; Rajwar, Ravi (December 2010), Transactional Memory, 2nd edition, Synthesis Lectures on Computer Architecture, vol. 5, Morgan & Claypool, pp. 1–263, doi:10.2200/S00272ED1V01Y201006CAC011
  • McKenney, Paul E.; Michael, Maged M.; Triplett, Josh; Walpole, Jonathan (July 2010). "Why the grass may not be greener on the other side: a comparison of locking vs. transactional memory". SIGOPS Oper. Syst. Rev. 44 (3). New York, NY, USA: ACM: 93–101. doi:10.1145/1842733.1842749. ISSN 0163-5980. S2CID 1917393.
  • Dave Dice, Yossi Lev, Mark Moir, Dan Nussbaum, and Marek Olszewski. (2009) "Early experience with a commercial hardware transactional memory implementation." Sun Microsystems technical report (60 pp.) SMLI TR-2009-180. A short version appeared at ASPLOS’09 doi:10.1145/1508244.1508263
  • Amy Wang, Matthew Gaudet, Peng Wu, José Nelson Amaral, Martin Ohmacht, Christopher Barton, Raul Silvera, and Maged Michael. "Evaluation of Blue Gene/Q hardware support for transactional memories Archived 2013-06-27 at the Wayback Machine". In Proceedings of the 21st international conference on Parallel architectures and compilation techniques, pp. 127–136. ACM, 2012.
  • Jacobi, C., Slegel, T., & Greiner, D. (2012, December). "Transactional memory architecture and implementation for IBM System z Archived 2016-03-04 at the Wayback Machine". In Microarchitecture (MICRO), 2012 45th Annual IEEE/ACM International Symposium on (pp. 25–36). IEEE.
  • Harold W. Cain, Maged M. Michael, Brad Frey, Cathy May, Derek Williams, and Hung Le. "Robust Architectural Support for Transactional Memory in the Power Architecture." In ISCA '13 Proceedings of the 40th Annual International Symposium on Computer Architecture, pp. 225–236, ACM, 2013. doi:10.1145/2485922.2485942

Read other articles:

Central government of the Kingdom of Eswatini This article is about the Eswatini government. For recent and past political developments in Eswatini, see Politics of Eswatini. Government of the Kingdom of EswatiniCentral governmentOverviewEstablished6 September 1968; 55 years ago (1968-09-06)StateEswatiniLeaderNgwenyama (King of Eswatini) (Mswati III) Prime Ministers of Eswatini (Cleopas Dlamini)Websitewww.gov.sz Government of the Kingdom of Eswatini is the union government crea…

صمام ضوئي (بالإنجليزية: phototube) هي أنبوب مفرغ من الهواء وقد يملأ بغاز خامل، الأنبوب يشبه اللمبة وهي شديدة الحساسية للضوء في النطاقات : الأشعة فوق البنفسجية ، و الضوء المرئي و الأشعة تحت الحمراء القريبة من الضوء الأحمر في الطيف .[1] طريقة العمل تعمل الصمامات الضوئية طبقا ل

Province of Turkey Province in TurkeyBingöl Province Bingöl iliProvinceLocation of the province within TurkeyCountryTurkeySeatBingölGovernment • ValiAhmet Hamdi UstaArea8,003 km2 (3,090 sq mi)Population (2022)[1]282,556 • Density35/km2 (91/sq mi)Time zoneTRT (UTC+3)Area code0426Websitewww.bingol.gov.tr Bingöl Province (Turkish: Bingöl ili, lit. 'province of a thousand lakes'; Kurdish: Parêzgeha Çewlîg;[2] Zaza…

Artikel ini hampir seluruhnya merupakan ringkasan alur. Artikel ini harus diperluas untuk menyediakan cakupan konteks dunia nyata yang lebih seimbang. Please edit the article to focus on discussing the work rather than merely reiterating the plot. (Pelajari cara dan kapan saatnya untuk menghapus pesan templat ini) Darah Perawan Bulan MaduSutradara Hartawan Triguna Produser Hartawan Triguna Ditulis oleh Sekar Ayu Asmara PemeranRoni Galoeng Indah KalaloRestu SinagaAdelia RasyaYogi AldiPenata …

NATO attack on a target during the 1999 NATO aerial bombardment of Yugoslavia Main article: NATO bombing of Yugoslavia NATO bombing of the Radio Television of Serbia HeadquartersThe damaged headquarters of RTSLocationBelgrade, Federal Republic of YugoslaviaCoordinates44°48′41″N 20°28′12″E / 44.81139°N 20.47000°E / 44.81139; 20.47000Date24 April 1999 02:06 am (CET)TargetRadio Television of SerbiaAttack typeMissile attackDeaths16Injured16[1]PerpetratorsN…

Peta Lokasi Kabupaten Pringsewu di Lampung Berikut ini adalah daftar kecamatan dan kelurahan/desa di kabupaten Pringsewu, Provinsi Lampung, Indonesia. Kabupaten Pringsewu terdiri dari 9 kecamatan, 5 kelurahan, dan 128 pekon (desa). Pada tahun 2017, jumlah penduduknya mencapai 421.180 jiwa dengan luas wilayah 625,00 km² dan sebaran penduduk 673 jiwa/km².[1][2] Daftar kecamatan dan kelurahan di Kabupaten Pringsewu, adalah sebagai berikut: Kode Kemendagri Kecamatan Jumlah Keluraha…

In chemical graph theory, the Szeged index is a topological index of a molecule, used in biochemistry. The Szeged index, introduced by Iván Gutman, [1] generalizes the concept of the Wiener index introduced by Harry Wiener. The Szeged index of a connected graph G is defined as S z ( G ) = ∑ e ∈ E ( G ) n 1 ( e ∣ G ) n 2 ( e ∣ G ) , {\displaystyle Sz(G)=\sum _{e\in E(G)}n_{1}(e\mid G)n_{2}(e\mid G),} If e is an edge of G connecting vertices u and v, then we wr…

6. Eurovision Young Musicians Datum 3. Juni 1992 (Halbfinale 1)4. Juni 1992 (Halbfinale 2)9. Juni 1992 (Finale) Austragungsland Belgien Belgien Austragungsort Cirque Royal, Brüssel Austragender Fernsehsender Teilnehmende Länder 13 Gewinner Polen Polen Erstmalige Teilnahme Polen PolenUngarn Ungarn Zurückgezogene Teilnehmer Frankreich FrankreichGriechenland GriechenlandIrland IrlandItalien ItalienNiederlande NiederlandePortugal PortugalSchweden&…

  لمعانٍ أخرى، طالع ماي ليتل بوني: فرندشيب إز ماجيك (لعبة فيديو). مهرتي الصغيرة: الصداقة هي السحرMy Little Pony: Friendship Is Magic التعليق شعار مهرتي الصغيرة: الصداقة هي السحر النوع مغامرةكوميديافنتازيا صيغة مسلسل رسوم متحركة تأليف لورين فاوست،  وهاسبرو ستوديوز  تطوير لورين فاو

Hildesheim-Peiner Kreis-Eisenbahn Kursbuchstrecke (DB):ex 204f[1]Streckenlänge:31,4 kmSpurweite:1435 mm (Normalspur) Legende aus Hannover und Hameln und aus Göttingen 0,0 Hildesheim Bahnstrecke Hildesheim–Goslar und HI–Braunschweig Bahnstrecke Lehrte–Hildesheim 0,4 Hildesheim Nord 3,0 Bavenstedt 5,6 Hönnersum 7,3 Machtsum 9,0 Hüddessum 10,5 Rautenberg (Han) 12,3 Clauen Zuckerfabrik 14,1 Clauen Dorf 16,2 Harber 17,1 Hohenhameln 20,1 Bekum-Stedum 22,7 Equord 25,4 S…

Ehrenmal-Kapelle Blick vom Ehrenmal ins Tal Blick auf das Ehrenmal von Brohl aus Das Ehrenmal des Infanterie-Regiments „von Horn“ (3. Rheinisches) Nr. 29 wurde zwischen 1931 und 1933 auf einer Anhöhe in Rheinbrohl, der Rheinbrohler Ley, errichtet. Inhaltsverzeichnis 1 Geschichte 2 Architektur 3 Tradition 4 Sonstiges 5 Quelle 6 Weblinks Geschichte Das Ehrenmal wurde als Ersatzruhestätte für die 3540 Gefallenen des Infanterie-Regiments Nr. 29 im Ersten Weltkrieg errichtet. Entworfen ha…

Europäische Union EFTA-Staaten mit Zugang zum Europäischen Binnenmarkt mit Ausnahmen DCFTA mit eingeschränktem Zugang Europäische Zollunion (EUCU) Europäische Union Der Europäische Binnenmarkt ist der gemeinsame Binnenmarkt der Mitgliedstaaten der Europäischen Union, der unter diesem Namen offiziell seit dem 1. Januar 1993 existiert. Nach Angaben des deutschen Bundeswirtschaftsministeriums war der Europäische Binnenmarkt 2009 mit der Erweiterung der Europ

Artikel ini sebatang kara, artinya tidak ada artikel lain yang memiliki pranala balik ke halaman ini.Bantulah menambah pranala ke artikel ini dari artikel yang berhubungan atau coba peralatan pencari pranala.Tag ini diberikan pada Februari 2023. Himsar Ambarita lahir di kampung jagung, pinggiran kebun PTPN IV Simalungun, pada tanggal 10 Juni 1972. Ia merupakan guru besar Universitas Sumatera Utara (USU) dari Fakultas Teknik, termasuk peringkat empat puluh empat kategori ilmuan berpengaruh di dun…

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (نوفمبر 2017) مايكل فوريست معلومات شخصية الميلاد 17 أبريل 1929 (العمر 94 سنة)هارفي، الولايات المتحدة مواطنة الولايات المتحدة  الحياة العملية المدرسة الأم جامعة واشنطنجامعة…

American actress Gretchen WylerWyler in 1977BornGretchen Patricia Wienecke(1932-02-16)February 16, 1932Oklahoma City, Oklahoma, U.S.DiedMay 27, 2007(2007-05-27) (aged 75)Camarillo, California, U.S.OccupationActress & DancerYears active1950–2002Spouse Shepard Coleman ​ ​(m. 1956; div. 1968)​ Gretchen Wyler (born Gretchen Patricia Wienecke; February 16, 1932 – May 27, 2007) was an American actress and dancer. She was also an ani…

Nick CogleyCogley dalam Honest Hutch (1920)LahirNickolas P. J. Cogley4 Mei 1869New York, New York, Amerika SerikatMeninggal20 Mei 1936(1936-05-20) (umur 67)Santa Monica, California, Amerika SerikatTahun aktif1909–1934 Nickolas P. J. Cogley (4 Mei 1869 – 20 Mei 1936) adalah seorang pemeran, sutradara dan penulis Amerika Serikat pada era film bisu. Ia tampil dalam lebih dari 170 film antara 1909 dan 1934. Sebagian filmografi The Sanitarium (1910) The New Superintendent …

Qi Yuhong Plaats uw zelfgemaakte foto hier Persoonlijke informatie Volledige naam Qi Yuhong Geboortedatum 25 augustus 1989 Geboorteplaats Shanghai Geboorteland China Nationaliteit  China Sportieve informatie Discipline Boogschieten Onderde(e)l(en) Recurve Olympische Spelen 2016 Portaal    Sport Qi Yuhong (Shanghai, 25 augustus 1989) is een Chinees boogschutster. Carrière Yuhong nam in 2016 deel aan de Olympische Spelen waar ze achtereen volgens won van Marina Canetta en Alexandra…

1977 novel by Naguib Mahfouz The Harafish Early Arabic editionAuthorNaguib MahfouzOriginal titleملحمة الحرافيشTranslatorCatherine CobhamCountryEgyptLanguageArabicGenreNovelPublisherMaktabat Misr (1977 arabic)Doubleday (Eng. trans.)Publication date1977Published in EnglishApril 1994Media typePrint (Paperback)ISBN0-385-42324-1 (Eng. trans.)OCLC27894526Dewey Decimal892/.736 20LC ClassPJ7846.A46 M2813 1994 The Harafish (Arabic: الحرافيش) (in orig. Arabic Malha…

  Ardisaأرديسا (بالإسبانية: Ardisa)‏[1]    أرديسا أرديسا تقسيم إداري البلد  إسبانيا[2] المنطقة أراغون المسؤولون المقاطعة سرقسطة خصائص جغرافية إحداثيات 42°12′03″N 0°45′30″W / 42.2008637°N 0.7582436°W / 42.2008637; -0.7582436[3]  [4] المساحة 27,18 كم² كم² الارتفاع 433.0 متر …

إستريلا دا أمادورا تأسس عام 1932  البلد البرتغال  الموقع الرسمي الموقع الرسمي  تعديل مصدري - تعديل   نادي إستريلا دا أمادورا لكرة القدم (بالبرتغالية: Clube de Futebol Estrela da Amadora‏) نادي كرة قدم برتغالي تم تأسيسه في عام 1932 , وتم حله في عام 2011.[1] روابط خارجية Estrela da Amadora مراجع…

Kembali kehalaman sebelumnya

Lokasi Pengunjung: 3.135.198.130