Skip to content

Instantly share code, notes, and snippets.

@wangyingsm
wangyingsm / IEEE754.md
Created May 20, 2022 18:45
讲得很明白的IEEE754浮点数标准

IEEE 754浮点数表示

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,表示幂的系数部分;
@wangyingsm
wangyingsm / zanzibar.md
Created March 31, 2022 07:40
Google Zanzibar论文笔记

Zanzibar 论文笔记

概述

  • 在线应用都需要对用户是否有权限对某个数字对象进行操作实现权限检查和控制。例如云照片应用可以允许用户共享部分照片给好友,但是同时保持部分照片是私密的。此处有权限控制的三要素:
    • 用户,或者称为操作者
    • 权限,或者称为动作
    • 对象,或者称为被操作者
  • 通常这些权限管理都由应用本身实现,Zanzibar提供了另外一种方式,实现了中心化的权限管理,你也可以理解为Zanzibar是谷歌所有在线服务的权限管理中心。
  • 这种中心化的权限管理方式,比起由应用自身各自实现的方式,有以下的优点:
@wangyingsm
wangyingsm / waker-II.md
Created September 29, 2021 06:41
Waker API: 第二部分

The Waker API II: waking across threads

Waker API第二部分:跨线程等待

本文翻译自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类型中如何处理线程安全?在本篇文章中,作者希望深入的讨论这个部分:目前已经做到了哪些,有哪些是作者认为我们应该实现的.

@wangyingsm
wangyingsm / waker-I.md
Created September 28, 2021 09:29
Waker API: 第一部分

The Waker API I: what does a waker do?

Waker API 第一部分:waker是干什么的?

本文翻译自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.

@wangyingsm
wangyingsm / Go lang新手经常犯的50个错误.md
Created April 8, 2021 07:47
Go lang新手经常犯的50个错误

Go lang新手经常犯的50个错误

概述

Go是一门简单而有趣的语言,但是,类似任何其他语言,它也有一些坑。这些坑不完全是Go语言本身的错,有些坑是当你从其他语言转来的时候很自然会踩的,其他一些则是由于错误的预设条件和细节的缺失造成的。

很多这些坑当你花了时间去学习语言,阅读官方文档,查看wiki,参与邮件组讨论,细读Rob Pike帖子和演示,阅读源码之后都会变得很显而易见。但并非每个人都遵循同样的路线学习,这没问题。如果你是一个Go的新手,这篇文档将会节省你debug代码的许多时间。

目录