在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例Clojure → (中英对照双语)Rust-Atomics-and-Locks.pdf

(中英对照双语)Rust-Atomics-and-Locks.pdf

Clojure

下载此实例
  • 开发语言:Others
  • 实例大小:2.77M
  • 下载次数:11
  • 浏览次数:62
  • 发布时间:2023-03-12
  • 实例类别:Clojure
  • 发 布 人:jyyiii
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: lock rust and pdf ck

实例介绍

【实例简介】(中英对照双语)Rust-Atomics-and-Locks.pdf

【实例截图】

【核心代码】

Who This Book is For
The ?rimary audience for this book is Rust develo?ers who want to learn
more about low-level concurrency. Additionally, this book can also be
suitable for those who are not very familiar with Rust yet, but would like to
know what low-level concurrency looks like from a Rust ?ers?ective.
本书的主要受众是想要了解低级并发性的Rust开发人员。此外,本书
也适合那些对Rust不太熟悉,但想从Rust的角度了解低级并发性的
人。
It is assumed you know the basics of Rust, have a recent Rust com?iler
installed, and know how to com?ile and run Rust code using cargo. Rust
conce?ts that are im?ortant for concurrency are briefly e??lained when
relevant, so no ?rior knowledge about Rust concurrency is necessary.
假设您已经了解 Rust 的基础知识,已经安装了最新的 Rust 编译器,
并且知道如何使用 cargo 编译和运行 Rust 代码。?并发相关的 Rust 概
念在相关时会简要解释,因此不需要事先了解 Rust 并发知识。
Overview o? the Cha?ters
This book consists of ten cha?ters. Here’s what to e??ect from each cha?ter,
and what to look forward to:
这本书由十个章节组成。以下是每个章节的预期内容和期待的内容:
Chapter 1 — Basics of Rust Concurrency
This cha?ter introduces all the tools and conce?ts we need for basic
concurrency in Rust, such as threads, mute?es, thread safety, shared and
e?clusive references, interior mutability, and so on, which are
foundational to the rest of the book.
本章介绍了Rust中基本并发所需的所有工具和概念,例如线程、互
斥锁、线程安全、共享和独占引用、内部可变性等,这些是本书其
余部分的基础。
For e??erienced Rust ?rogrammers who are familiar with these
conce?ts, this cha?ter can serve as a ?uick refresher. For those who
know these conce?ts from other languages but aren’t very familiar with
Rust yet, this cha?ter will ?uickly fill you in on any Rust-s?ecific
knowledge you might need for the rest of the book.
对于有经验的Rust程序员,熟悉这些概念,本章可以作为一个快速
复习。对于那些从其他语言了解这些概念但还不太熟悉Rust的人来
说,本章将快速为您填补任何您可能需要的Rust特定知识,以便阅
读本书的其余部分。
Chapter 2 — Atomics
In the second cha?ter we’ll learn about Rust’s atomic ty?es and all their
o?erations. We start with sim?le load and store o?erations, and build our
way u? to more advanced compare-and-exchange loops, e??loring each
new conce?t with several real world use cases as usable e?am?les.
在第?章中,我们将学习Rust的原子类型及其所有操作。我们从简
单的加载和存储操作开始,逐?深入到更高级的比较和交换循环,
通过几个真实世界的用例来探索每个新概念,作为可用的示例。
While memory ordering is relevant for every atomic o?eration, that
to?ic is left for the ne?t cha?ter. This cha?ter only covers situations
where relaxed memory ordering suffices, which is the case more often
than one might e??ect.
尽管内存排序对于每个原子操作都很重要,但这个主题留待下一章
讨论。本章仅涵盖放松内存排序足以满足的情况,这种情况比人们
预期的要多。 内存排序对于每个原子操作都很重要,但这个主题
留待下一章讨论。本章仅涵盖放松内存排序足以满足的情况,这种
情况比人们预期的要多。
Chapter 3 — Memory Ordering
After learning about the various atomic o?erations and how to use them,
the third cha?ter introduces the most com?licated to?ic of the book:
memory ordering.
在学习了各种原子操作及其使用方法之后,第三章介绍了本书最复
杂的主题:内存排序。
We’ll e??lore how the memory model works, what a happens-before
relationship is and how to create them, what all the different memory
orderings mean, and why sequentially consistent ordering might not be
the answer to everything.
我们将探讨内存模型的工作原理,什么是先于关系以及如何创建它
们,不同内存排序的含义,以及为什么顺序一致的排序可能不是万
能的答案。
Chapter 4 — Building Our Own Spin Lock
After learning the theory, we ?ut it to ?ractice in the ne?t three cha?ters
by building our own versions of several common concurrency
?rimitives. The first of these cha?ters is a short one, in which we
im?lement a spin lock.
在学习理论之后,我们在接下来的三章中通过构建自己版本的几个
常见并发原语来将其付?实践。其中第一章是一个简短的章节,我
们在其中实现了自旋锁。
We’ll start with a very minimal version to ?ut release and acquire
memory ordering to ?ractice, and then we’ll e??lore Rust’s conce?t of
safety to turn it into an ergonomic and hard-to-misuse Rust data ty?e.
我们将从一个非常简化的版本开始,以实践发布和获取内存顺序,
然后探索Rust的安全概念,将其转化为一种符合人体工程学且难以
误用的Rust数据类型。
Chapter ? — Building Our Own Channels
In cha?ter five, we’ll im?lement from scratch a handful of variations of
a one-shot channel, a ?rimitive that can be used to send data from one
thread to another.
在第五章,我们将从头开始实现几种一次性通道的变体,这是一种
原始的方法,可用于将数据从一个线程发送到另一个线程。
Starting with a very minimal but entirely unsafe version, we’ll work
our way through several ways to design a safe interface, while
considering design decisions and their conse?uences.
从非常简单但完全不安全的版本开始,我们将通过几种设计安全界
面的方式来逐?考虑设计决策及其后果。
Chapter 6 — Building Our Own “Arc”
For the si?th cha?ter, we’ll take on a more challenging memory
ordering ?u??le. We’re going to im?lement our own version of atomic
reference counting from scratch.
第六章,我们将接受一个更具挑战性的内存排序难题。我们将从头
开始实现自己的原子引用计数版本。
After adding su??ort for weak pointers and o?timi?ing it for
?erformance, our final version will be ?ractically identical to Rust’s
standard std::sync::Arc ty?e.
在添加了对弱指针的支持并对其进行了性能优化后,我们的最终版
本将?Rust标准库中的std::sync::Arc类型几乎相同。
Chapter 7 — Understanding the Processor
The seventh cha?ter is a dee? dive into all the low level details. We’ll
e??lore what ha??ens at the ?rocessor level, what the assembly
instructions behind the atomic o?erations look like on the two most
?o?ular ?rocessor architectures, what caching is and how it affects the
?erformance of our code, and we’ll find out to what remains of the
memory model at the hardware level.
第七章是对所有低级细节的深入探讨。我们将探讨处理器级别发生
的情况,探讨两种最流行的处理器架构中原子操作背后的汇编指令
是什么样子的,探讨缓存是什么以及它如何影响我们代码的性能,
我们将找出硬件级别的内存模型剩余部分。
Chapter ? — Operating System Primitives
In cha?ter eight we acknowledge that there are things we can’t do
without hel? of the o?erating system’s kernel, and learn what
functionality is available on Linu?, macOS, and Windows.
在第八章中,我们承认有些事情我们不能没有操作系统内核的帮助
完成,并学习了Linu?、macOS和Windows上可用的功能。
We’ll discuss the concurrency ?rimitives that are available through
pthreads on POSIX systems, find out what we can do with the Windows
API, and learn what the Linu? futex syscall does.
我们将讨论在POSIX系统上通过?thread可用的并发原语,了解
Windows API可以做什么,以及学习Linu? fute?系统调用的作用。
Chapter 9 — Building Our Own Locks
Using what we’ve learned in the ?revious cha?ters, in cha?ter nine
we’re going to build several im?lementations of a mutex, condition
variable, and reader-writer lock from scratch.
在前几章学到的知识的基础上,第九章我们将从头开始构建几个互
斥锁、条件变量和读写锁的实现。
For each of these, we’ll start with a minimal but com?lete version,
which we’ll then attem?t to o?timi?e in various ways. Using some
sim?le benchmark tests, we’ll find out that our attem?ts at o?timi?ation
don’t always increase ?erformance, while we discuss various design
trade offs.
对于每个项目,我们将从最小但完整的版本开始,然后尝试以各种
方式进行优化。通过一些简单的基准测试,我们会发现我们的优化
尝试并不总是增加性能,同时我们会讨论各种设计权衡。
Chapter 1? — Ideas and Inspiration
The final cha?ter makes sure you don’t fall into a void after finishing
the book, but are instead left with ideas and ins?iration for things to
build and e??lore with your new knowledge and skills, ?erha?s kicking
off an e?citing journey further into the de?ths of low-level concurrency.
最后一章确保您在完成本书后不会陷入虚无之中,而是留下了构建
和探索新知识和技能的想法和灵感,也许会开启一段令人兴奋的旅
程,深入低级并发的深处。

标签: lock rust and pdf ck

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警