结构化并发笔记,或:Go 语句是有害的 (2018)
本文深入探讨了结构化并发的概念,指出Go语言中的"go"语句(启动goroutine)如同早期编程中的"goto"语句一样有害。作者提出用结构化并发模式(如C语言中的花括号作用域)来替代自由启动的goroutine,以确保子任务的生命周期被严格限定在父任务的作用域内。文章通过多个编程语言的示例展示了结构化并发的实现方式及其带来的可预测性和安全性优势。
本文深入探讨了结构化并发的概念,指出Go语言中的"go"语句(启动goroutine)如同早期编程中的"goto"语句一样有害。作者提出用结构化并发模式(如C语言中的花括号作用域)来替代自由启动的goroutine,以确保子任务的生命周期被严格限定在父任务的作用域内。文章通过多个编程语言的示例展示了结构化并发的实现方式及其带来的可预测性和安全性优势。
Raymond Chen continues his series on cross-process reader/writer locks by addressing fairness, ensuring exclusive (write) acquisitions get a fair chance against repeated shared (read) acquisitions to prevent writer starvation.
The article discusses fractal page mapping, a technique for mapping page tables into memory using the page tables themselves. This approach allows the operating system to access its own page table structures through the virtual memory system it manages.
The article explains that when a C++ compiler reports an error about code you didn't write, you should investigate who actually wrote that code. This helps in understanding misleading error messages like "illegal use of ->" when no arrow operator appears in your source.
The article examines what happens when a C function receives fewer register parameters than expected across different CPU architectures, concluding the outcome is always problematic but especially severe on Itanium.
This post continues a series on building a cross-process reader/writer lock, focusing on handling the scenario where a process holding the lock is terminated, requiring recovery mechanisms for the abandoned lock state.