Working with Asynchrony Generically: A Tour of C++ Executors
standard async algorithms based on real-world requirements: E.g., then, when_all, sync_wait, repeat, stop_when, timeout, etc. (not all proposed yet) • A standard set of abstractions (aka, concepts) derived LIFETIME OF AN ASYNC OPERATION SCHEDULER schedule SENDER RECEIVER OPERATION STATE connect start …operation completes… … and notifies receiver … time passes… Implementation details of some set_error(receiver, Error) void; set_done(receiver) void; concept operation_state: start(operation_state) void;24 Under the hood of a concurrent operation25 ALL OF THESE SENDERS IMPLEMENT0 码力 | 121 页 | 7.73 MB | 5 月前3Making Libraries Consumable for Non-C++ Developers
Who am I? Still at Microsoft, now on the .NET Core runtime team. • https://github.com/dotnet/runtimeWhat is interoperability? Enabling two or more disparate entities to work together. Don’t touch it Simplified Wrapper and Interface Generator (SWIG) – 1996 JVM – Java Native Interface (JNI) – 1997 .NET – Platform Invoke (P/Invoke), COM interop, C++/CLI – 2002, 2005 JVM – Java Native Access (JNA) – 2007 state/document/reference function conventions. • Defining a macro for calling conventions is a great start. For example, MYLIB_CCONV. • Reference: llvm - CallingConv.h • Don’t throw exceptions across the boundary0 码力 | 29 页 | 1.21 MB | 5 月前3基于Rust-vmm实现Kubernetes运行时
vm-virtio vsock net VFIO APIC vhost Cloud Hypervisor KVM File System Device Driver Host Linux Kernel vCPU block Memory Guest VM containerd + Kata-runtime create start VM start proxy create container container start agent cat << EOT | tee nginx-untrusted.yaml apiVersion: v1 kind: Pod metadata: name: nginx-untrusted annotations: io.kubernetes.cri.untrusted-workload: "true" spec: containers:0 码力 | 27 页 | 34.17 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 15 C++ 系列课:字符与字符串
toupper(c) 把小写字母转换为大写字母,如果不是则原封不动返回。 • tolower(c) 把大写字母转换为小写字母,如果不是则原封不动返回。 帮手函数大全 http://c.biancheng.net/ref/ctype_h/ 关于 char 类型的一个冷知识 • C 语言其实只规定了 unsigned char 是无符号 8 位整数, signed char 是有 符号 8 位整数,而 char 的首地址。 不过对于大字符串,这多出来的 8 字节 (unused) 是完全浪费掉的,但也不亏,就当是为了对齐到 32 字节而故意留的 padding 了。 vector 内存分布示意图 _M_start allocator _M_finish _M_end_of_storage 因此 sizeof(vector) 会得到 24 字节 C++ 的 vector 采用了 [ptr, ptr +0 码力 | 162 页 | 40.20 MB | 1 年前3C++20: An (Almost) Complete Overview
threads std::stop_token Supports actively checking for a stop request Can be used with condition_variable_any std::stop_source Used to request a thread to stop execution Stop requests are are visible to all associated stop_sources and stop_tokens std::stop_callback Callback is called when stop is requested on associated stop_token std::stop_callback myCallback { myStopToken, []{ []{ /* … */ } }; <stop_token>39 Joining & Cancellable Threads Example automatically joining: void DoWorkPreCpp20() { std::thread job { [] { /* ... */ } }; try { // ... Do something else0 码力 | 85 页 | 512.18 KB | 5 月前3Lock-Free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!
12 Daniel Anderson -- danielanderson.net Daniel Anderson Assistant Teaching Professor @ CMU danielanderson.net3 Daniel Anderson -- danielanderson.net What we’ll learn today • How shared_ptr is shared_ptr Things we won’t cover • Alias pointers, weak pointers4 Daniel Anderson -- danielanderson.net What we’ll learn today • How shared_ptr is implemented under the hood • Atomics and concurrency Daniel Anderson -- danielanderson.net Why is this important?6 Daniel Anderson -- danielanderson.net Why is this important?7 Daniel Anderson -- danielanderson.net Why is this important?8 Daniel0 码力 | 45 页 | 5.12 MB | 5 月前3基于 Rust Arrow Flight 的物联网和时序数据传输及转换工具 霍琳贺
spawn_blocking 提交耗时任务 • C FFI 调用时,要关注上下文的线程安全性。 • 多个运行时之间使用 Channel 通信,降低锁使用范围。 Tokio - Graceful Stop • futures::future::Abortable 可用于短路一个 stream • tokio_util::sync::CancellationToken 可用于向一个或多个任务发出取 Cancel 处理按预期退出, Abort 要保证安全退 出。 • 处理非正常退出(断电、 kill -9 等),保证系统安全性。 Thank you ! Tokio - Graceful Stop • 将任务恢复作为优雅退出的目标之一。0 码力 | 29 页 | 2.26 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 11 现代 CMake 进阶指南
https://runebook.dev/zh-CN/docs/cmake/command/cmake_minimum_required#policy-settings https://blog.csdn.net/fuyajun01/article/details/8891749 • CMAKE_BUILD_TOOL: 执行构建过程的工具。该变量设置为 CMake 构建时输出所需的程序。对于 VS 6 PARENT_SCORE 也可以用于 function 的返回值) • https://cmake.org/cmake/help/v3.16/command/set.html • https://blog.csdn.net/Calvin_zhou/article/details/104060927 环境变量的访问方式: $ENV{xx} • 用 ${xx} 访问的是局部变量,局部变量服从刚刚所说的父子模块传播规则。0 码力 | 166 页 | 6.54 MB | 1 年前3Go读书会第二期
性能基准测试、度量数据与 pprof 剖析 • 调试实践 聚焦编码之外的 Go 工具链使用实践 Part9 – 标准库、反射与 cgo 践行哲学,遵循惯例,认清本质,理解原理 • 高频使用的标准库包 ( net 、 http 、 strings 、 time 、 crypto 等 ) • Reflect 反射使用三大法则 • Cgo 使用的开销 • Unsafe 包的安全使用法则 “ 自带电池”,开箱即用0 码力 | 26 页 | 4.55 MB | 1 年前3NativeScript 101
plugins oDebugging JavaScript Why are we here? How did NativeScript come to be? Swift/Obj-C Java .NET We ❤ Web. But… We need: • Better offline support • Access to all device APIs • Home screen availability0 码力 | 90 页 | 40.11 MB | 1 年前3
共 25 条
- 1
- 2
- 3