A lock-free atomic shared_ptr - Timur Doumler - NDC TechTown 2022

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ธ.ค. 2024
  • std : : shared_ptr is a standard smart pointer utility widely used in modern C++. A commonly overlooked property of std : : shared_ptr is that while its control block is thread-safe, the shared_ptr itself isn't. To fix this, C++20 introduced std : : atomic std : : shared_ptr . However, existing implementations are typically not lock-free, rendering std :: atomic std::shared_ptr useless for low-latency and real-time applications.
    What would it take to implement a lock-free atomic shared_ptr? In this talk, we first discuss the motivation and use case, review how std :: shared_ptr works and the history of std :: atomic std::shared_ptr. We then look at existing implementations and different implementation strategies. Finally, we present a new implementation of a lock-free atomic shared_ptr which is portable to multiple platforms.
    Check out more of our featured speakers and talks at
    www.ndcconfere...
    ndctechtown.com/

ความคิดเห็น • 1

  • @OlliS71
    @OlliS71 4 หลายเดือนก่อน

    It doesn't matter if DWCAS is 2x slower. The time for the DWCAS doesn't count. The real cost comes from invalidating other caches sharing the same cacheline for the DWCAS'd word. Cache 2 cache-transfers are usually very slow.