摘要: 这是一道机试题,大概的预期执行结果如下图所示 最近刚好在学习linux编程,便使用多线程及多进程分别实现了一遍,其中多线程较为简单,使用0/1信号量在线程间实现生产者/消费者即可;多进程则稍微复杂一些,信号量必须设置为进程间通信,且存放在共享内存中,才能被多个进程访问。 多线程的实现代码如下: 多进 阅读全文
posted @ 2019-07-09 17:28 ba哥 阅读(1269) 评论(0) 推荐(0) 编辑
摘要: Introduction to Linux Threads A thread of execution is often regarded as the smallest unit of processing that a scheduler works on. A process can have 阅读全文
posted @ 2019-07-09 17:07 ba哥 阅读(237) 评论(0) 推荐(0) 编辑