#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 101
#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 只小白兔&
下载说明:请别用迅雷下载,失败请重下,重下不扣分!
操 作 系 统 中作 业调度程序
操作系统中作业调度程序 -operating system scheduling procedures
2022-08-03 04:57:00下载
积分:1
在控制台下模拟的windows操 作 系 统 下的文件管理系 统 ,包含文件管理的常用功能。...
在控制台下模拟的windows操作系统下的文件管理系统,包含文件管理的常用功能。-In the console under the windows operating system simulation under the document management system, including the commonly used document management functions.
2023-02-04 16:20:03下载
积分:1
simulation file system functions, is a familiar type of document structure
模拟文件系统的功能,是一个熟型的文件结构-simulation file system functions, is a familiar type of document structure
2022-02-25 17:02:24下载
积分:1
a complete OS GUI interface, single
一个完整的GUI界面OS,单盘启动 实现了多线程、FAT32文件读写,GUI图形界面-a complete OS GUI interface, single-disk realized multiple threads, FAT32 file read and write, GUI graphical interface
2023-07-23 07:05:04下载
积分:1
可变分区存储模拟系 统
可变分区存储模拟系统-为课程设计用的。操作系统-Variable partition storage simulation system- used for curriculum design. Operating system
2022-04-11 15:12:10下载
积分:1
操 作 系 统 课程设计中的内存管理源代码
操作系统课程设计中的内存管理源代码和可执行文件,可用于操作系统课程设计,操作系统实验,
有助于进一步学习操作系统和理解操作系统。
操作系统中存储管理的功能:
1、地址映射(逻辑地址——>主存物理地址)
由操作系统中的装入程序loader来完成(静态或动态)。
请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报
2022-05-15 17:49:33下载
积分:1
I2C testing sample code
I2C测试示例代码
2023-05-05 18:35:04下载
积分:1
此书是关于solaris操 作 系 统 的参考手册,主要介绍了solaris操 作 的一些基本命令和函数...
此书是关于solaris操作系统的参考手册,主要介绍了solaris操作的一些基本命令和函数-This book is a reference manual on the solaris operating system, introduces some basic commands solaris operations and functions
2022-04-18 05:13:19下载
积分:1
Microsoft MS
Microsoft MS-DOS6.0 完整源代码,包括了所有外部命令,安装程序,DOSSHELL等。
每个源文件均包括开发历史、更新说明、注释。
这样一套源码对你的意义,实在无法以笔墨形容。-Microsoft MS-DOS6.0 complete source code, including all the external command, installation procedures, DOSSHELL such. Each source documents including the development of history, updated illustrations, notes. Such a source of your meaning, it is impossible to describe with pen and ink.
2022-09-02 10:55:09下载
积分:1
minix203 source operating system
minix203操作系统的源码-minix203 source operating system
2022-06-18 17:56:35下载
积分:1