容斥原理以及一些题目

什么是容斥原理

容斥原理是一种计数手段。例如在下图中,我们想不重复、不遗漏的求出包含在ABC三个集合中所包含的元素的个数,应该使用怎么样的方法 …

more ...

实现一个无锁消息队列

240414更新:后续补充了一篇勘误文章,见这里

目标

实现一个多读多写的无锁消息队列。

cmpxchg - 比较并替换

比较并替换(compare-and-swap, CAS)是一个用于 …

more ...


Bw-Tree:在新硬件平台上的新B-Tree

ARS 与 Bw-Tree

nosql数据库从本质上说,都属于ARS(Atomic Record Stores,“原子记录存储”)。

最常见的“原子记录存储”一种实现就是朴素的Hash表:通过一个特定的key,来读写一条 …

more ...

Windows Azure Storage Made Simple

加机器就是一把梭

没有什么问题是加一千台机器解决不了的,如果有,就再加一千台。
—— 《21天精通分布式系统》

分布式系统在设计之初,是为了解 …

more ...

STUP - the Implementation (3)

throughput and window size

The wisdom of STUP protocol is all about the window size. The throughput of a TCP communication is limited by two windows: the congestion window and the receive window. The congestion window can determine how many bytes that can be send a simple piece of time …

more ...

STUP - Packet Structure and State Machine (2)

STUP Packet Structure

Brief Introduction of TCP & UDP Packet Structure

STUP pretend itself as a protocol at the Transmission Layer, but actually it's absolutely an Application Layer protocol. So before we start, I'd like to recall some knowledge of two important Transmission Layer protocol: TCP & UDP.

It is well known …

more ...

STUP - another (stupid) TCP over UDP protocol (1)

What is STUP?

STUP is the abbreviation of "Speeded/Secure Tcp-like Udp Protocol", which means that it's another TCP over UDP protocol.

Why TCP over UDP?

TCP is a network protocol for general purpose, and it's one of the most commonly used internet protocol on this planet. It is reliable …

more ...

WorkflowyMd Release Note

What is it?

I've writen several workflowy enhance plugins by UserScript. The very first one is show the full content of the note of a bullet. The second one is to show images under the bullet. Then I worked on the background image to make a more colorful workflowy.

Yeah …

more ...

Parallel patterns in C#

写在前面

与C/C++所使用的,传统的基于线程的并行模式不同,C#实现了丰富的并发编程模型,其中以异步模型最为流行。

本 …

more ...