Description: 多个生产者多个消费者同步问题——进程调度--操作系统模拟-A number of producers more than consumers synchronization- the process of scheduling- the operating system simulation Platform: |
Size: 800768 |
Author:kp |
Hits:
Description: 用信号量机制实现多个生产者—消费者问题,实现线程间的同步与互斥-Semaphore implementation mechanism with a number of producers- the consumer problem, achieve inter-thread synchronization and mutual exclusion Platform: |
Size: 4096 |
Author:qingangjun |
Hits:
Description: 1、n个缓冲区的缓冲池作为一个临界资源:
当生产者任务从数据源—文件中读取数据后将会申请一个缓冲区,并将此数据放缓冲区中。
消费者任务从一个缓冲区中取走数据,并将其中的内容打印输出。
当一个生产者任务正在访问缓冲区时,其他生产者和消费者任务不能访问缓冲区。
当一个消费者任务正在访问缓冲区时,其他其他生产者和消费者任务不能访问缓冲区。
使用互斥量实现对缓冲池的互斥访问。(1. Buffer pool of N buffers as a critical resource:
When the producer task reads data from the data source file, it will apply for a buffer and put the data in the buffer.
The consumer task takes data from a buffer and prints out the contents.
When a producer task is accessing the buffer, other producer and consumer tasks cannot access it.
When a consumer task is accessing the buffer, other producer and consumer tasks cannot access the buffer.
Mutex is used to access the buffer pool.) Platform: |
Size: 1024 |
Author:muzuokai |
Hits: