zoukankan      html  css  js  c++  java
  • Synchronization constructs of four categories

    Simple blocking methods
    These wait for another thread to finish or for a period of time to elapse. SleepJoin, and Task.Wait are simple blocking methods.
    Locking constructs
    These limit the number of threads that can perform some activity or execute a section of code at a time.Exclusive locking constructs are most common — these allow just one thread in at a time, and allow competing threads to access common data without interfering with each other. The standard exclusive locking constructs are lock (Monitor.Enter/Monitor.Exit), Mutex, and SpinLock. The nonexclusive locking constructs areSemaphoreSemaphoreSlim, and the reader/writer locks.
    Signaling constructs
    These allow a thread to pause until receiving a notification from another, avoiding the need for inefficient polling. There are two commonly used signaling devices: event wait handles and Monitor’s Wait/Pulse methods. Framework 4.0 introduces the CountdownEvent and Barrier classes.
    Nonblocking synchronization constructs
    These protect access to a common field by calling upon processor primitives. The CLR and C# provide the following nonblocking constructs: Thread.MemoryBarrier, Thread.VolatileRead, Thread.VolatileWrite, thevolatile keyword, and the Interlocked class.

    Blocking is essential to all but the last category. 

  • 相关阅读:
    loj #6201. 「YNOI2016」掉进兔子洞
    poj 3683 Priest John's Busiest Day
    hdu 1814 Peaceful Commission
    poj 3207 Ikki's Story IV
    loj #2305. 「NOI2017」游戏
    uoj #111. 【APIO2015】Jakarta Skyscrapers
    洛谷P1550 [USACO08OCT]打井Watering Hole
    uoj #110. 【APIO2015】Bali Sculptures
    loj #2116. 「HNOI2015」开店
    codevs 3044 矩形面积求并
  • 原文地址:https://www.cnblogs.com/malaikuangren/p/2533054.html
Copyright © 2011-2022 走看看