golang死循环且不希望被阻塞死循环且不希望被阻塞空的死循环会比较吃 CPU,因为它是一直运行且不会阻塞,而接收 chan 是阻塞的,会让出 CPU 执行时间片。简单验证下,分别按两种方式编写程序,top 看下就能明白了。