文件名称: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 |
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.