タグ

concurrentに関するkotaro-onoのブックマーク (2)

  • Compare and Swap

    Compare and swap is a technique used when designing concurrent algorithms. Basically, compare and swap compares the value of a variable with an expected value, and if the values are equal then swaps the value of the variable for a new value. Compare and swap may sound a bit complicated but it is actually reasonably simple once you understand it, so let me elaborate a bit further on the topic. By t

    Compare and Swap
    kotaro-ono
    kotaro-ono 2021/09/27
    AtomicBooleanやAtomicReferenceなどCPUレベルでCompare and Swapを実現するクラス。
  • Go の channel 処理パターン集 | Hori Blog

    Hori Blogフリーランスでバックエンドエンジニアとして活動している Ryota Hori のブログです。 最近はテック系記事より雑記ブログ気味。 この記事は Go Advent Calendar 2017 の 1 日目の記事です。 Go の長所に goroutine による非同期処理がありますが、どうしても channel の取り回しで黒魔術化しがちです。少しでも闇を減らしていきたいので、 channel らへんの取り回しについてパターンをまとめました。チートシート的に使えれば嬉しいです。 Go の channel の基礎 入門資料として使いたいので、題に入る前にざっくり基礎を。 定義のパターン channel には capacity という概念があります。 capacity は channel 内でバッファリングしておける容量のことで、 capacity に空きが無い場合は送信側

    Go の channel 処理パターン集 | Hori Blog
  • 1