hazard pointer synchronous reclamation1 Basic Hazard Pointer Algorithm read pointer A from SRC remove A from SRC 1 5 4 Safe to use pointer A SRC A hazard pointer is a single-writer multi-reader pointer. set HP to A if SRC == A clear ACCESS If a hazard pointer points to an object before its removal, then the object will not be reclaimed as long as the hazard pointer remains unchanged unchanged. *A Hazard Pointer Synchronous Reclamation Beyond Concurrency TS2 – Maged Michael Protector Remover / Reclaimer Hazard pointers protect access to objects that may be removed concurrently. SAFE RECLAMATION0 码力 | 31 页 | 856.38 KB | 6 月前3
Finding Bugs using Path-Sensitive Static Analysisif (var == 1) { *p = 42; // Null dereference? } } p -> Unknown p -> NotNull p -> Unknown p -> Null p -> MaybeNull p -> MaybeNull Warning Unknown Null NotNull MaybeNull Analysis state (cond) { var = 2; p = nullptr; } // branch 3 if (var == 1) { *p = 42; // Null dereference? } }Flow-sensitive analysis resourcesPath- sensitive checksvoid path_sensitive(int *p, *p = 42; // Null dereference? } } p: ?1 cond: ?2 var: 0 p: ?1 cond: ?2 var: 1 ?1 != 0 p: null cond: 1 var: 2 p: null cond: ?2 var: 0 p: ?1 cond: 0 var: 1 ?1 != 0 p: null cond: 1 var:0 码力 | 35 页 | 14.13 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - 10 从稀疏数据结构到量化数据类型用一个指针的数组来表示 图片解释:指针数组的原理 1 nul nul 2 3 nul nul nul nul 表示 nullptr (空指针) 图片解释:指针数组的稀疏 这样指针表中为 null 的部分,稠密叶节点的内存就省掉 了 垃圾回收 (garbage-collect) • 如果是运行的仿真,则液体可能会移动到 别的地方去。这时液体曾经存在过的地方 也仍然处于激活状态,可以每隔若干帧及 实现稀疏的方法有: • hash 哈希(本例中的 unordered_map ) • pointer 指针(本例中的 Block1 ) • dense 稠密(本例中的 Block ) • 他们之间可以相互组合,形成更复杂的稀疏数据结构。 • 下面这个例子中的稀疏数据结构,用这种语言可以表示为 hash().pointer(11).dense(8) 。 封装起来,方便多层解耦 封装起来,方便多层解耦 封装起来,方便多层解耦 封装起来,方便多层解耦 封装起来,方便多层解耦 封装起来,方便多层解耦 • 这样就封装好了,通过模板的方式实现了 自定义的稀疏数据结构: • hash().pointer(11).dense(8) 开源的体素处理库: OpenVDB • OpenVDB 的稀疏体积,可以存储符号距 离场 (SDF) ,也可以存储烟雾仿真的结果 等。 • 据张心欣说, OpenVDB 赢得了奥斯卡奖0 码力 | 102 页 | 9.50 MB | 1 年前3
绕过conntrack,使用eBPF增强 IPVS优化K8s网络性能Ingress • Move IPVS Netfilter hook from local-in to PREROUTING • The challenges • Skb’s pointer to route is NULL during PREROUTING • No de-fragment is done during PREROUTING IPVS bypass conntrack (con0 码力 | 24 页 | 1.90 MB | 1 年前3
C++高性能并行编程与优化 - 课件 - 02 现代 C++ 入门:RAII 内存管理new C(...) 等价,括号里也可以有 其他构造函数的参数。 unique_ptr :封装的智慧 • 在旧时代 C++ 里,常常听到这样的说法: • “ 释放一个指针后,必须把这个指针设为 NULL , 防止空悬指针!” • delete p; • p = nullptr; • unique_ptr 则把他们封装成一个操作:只需要 • p = nullptr; // 等价于: 4. std::unique_ptr::release() 5. std::enable_shared_from_this 6. dynamic_cast 7. std::dynamic_pointer_cast 8. 运算符重载 9. 右值引用 && 10. std::shared_ptr和 std::any • 只提供了关键字,详细信息请善用搜索引擎: bing.com 0 码力 | 96 页 | 16.28 MB | 1 年前3
Lock-Free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!(thankfully) not used by either implementation • Both use the lowest-order bits on the control_block pointer as a lock26 Daniel Anderson -- danielanderson.net Solution #2: The split reference count • Used project on GitHub by Vladislav Tyulbashev Key idea: If we could atomically load the control_block pointer and increment the reference count at the same time, we would avoid the race to zero27 Daniel Anderson Big idea: local_ref_count counts the number of in- flight atomic loads on the currently stored pointer atomic> control_block28 Daniel Anderson -- danielanderson.net Solution #2: The 0 码力 | 45 页 | 5.12 MB | 6 月前3
C++20: An (Almost) Complete Overviewaccessing pointer not thread-safe, one thread could be reading pointer, while another thread could be storing new pointer Make it thread-safe? Manually use mutex to protect access to smart pointer Use0 码力 | 85 页 | 512.18 KB | 6 月前3
C++高性能并行编程与优化 - 课件 - 性能优化之无分支编程 Branchless Programming而函数指针也是无条件跳转指令: jmp [pointer] 或者说 call [pointer] ,区别在于他的地址 不是写死的,而是动态从内存中读取出来的。 • 普通函数调用的目的地址(或偏移量)写死在指令里, CPU 可以自动预取这个地址的指令。 • 但是函数指针的调用,因为这个目的地址是需要计算得出的,或者说他存在内存中,随时可 能被改写, CPU 难以预判执行到 call [pointer] 的时候这个指针会指向哪里,无法预取。0 码力 | 47 页 | 8.45 MB | 1 年前3
C++20 STL Features: 1 Year of Development on GitHubNeargye) • P0595R2 is_constant_evaluated() (GH-353, Jennifer Yao – MSVC compiler) • P1006R1 constexpr pointer_to() (GH-397, AdamBucior) • P1023R0 constexpr array Comparisons (GH-599, Weheineman) • P1032R1 spans are implicitly constructible from arrays and vectors • Avoids ownership confusion, accidental pointer arithmetic • span span ; span 🐞 span • Shallow const, like T* • 0 码力 | 45 页 | 702.09 KB | 6 月前3
Bringing Existing Code to CUDA Using constexpr and std::pmrbridging the CPU-GPU divide. Managed memory is accessible to both the CPU and GPU using a single pointer. The key is that the system automatically migrates data allocated in Unified Memory between host bridging the CPU-GPU divide. Managed memory is accessible to both the CPU and GPU using a single pointer. The key is that the system automatically migrates data allocated in Unified Memory between host0 码力 | 51 页 | 3.68 MB | 6 月前3
共 18 条
- 1
- 2
相关搜索词
hazardpointersynchronousreclamationFindingBugsusingPathSensitiveStaticAnalysisC++高性性能高性能并行编程优化课件10绕过conntrack使用eBPF增强IPVSK8s网络02LockFreeAtomicSharedPointersWithoutSplitReferenceCountItCanBeDone20AnAlmostCompleteOverviewSTLFeaturesYearofDevelopmentonGitHubBringingExistingCodetoCUDAUsingconstexprandstdpmr













