python - 使用goroutine+channel和java多线程+queue队列的方式开发各有什么优缺点?
巴扎黑
巴扎黑 2017-04-18 10:31:33
0
2
560

我感觉很多项目使用java或者c的多线程库+线程安全的queue数据结构基本上可以实现goroutine+channel开发能达到的需求,所以请问一下为什么说golang更适合并发服务端的开发呢?使用goroutine+channel和java多线程+queue队列的方式开发各有什么优缺点?

巴扎黑
巴扎黑

reply all(2)
刘奇

http://tleyden.github.io/blog...

Goroutine has less overhead than thread and is simpler

伊谢尔伦

Threads need to grab locks, which will waste CPU performance and turn parallelism into serialization. Gorouten uses notifications to send data to a separate thread to make a copy, and then other threads do not need to compete for locks to truly execute in parallel

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!