b*m 发帖数: 34 | 1 问个multi threading code 题,同时请问高手mutil threading 编程有什么好书,网
站和教程推荐?
先问一下下面这个code 题:
写个queue, first in first out
用两个 thread
一个 thread pop head out
一个 thread poush back to tail
这个准确的应该如何写
如果有3 个以上的 thread 比如10 个thread 又应该如何写?
如何优化算法呢?
如果unlimited 个数的 thread 呢?
请问有没有上面这题相关的代码, 网站或者教程推荐呢?
mutil threading 编程讲的比较好有实际code 的又有什么好书,网站和教程推荐?
多谢大家帮忙。 |
m********l 发帖数: 4394 | 2 C#?
use Monitor,
Wait, Pulse
很简单的程序。 我不会写
【在 b*m 的大作中提到】 : 问个multi threading code 题,同时请问高手mutil threading 编程有什么好书,网 : 站和教程推荐? : 先问一下下面这个code 题: : 写个queue, first in first out : 用两个 thread : 一个 thread pop head out : 一个 thread poush back to tail : 这个准确的应该如何写 : 如果有3 个以上的 thread 比如10 个thread 又应该如何写? : 如何优化算法呢?
|
a****n 发帖数: 1887 | 3 加个mutex就行了,要求lock free的话, 参看non-blocking queue |
a**********2 发帖数: 340 | 4 semaphore,多写多读的话再加俩mutex |
j**w 发帖数: 382 | |
P********l 发帖数: 452 | |