Posted on 2015-06-30 17:18:28 os
Nim语言有很多语言上先进的特性和接近Python的语法,Rust定位成C++的直接竞争者。 但是请认真思考:这两个语言从一出生开始,都没有解决,而且以后也很难解决本世纪软件业的一次重大危机:多核编程危机。 它们的出现就不是冲着解决多核编程问题来的,基因决定了,靠这两门语言解决不了多核编程的问题。
怎么解决多核编程的问题?
屏蔽硬件上的复杂特性,例如缓存、一致性、内存屏障、原子操作,给程序员简单的并发特性,在编程时存在尽量少的心智负担。
GO可以在内存中创建成千上万的协程,并且提供了协程间通信的基础设施,单凭这两点,Nim和Rust都没有做到。
Nim语言目前没有实现自身的汇编器和链接器,Nim代码首先被编译为C代码,再把C代码编译为本地机器码。 Golang自带汇编器和链接器。
Rust官方最初的目标是像Erlang一样可以创建大量的协程,但是这个目标被官方抛弃了,所以Rust里面是并发执行体不是协程,是OS级别的线程。在高并发场景下,1000个OS的线程同时运行效率就变得非常差。或者可以选择异步模型,但是又面临回调地狱,并且要小心同步IO和CPU密集型计算阻塞当前线程。如果使用第三库必须经过改造以适合异步模型。
因为Rust官方明白,实现完整高效的的协程调度,难度很大。这方面Go做的很好,其他静态编译类型的语言都没有超过它。
我们可以说Nim和Rust的定位不同,要解决各自的目标问题。 但是很多人拿Nim和Go对比的时候,根本没有,而且也不敢把这两种语言的特性和Go的核心特性来对比。
多核编程,是目前遇到的问题,而且是难以解决的问题,谁能解决的高效和优雅,谁就能在未来获胜。
许世伟说过,他在C++中实现协程和协程调度,到头来也只是对Golang的拙劣的模仿,我想Rust官方最初的想法也大概如此吧。
而且我相信Ken Thompson和Russ Rox这两位大师的眼界。
知乎上关于Rust高并发框架实现的问题:http://www.zhihu.com/question/30325880
online diflucan diflucan 150 mg capsule how to take diflucan 4 pills how long does it take for diflucan to work for oral thrush
effects of seroquel quetiapine otc drug can you take benadryl with seroquel what are the side effects of quetiapine fumarate?
Seek emergency medical attention or call the Poison Help line at 1-800-222-1222. clomid for men side effects
20 mg nolvadex pct Review question Cochrane authors examined the evidence about aromatase inhibitors AIs for subfertile women with polycystic ovary syndrome PCOS.
fsh normal without clomid ovarian follicles ovulation clomid period one week early on clomid
CG in films show us a new magical world. Have you ever wonder about the real heights of actors who play Hobbits in Lord of the Rings? You can find the answer on celeb height wiki with some clicks.
CG in films show us a new magical world. Have you ever wonder about the real heights of actors who play Hobbits in Lord of the Rings? You can find the answer on celeb height wiki with some clicks.
CG in films show us a new magical world. Have you ever wonder about the real heights of actors who play Hobbits in Lord of the Rings? You can find the answer on celeb height wiki with some clicks.
CG in films show us a new magical world. Have you ever wonder about the real heights of actors who play Hobbits in Lord of the Rings? You can find the answer on celeb height wiki with some clicks.