-
操作系统兔子吃草
#include "stdafx.h"
#include
#include
#include
/*信号量的定义,它是负责协调各个线程, 以保证它们能够正确、合理的使用公共资源。 用于控制进程间的同步与互斥*/
typedef HANDLE Semaphore;
Semaphore g_semBuffer,g_semGlass, g_mutex; //mutex 为互斥锁
// 利用 Windows 下的 API 函数(视窗操作系统应用程序接口)来定义 P、V 操作
#define P(S) WaitForSingleObject(S,INFINITE)
#define V(S) ReleaseSemaphore(S,1,NULL)
#define rate 1000
#define CONSUMER_NUM 4 // 消费者个数
#define PRODUCER_NUM 4 // 生产者个数
#define BUFFER_NUM 4 // 缓冲区个数
char *thing[4]={"glass1","glass2","glass3","glass4"};
//公共的队列缓冲区
struct Buffer
{
int product[BUFFER_NUM];
int front,rear;
}g_buf;
//兔子线程
DWORD WINAPI Rabbit(LPVOID para)
{
int i =*(int*)para; //第 i 只小白兔&
- 2022-05-23 06:18:02下载
- 积分:1
-
模拟操作系统经典生产者和消费者的原理代码
模拟操作系统经典生产者和消费者的原理代码-Simulated operating system, the principle of the classic producer and consumer code
- 2022-06-28 23:18:01下载
- 积分:1
-
文章详细分析了核加内核的源代码,希望对大家的研究和分析
这篇文章详细分析了Nucleus PLUS内核的源码,希望对大家有帮助!-The article detailed analysis of the Nucleus PLUS kernel source code, you want to help!
- 2022-01-26 03:40:01下载
- 积分:1
-
试验目的:通过研究Linux的线程机制和信号量实现生产者消费者问题的并发控制 说明:有界缓冲区内设有20个存储单元,放入/取出的数据项设定为1~20这20个整型...
试验目的:通过研究Linux的线程机制和信号量实现生产者消费者问题的并发控制 说明:有界缓冲区内设有20个存储单元,放入/取出的数据项设定为1~20这20个整型数。 要求: (1)每个生产者和消费者对有界缓冲区进行操作后,即时显示有界缓冲区的全部内容.当前指针位置和生产者/消费者线程的标识符 (2)生产者和消费者各有两个以上 (3)多个生产者或多个消费者之间须共享对缓冲区进行操作的函数代码。-Test Objective : To study the Linux threading mechanism and signal to producers and consumers to achieve the concurrency control : a boundary buffer There are 20 storage units, Add/remove data items for a set of 20 ~ 20-integer. Requirements : (1) Each producer and consumer sector of the buffer zone is operated, immediately after the sector showed a buffer in its entirety. The current position and producer/consumer threads identifier (2) producers and consumers have two or more (3) A number of producers or many consumers to be shared between the right to operate the buffer function code.
- 2023-06-17 09:40:03下载
- 积分:1
-
5,操作系统图形界面银行家算法
5,操作系统图形界面银行家算法-5, the operating system GUI bankers Algorithm
- 2022-02-26 08:59:06下载
- 积分:1
-
An operatin system writin with C ,with read/write support for FAT12 file system
An operatin system writin with C ,with read/write support for FAT12 file system-An operatin system writin with C ,with read/write support for FAT12 file system
- 2022-03-19 07:54:59下载
- 积分:1
-
这个是删除windows无用的零时文件删除windows无用的临时文件
这个是删除windows无用的零时文件删除windows无用的临时文件-this is the deletion of unwanted windows 0:00 a.m. document useless delete windows temporary files
- 2022-02-05 06:21:05下载
- 积分:1
-
操作系统设计与实现源码
操作系统设计与实现源码-Design and Implementation of the operating system source code
- 2022-04-01 01:46:24下载
- 积分:1
-
uCos_II到ARM7的移植,内附详细的PDF说明文档及完整的源代码。
uCos_II到ARM7的移植,内附详细的PDF说明文档及完整的源代码。-uCos_II ARM7 to the transplant, the PDF containing detailed documentation, and complete source code.
- 2022-08-13 06:35:44下载
- 积分:1
-
操作系统读者写者问题源程序代码
操作系统读者写者问题源程序代码-readers to write the operating system source code problem
- 2022-01-26 07:39:45下载
- 积分:1