jsc::chunk_evenly Range Adaptor for Distributing Work Across Tasks
std::ptrdiff_t { chunk_index == remainder ]}; 了] 了 y 一Range adaptorfor dlstributing work across tasks (CZ) ASM comparison > GCC RISC-V 64-bit assembly manual_loop(long,long): jsc-chunk_evenly unnecessary waiting > Iftasks are scheduled as early as possible, then distributin8g work evenly across tasks can improve performance (O) Future Directions > Support random access in jsc: :chunk_even1y_view<>0 码力 | 1 页 | 1.38 MB | 5 月前3Get off my thread: Techniques for moving k to background threads
thread: Spawn a new thread for each event handler Pass data to a dedicated background thread Submit tasks to a generic thread poolHow do we move work off the current thread? Possible ways to move the work thread for each event handler Pass data to a dedicated background thread Submit tasks to a generic thread pool Submit tasks to a special purpose executorSpawning new threads There are lots of ways to spawn pending_threads.push_back( std::move(handle)); }Managing thread handles III Can remove completed tasks by periodically checking: void check_for_done_threads(){ for(auto it=pending_threads.begin(); it0 码力 | 90 页 | 6.97 MB | 5 月前3Rethinking Task Based Concurrency and Parallelism for Low Latency C++
of our data ● Queues for logic (work) is not a good idea: ○ We couple logic and data together as tasks because: ■ Task Queues typically contain more than one type of task (different types of logic) ■ By other shortcomings which further complicate issues ● By their nature, queues bring tasks to threads: ○ Requiring tasks to convey both data and logic ○ Often leading to task class hierarchies, pointers to scale ○ Approximately 1/2N memory requirement (N = number of nodes) Work Contract: ● Enhanced “Tasks” separating data from logic: ○ Contain its own logic ○ Asynchronous execution ○ Recurrening execution0 码力 | 142 页 | 2.80 MB | 5 月前3Taro: Task graph-based Asynchronous Programming Using C++ Coroutine
stream • Each worker has: High-priority queue (HPQ): store suspended tasks Low-priority queue (LPQ): store new tasks We want to resume a suspended task by the same worker as soon as possible stream • Each worker has: High-priority queue (HPQ): store suspended tasks Low-priority queue (LPQ): store new tasks 61Taro’s Scheduler Taro: https://github.com/dian-lun-lin/taro D A C stream • Each worker has: High-priority queue (HPQ): store suspended tasks Low-priority queue (LPQ): store new tasks Worker 1 1. Offload GPU kernels in task A 2. Suspend task A 3. Go to sleep0 码力 | 84 页 | 8.82 MB | 5 月前3Coroutines and Structured Concurrency in Practice
uncaught exceptions Task::detach() allows the task to run alongside the rest of the programDetached tasks considered harmful // don’t do this void bad(tcp::socket& s) { std::arraybuf(1024); asio::detached); } No way to figure out task lifetime => no automatic object lifetime managementDetached tasks considered harmful // don’t do this either void slightly_better(tcp::socket& s) { auto buf = asio::use_awaitable); }, asio::detached); }Detached tasks considered harmful // and also don’t do this void slightly_better(tcp::socket& s) { auto buf 0 码力 | 103 页 | 1.98 MB | 5 月前3Julia 1.12.0 RC1
Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.6 Tasks (aka Coroutines) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 11 Scope of More task operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 24.4 Tasks and events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320CONTENTS v Combinatorics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1120 49 Tasks 1126 49.1 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 2057 页 | 7.44 MB | 3 月前3Julia 1.12.0 Beta4
Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.6 Tasks (aka Coroutines) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 11 Scope of More task operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 24.4 Tasks and events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320CONTENTS v Combinatorics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119 49 Tasks 1125 49.1 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 2057 页 | 7.44 MB | 3 月前3Julia 1.12.0 Beta3
Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.6 Tasks (aka Coroutines) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 11 Scope of More task operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 24.4 Tasks and events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320CONTENTS v Combinatorics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119 49 Tasks 1125 49.1 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 2057 页 | 7.44 MB | 3 月前3julia 1.12.0 beta1
Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.6 Tasks (aka Coroutines) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 11 Scope of More task operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 24.4 Tasks and events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320CONTENTS v Combinatorics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1111 48 Tasks 1117 48.1 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 2047 页 | 7.41 MB | 3 月前3julia 1.13.0 DEV
Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.6 Tasks (aka Coroutines) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 11 Scope of operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319CONTENTS v 24.4 Tasks and events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 25 Multi-Threading Combinatorics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1123 49 Tasks 1128 49.1 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 2058 页 | 7.45 MB | 3 月前3
共 74 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8