“A network of computing and storage resources that enable the delivery of shared applications and data.” (CISCO)
以数据 (存储) 为中心
如何实现高可靠、低延迟的多副本分布式存储和计算系统?
事件驱动 + 高并发:
假设有数千/数万个请求同时到达服务器……
和线程概念相同 (独立堆栈、共享内存)
yield()
主动放弃处理器// 只可能是 1122 或 2211
void T1() { send("1"); send("1"); yield(); }
void T2() { send("2"); send("2"); yield(); }
Go: 小孩子才做选择,多处理器并行和轻量级并发我全都要!
Goroutine: 概念上是线程,实际是线程和协程的混合体
例子
Do not communicate by sharing memory; instead, share memory by communicating. ——Effective Go
共享内存 = 万恶之源
但 UNIX 时代就有一个实现并行的机制了
cat *.txt | wc -l