文件名称:consumer_producer
介绍说明--下载内容均来自于网络,请自行研究使用
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.)
当生产者任务从数据源—文件中读取数据后将会申请一个缓冲区,并将此数据放缓冲区中。
消费者任务从一个缓冲区中取走数据,并将其中的内容打印输出。
当一个生产者任务正在访问缓冲区时,其他生产者和消费者任务不能访问缓冲区。
当一个消费者任务正在访问缓冲区时,其他其他生产者和消费者任务不能访问缓冲区。
使用互斥量实现对缓冲池的互斥访问。(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.)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
新建文件夹\Consumer_Producer.txt | 2452 | 2020-06-18 |
新建文件夹\content.txt | 8 | 2020-06-19 |
新建文件夹\producer_consumer.c | 2352 | 2020-06-19 |
新建文件夹 | 0 | 2021-01-21 |