本文是Jack Fransham的Gist文章原文翻译。英文原文参照在页面中以引用格式展现,方便对照。
本笔记根据以下博客系列文章整理:
- Demystifying memory management in modern programming languages
- Visualizing memory management in JVM(Java, Kotlin, Scala, Groovy, Clojure)
- Visualizing memory management in V8 Engine (JavaScript, NodeJS, Deno, WebAssembly)
- Visualizing memory management in Golang
- Visualizing memory management in Rust
- Avoiding Memory Leaks in NodeJS: Best Practices for Performance
本文翻译自WithoutBoats大神的博客文章:The Waker API I: what does a waker do?。
[TOC]
Work on supporting async/await in Rust continues to progress rapidly. I’m hoping to write a retrospective on everything that happened in 2018 in a few weeks. Right now we’re closing in on an important milestone: stabilizing the futures API that will be used to interact programmatically with asynchronous computations. The biggest remaining area of work is the design of the waker API, an essential but somewhat opaque part of how our asynchronous programming system works. I want to take a look at this API and try to make it a bit clearer, so the design decisions regarding the API become clearer.
本文翻译自WithoutBoat大神的系列博文:The Waker API II: waking across threads.
In the previous post, I provided a lot of background on what the waker API is trying to solve. Toward the end, I touched on one of the tricky problems the waker API has: how do we handle thread safety for the dynamic
Waker
type? In this post, I want to look at that in greater detail: what we’ve been doing so far, and what I think we should do.
在上一篇文章中,作者提供了许多waker API试图解决的问题的背景知识.到了最后,作者提到了在waker API中有一个很棘手的问题:在动态的Waker
类型中如何处理线程安全?在本篇文章中,作者希望深入的讨论这个部分:目前已经做到了哪些,有哪些是作者认为我们应该实现的.
floats allocate bits to three different parts: the sign indicator, s, which says whether a number is positive or negative; characteristic or exponent, e, which is the power of 2; and the fraction, f, which is the coefficient of the exponent.
浮点数的表示分为三个部分:
- 符号位
s
,指示该浮点数为正数还是负数; - 指数位
e
,表示为2为底的幂; - 分数位
f
,表示幂的系数部分;