Go Context原理及其典型适用场景# Context原理及其适用场景 随手记 李帅(飞雪无情) ___ ¥ 随手记 👨👩👧👦 卡牛 📸 随管家 ___ ## 大纲 常见并发模式 ■ Context实现原理 ☑ TLS VS Context ☑ 典型适用场景 ## Channel func add(a,b int) <-chan int{ sum:=make(chan int) go ## Context ● 一个任务,需要多个goroutine完成 ● 一个请求,会触发好多个goroutine做不同的事情 ● 如果我们的任务终止了,请求取消了,这些正在运行的goroutine怎么办? ● 使用Context来简化这些操作 ## Context能做什么 ## ☑ 手动、定时、超时发出取消信号 ◆ 跨API传值 ☑ 控制生成Context树结构(Context链) func rootctx := context.Background() ctx, cancel := context.WithCancel(rootctx) go watch(ctx) go watch(ctx) time.Sleep(1 * time.Second) cancel() } func watch(ctx context.Context) { for0 码力 | 32 页 | 4.62 MB | 2 年前3
DeepSeek-V4: Towards Highly Efficient Million-Token Context IntelligenceDeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence DeepSeek-AI research@deepseek.com Abstract We present a preview version of DeepSeek-V4 series, including two strong Mixture-of- parameters (49B activated) and DeepSeek-V4-Flash with 284B parameters (13B activated) both supporting a context length of one million tokens. DeepSeek-V4 series incorporate several key upgrades in architecture combines Compressed Sparse Attention (CSA) and Heavily Compressed Attention (HCA) to improve long-context efficiency; (2) Manifold- Constrained Hyper-Connections (mHC) that enhance conventional residual0 码力 | 58 页 | 4.27 MB | 3 月前3
Tracing in TiDB 浅谈全链路监控:
从应用到数据库到 RuntimeTrace & Span   ## Trace & Span 例子  Flat::Span Message descriptor 000 lines of simple C++ ## • Flats support library • Vector, String, Optional, Variant, Array, Span, Span_ref, Uint32 • Minimal in-buffer representations • No pointers • ~500 lines of simple C++ “Programming 0 码力 | 53 页 | 1.03 MB | 1 年前3
Spring Framework 1.2.1 Changelogregisters BeanFactoryAware as default ignored dependency interface Package org.springframework.context * AbstractApplicationContext registers MessageSourceAware/ApplicationContextAware/etc as ignored DefaultXmlBeanDefinitionParser to correctly parse null keys for XML map entries Package org.springframework.context * reworked LocaleContextHolder to use an InheritableThreadLocal, also exposing the thread-bound removed JndiBeanFactoryLocator, in favor of the existing default ContextJndiBeanFactoryLocator in the context package * deprecated SingletonBeanFactoryLocator's alias-through-String-bean feature, in favor0 码力 | 69 页 | 197.87 KB | 2 年前3
Unraveling string_view: Basics, Benefits, and Best Practicesand their interoperability • When to use string_view • Using string_view safely • Intro to span • span vs. string_view • Case study of an optimization using string_view. ## Motivation • Consider destroyed at the end of the full-expression [-Wdangling] 15 | const auto sv = foo("hello"); ## span: Motivation ## Consider the following functions void foo(int* arr, int n) { for (int i = 0; these contiguous containers with a single interface? ## span: Motivation void foo(spans) { for (const auto i : s) { cout << i << ' "; 0 码力 | 61 页 | 1.11 MB | 1 年前3
Back to Basics: C++ Templates - Part 1size away. For example span Can hold both C-Array and std::array. Of course, range-based forready. Cleaned up the code safely and with little overhead. ## bool Send(const span& data) 3 return return write(data.data(), data.size()); void Read(span data) int i = 1; // fill buffer with data for (auto& c : data) { c = i; ++i; } void Main() 18 std::array span Can hold both C-Array and std::array. Of course, range-based forready. Cleaned up the code safely and with little overhead. C++20 Single Header Version of span: [2]. ## 1 template 0 码力 | 17 页 | 817.47 KB | 1 年前3
Spring Framework 1.2.3 Changelogbean names for inner beans as well, with identity hashcode as suffix Package org.springframework.context * factored out AbstractApplicationEventMulticaster base class from * AbstractApplicationEventMulticaster scenarios (with database access) from Countries sample application * revised all XML application context definition files to use Spring 1.2 shortcut attributes as far as possible Package org.springframework registers BeanFactoryAware as default ignored dependency interface Package org.springframework.context * AbstractApplicationContext registers MessageSourceAware/ApplicationContextAware/etc as ignored0 码力 | 74 页 | 215.40 KB | 2 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100
相关搜索词
ContextgoroutineTLS并发模式取消信号DeepSeek-V4Compressed Sparse Attention (CSA)Heavily Compressed Attention (HCA)hybrid attentionMixture-of-Experts (MoE)全链路监控Tracer IDSpan ContextSession VariableJaegerSpring FrameworkBeanFactoryAOPTransactionRegular typesSTLC++string_viewspanPrimitive C++IDL ParserFlatsSpanException Handlingstd::string性能优化内存分配C++ Templatesstd::arrayTemplate ParametersFunction TemplatesBean FactoryCore Utilities













