#include
#include
/*信号量的定义-操作系统兔子吃草-操作系统 - IMDN开发者社群-imdn.cn" />
#include#include/*信号量的定义,它是负责协调各个线程,以保证它们能够正确、合理的使用公共资源。用于控制进程间的同步与互斥*/ typedefHANDLESemaphore; Semaphoreg_semBuffer,g_semGlass,g_mutex;//mutex为互斥锁 //利用Windows下的API函数(视窗操作系统应用程序接口)来定义P、V操作 #defineP(S)WaitForSingleObject(S,INFINITE)#defineV(S)ReleaseSemaphore(S,1,NULL)#definerate1000 #defineCONSUMER_NUM4//消费者个数#definePRODUCER_NUM4//生产者个数#defineBUFFER_NUM4//缓冲区个数 char*thing[4]={"glass1","glass2","glass3","glass4"};//公共的队列缓冲区 structBuffer{ intproduct[BUFFER_NUM]; intfront,rear; }g_buf;//兔子线程DWORDWINAPIRabbit(LPVOIDpara) { inti=*(int*)para;//第i只小白兔&-IMDN开发者社群-imdn.cn">
#include#include/*信号量的定义,它是负责协调各个线程,以保证它们能够正确、合理的使用公共资源。用于控制进程间的同步与互斥*/ typedefHANDLESemaphore; Semaphoreg_semBuffer,g_semGlass,g_mutex;//mutex为互斥锁 //利用Windows下的API函数(视窗操作系统应用程序接口)来定义P、V操作 #defineP(S)WaitForSingleObject(S,INFINITE)#defineV(S)ReleaseSemaphore(S,1,NULL)#definerate1000 #defineCONSUMER_NUM4//消费者个数#definePRODUCER_NUM4//生产者个数#defineBUFFER_NUM4//缓冲区个数 char*thing[4]={"glass1","glass2","glass3","glass4"};//公共的队列缓冲区 structBuffer{ intproduct[BUFFER_NUM]; intfront,rear; }g_buf;//兔子线程DWORDWINAPIRabbit(LPVOIDpara) { inti=*(int*)para;//第i只小白兔& - IMDN开发者社群-imdn.cn">
于 2022-05-23 发布
文件大小:1.15 MB
0 178
#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-10-05 14:05:04下载
积分:1
if you put Implementation of LwIP transplant without operating system platform,...
如果你把LwIP移植到无操作系统的平台,写应用程序参考这个就行了。-if you put Implementation of LwIP transplant without operating system platform, application procedures, write this way.
2022-11-11 19:15:04下载
积分:1
Unix操 作 系 统 minix 2.0源码
Unix操作系统minix 2.0源码-Minix 2.0 source Unix operating system
2022-06-03 14:31:41下载
积分:1
vb做的银行家算法
vb做的银行家算法 -vb do bankers algorithm
2022-01-25 20:05:45下载
积分:1
操 作 系 统 课程设计
模拟unix文件系 统
心血
操作系统课程设计
模拟unix文件系统
心血-Simulation of operating systems curriculum design efforts unix file system
2022-10-02 12:00:05下载
积分:1
操 作 系 统 实验:用信号量解决producer & consumer问题。
包括:
WIN ProCon(1).cpp
WIN ProCon(2).cp...
操作系统实验:用信号量解决producer & consumer问题。
包括:
WIN ProCon(1).cpp
WIN ProCon(2).cpp
LINUX ProCon.c-Operating System Experiment: Using Semaphores solve the producer & consumer issues. Include: WIN ProCon (1). Cpp WIN ProCon (2). Cpp LINUX ProCon.c
2022-04-12 20:36:01下载
积分:1
Bochs is a highly portable open source IA
Bochs is a highly portable open source IA-32 (x86) PC emulator
written in C++, that runs on most popular platforms. It includes
emulation of the Intel x86 CPU, common I/O devices, and a custom
BIOS. Currently, Bochs can be compiled to emulate a 386, 486,
Pentium, Pentium Pro or AMD64 CPU, including optional MMX, SSE,
SSE2 and 3DNow! instructions. Bochs is capable of running most
Operating Systems inside the emulation including Linux, DOS,
Windows 95/98 and Windows NT/2000.
Bochs was written by Kevin Lawton and is currently maintained by
the Bochs project at "http://bochs.sourceforge.net".
2022-02-03 13:51:22下载
积分:1
操 作 系 统 中关于version项目
操作系统中关于version项目-version of the operating system project
2022-07-26 20:39:58下载
积分:1
This is a banker algorithm performance of a procedure
这是银行家算法表现的一个程序-This is a banker algorithm performance of a procedure
2022-02-03 23:10:12下载
积分:1
Windows1.0 【1985年珍藏版】
Windows1.0 【1985年珍藏版】-Windows1.0 1985 01/23/2006 :
2022-01-22 01:55:39下载
积分:1