#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 162
#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 只小白兔&
下载说明:请别用迅雷下载,失败请重下,重下不扣分!
CPU调度算法的仿真项目实现FCFS,SJF,RR算法…
CPU scheduling algorithm simulation project implements FCFS , SJF , RR algorithms
2022-01-26 07:49:23下载
积分:1
小型文件管理系 统
操作系统的课程设计--利用Linux的api设计模拟一个小型的磁盘文件管理系统
2023-04-17 01:50:03下载
积分:1
十大题型算法全实现――(二)可变分区存储管理方案中的内存分配...
十大题型算法全实现――(二)可变分区存储管理方案中的内存分配 -10 types of agrithment implement memory allocate in the variable partion memory management.
2022-03-13 03:28:24下载
积分:1
a complete multi
一个完整的多用户银行家算法-a complete multi-user bankers Algorithm
2022-03-25 06:57:18下载
积分:1
Kernel源代码,号称占有世界处理器操 作 系 统 60%的市场份额!...
T-Kernel源代码,号称占有世界处理器操作系统60%的市场份额!-T-Kernel source code, which claims to hold the operating system world processor market share of 60!
2022-03-30 19:49:34下载
积分:1
可以自学操 作 系 统 全部课程
可以自学操作系统全部课程- May study independently the operating system complete
curriculum
2022-09-26 15:05:03下载
积分:1
新版本发布之为0.6.5.0。它的基础上有点不到100和…
New Kolibri version 0.6.5.0 released. It s based on a bit less than hundred and a half revisions, including many changed and additions for both kernel and applications. Most noticeable is read ability from NTFS partitions, kernel support for programs and drivers packed with KPACK, functions to change cursors from the application side. Desktop picture should now look more attractive since new smoothing algorithm is used.
Talking about programs changing we can mark KFAR (copy files, create folders), FASM (fixes for output generation), TINYPAD (work with mutliple files, change encoding, dynamic memory allocation). Changes have also been made to more than 50 other programs.
2023-05-02 04:55:06下载
积分:1
D:jh哲学家吃饭DINPHIL.rar哲学家吃饭
D:jh哲学家吃饭DINPHIL.rar哲学家吃饭-D : jh philosopher eat DINPHIL.rar philosopher dinner
2023-06-16 13:20:03下载
积分:1
操 作 系 统 的应用。
操作系统的应用。-OS applications.
2022-11-08 04:40:03下载
积分:1
T-Kernel Shell Sample
T-Kernel Shell Sample-T-Kernel Shell Sample
2022-04-30 13:36:50下载
积分:1