-
操作系统兔子吃草
#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
-
我是新人,请斑竹多多指教.
我是新人,请斑竹多多指教.-newcomers, fed exhibitions.
- 2022-03-22 08:45:00下载
- 积分:1
-
微软可访问接口
Microsoft accessible接口的delphi实现-Microsoft accessible interface delphi realize
- 2022-01-26 14:34:21下载
- 积分:1
-
mc9328mx1的mem分配原代码,详细的配置
mc9328mx1的mem分配原代码,详细的配置-mc9328mx1 the mem allocation code, detailed configuration
- 2022-07-23 10:00:46下载
- 积分:1
-
国外开发的著名分布式操作系统mach的有关线程文章,很有参考价值...
国外开发的著名分布式操作系统mach的有关线程文章,很有参考价值-developed abroad MACH-distributed operating system threads of the articles of great reference value
- 2022-02-03 15:24:36下载
- 积分:1
-
内存监视
设计一个内存监视器,能实时地显示当前系统中内存的使用情况,包括系统地址空间的布局,物理内存的使用情况;能实时显示某个进程的虚拟地址空间布局和工作集信息等。
- 2023-02-15 17:30:03下载
- 积分:1
-
操作系统SunOS 4.1.3版本的源码,大家看看吧
操作系统SunOS 4.1.3版本的源码,大家看看吧-SunOS 4.1.3 Source Code
- 2022-06-14 15:19:46下载
- 积分:1
-
bankers algorithm used to avoid deadlock
采用银行家算法实现死锁的避免-bankers algorithm used to avoid deadlock
- 2022-03-02 17:02:43下载
- 积分:1
-
C prepared by the bank ATM system. Function well, not the incidental detail writ...
采用C++编写的银行ATM系统。功能不错,不详细介绍了
附带我们自己写的课程设计报告-C prepared by the bank ATM system. Function well, not the incidental detail write our own curriculum design report
- 2022-04-20 16:37:34下载
- 积分:1
-
SourceTo outlined SourceTo is a source code conversion tools. It will require th...
SourceTo概述 SourceTo是一个源代码转换工具。它对于需要将源代码转成其他文本格式(比如HTML,RTF)的人来说将是一个好帮手。如果你有在网站上发表技术文章的习惯,赶快获得一个SourceTo,它将为你的文章增色不少... -SourceTo outlined SourceTo is a source code conversion tools. It will require the source code into the other text format (such as HTML, RTF) who will be a good helper. If you have published on the Web habits of technical articles, as soon as possible was a SourceTo. It will add to the excitement of your many articles ...
- 2022-04-27 23:34:22下载
- 积分:1