Is Parallel Programming Hard, And, If So, What Can You Do About It?

Paul E. McKenney

出版社

出版时间

2011-12-16

ISBN

9780954899332

评分

★★★★★

标签

编程

书籍介绍

The purpose of this book is to help you understand how to program shared-memory parallel machines without risking your sanity.1 By describing the algorithms and designs that have worked well in the past, we hope to help you avoid at least some of the pitfalls that have beset parallel projects. But you should think of this book as a foundation on which to build, rather than as a completed cathedral. Your mission, if you choose to accept, is to help make further progress in the exciting field of parallel programming, progress that should in time render this book obsolete. Parallel programming is not as hard as it is reputed, and it is hoped that this book makes it even

easier for you.

AI导读
核心看点
  • 本书深入剖析共享内存并行编程的核心难题,明确性能、生产力与通用性三大目标,通过历史案例警示常见陷阱,帮助开发者建立正确的并行思维框架,避免重蹈覆辙。
  • 详细讲解内存屏障、缓存一致性等底层硬件原理,从电子速度限制到乱序执行根因,彻底解构并发编程的物理基础,为理解复杂同步机制提供坚实的理论支撑。
  • 重点阐述RCU(读-拷贝-更新)等高级同步原语的设计思路与实现细节,结合Linux内核实践,深入探讨批处理、快速路径等优化策略,提供极具价值的系统设计经验。
适合谁读
  • 具备C语言基础且熟悉Linux内核API的底层系统开发者,特别是从事操作系统内核、高性能网络协议栈或数据库引擎等对性能极度敏感领域的专业技术人员。
  • 希望深入理解多核CPU架构、内存模型及并发控制原理的高级程序员,旨在突破传统锁机制瓶颈,掌握无锁编程、内存屏障等高级并发技术以解决复杂同步问题。
  • 对并行计算底层机制有强烈求知欲的研究人员或学生,愿意投入大量时间钻研硬件限制与软件实现的交互关系,不畏惧晦涩的底层技术细节,追求极致系统性能优化。
读前提醒
  • 严禁顺序阅读,必须先精读附录C关于内存屏障的内容,否则正文中的代码示例将难以理解;需具备扎实的计算机体系结构知识,否则硬件相关章节会极其晦涩难懂。
  • 书中部分内容涉及未完成的章节或特定内核版本API,阅读时需结合最新Linux内核文档交叉验证;遇到翻译不准的中文版本,强烈建议直接阅读英文原版以确保概念准确。
  • 不要试图一次性掌握所有同步方案,应聚焦于RCU等核心思想的学习;书中穿插的思考题极具价值,务必动手实践验证,切勿仅停留在理论阅读层面,否则无法真正内化知识。
读者共识
  • 被公认为单机多核并行编程领域的‘武林秘籍’,在共享内存并发编程方面无出其右,尽管阅读难度极大,但其在内存屏障和RCU方面的讲解深度远超普通教材,极具收藏价值。
  • 作者Paul E. McKenney学识渊博且态度谦逊,书中不仅传授技术,更传递了严谨的工程思维;读者普遍反映初读痛苦,但反复研读后对并发本质有颠覆性认知,是进阶必经之路。
  • 虽然部分章节未完成或存在翻译瑕疵,且对硬件依赖较重,但其提供的系统级并发设计视角无可替代;读者一致认为这是少数能真正讲透底层并发原理的著作,值得反复精读。

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "Therefore, if you wish to argue that parallel programming will remain as difficult as it is currently perceived by many to be, it is you who bears the burden of proof, keeping in mind the many centuries of counter-examples in a variety of fields of endeavor."
  • "the primary goals of parallel pro- gramming are performance, productivity, and gener- ality."
  • "This book is intended primarily for developers working near the bottom of the stack, where performance and generality are paramount concerns."
  • "It is important to keep in mind that parallelism is but one way to improve performance. Other well- known approaches include the following, in roughly increasing order of difficulty: 1. Run multiple instances of a sequential applica- tion. 2. Construct the application to make use of exist- ing paral"
  • "Most people have an intuitive understanding that passing messages between systems is considerably more expensive than performing simple calcula- tions within the confines of a single system. How- ever, it is not always so clear that communicat- ing among threads within the confines of a single share"
  • "shared-memory parallel programs must normally deal with no obstacle worse than a cache miss, while a distributed parallel program will typically incur the larger network communication latencies."
  • "3.3.3 Light, Not Electrons Although the speed of light would be a hard limit, the fact is that semiconductor devices are limited by the speed of electrons rather than that of light, given that electrons in semiconductor materials move at between 3% and 30% of the speed of light in a vacuum."
作者简介
Paul McKenney is a Distinguished Engineer and CTO of Linux at IBM's Linux Technology Center (LTC). He is the maintainer of the Linux kernel's implementation of RCU and a contributor to the user-level implementation. He chaired the Linux Plumbers Conference Program Committee in 2009 and 2011, and served on the Linux Kernel Summit Program Committee in 2010 and 2011. He has published one netbook, one book chapter, and more than one hundred papers and presentations, and holds more than 80 patents in the USA, PRC, and elsewhere.
目录
1
Introduction
1.1 Historic Parallel Programming Difficulties . . . . . . . . . . . . . . . . .
1.2 Parallel Programming Goals . . . . . . . . . . . . . . . . . . . . . . . .
1.2.1 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . .

显示全部
用户评论
无敌
不多见的讲解并行编程的书,应该打5星,少的一个星是因为这本书目前还没写完。。。
2019.12 最近我回顾了这本书,温故知新。本书阅读的前置条件应该是熟悉C,且对Linux内核Api有一定了解。该书不应该顺序阅读,应该把附录的内存屏障先看完,不然读示例代码会比较难受。该书前面介绍的各种同步方案,都是在给后面的rcu做铺垫,rcu是该书的核心部分。 本书聚焦的是单机多核多CPU环境下的并行编程技术,老实说这个领域没见过比这更好的书了。书中随处可见的QuickQuiz真的是精华,值得反复回味。
中文地址在这里 http://ifeve.com/perfbook/ 还需要再读几遍
讲解的方式很好,但好难
有些地方没讲清楚
Save for later. 先修知识准备不足。
非常优秀的技术书籍,书中穿插的小问题学习方法是个很好的学习方式,作者胸怀宽广,德才兼备,是一个很值得学习的人物。
收藏