-
操作系统兔子吃草
#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
-
请求页式管理中的置换算法
假设有一个用户进程P的地址空间为n(n=60)页,系统已在内存中给该进程分配有m(m
- 2023-01-30 14:15:04下载
- 积分:1
-
操作系统内存管理模拟实验源代码
操作系统内存管理模拟实验源代码-operating system memory management simulation source code---------------------
- 2023-04-07 03:25:03下载
- 积分:1
-
银行家算法 已分配和可利用的 利用银行家算法可以避免死锁的发生...
银行家算法 已分配和可利用的 利用银行家算法可以避免死锁的发生-Banker" s algorithm has been allocated and the use of banker" s algorithm can be used to avoid the occurrence of deadlock
- 2023-01-11 21:50:04下载
- 积分:1
-
北航操作系统课程设计所需源代码,包含window和linux操作系统的各4个试验...
北航操作系统课程设计所需源代码,包含window和linux操作系统的各4个试验-BUAA operating system source code required for curriculum design, including window and linux operating system in all four test
- 2022-06-19 09:38:16下载
- 积分:1
-
一本关于windows mobile操作系统的开发手册,是从事基于windows mobile手机软件开发者的必备参考资料。...
一本关于windows mobile操作系统的开发手册,是从事基于windows mobile手机软件开发者的必备参考资料。-A book on the windows mobile operating system, development of manuals, is engaged in software development based on windows mobile phones are an essential reference.
- 2022-12-16 02:05:03下载
- 积分:1
-
广东工业大学洪凌郁操作系统的课程设计:包括进程调度…
广东工业大学 洪凌郁 操作系统的课程设计:包括进程管理,作业调度,存储管理,和磁盘调度!有问题可以E-mail联系我!-guangdong industry university honglinyu OS cource project: include process schedule, job schedule, memory management, disk schedule. Any question, please email to the writer.
- 2022-04-15 05:04:57下载
- 积分:1
-
总线驱动程序代码。
can bus driver code.
- 2022-03-06 05:53:23下载
- 积分:1
-
Nucleus Plus 源码在PowerPC上的移植8245
Nucleus Plus 源码在PowerPC上的移植8245-Nucleus Plus Code For PowerPC 8245
- 2022-02-04 03:17:03下载
- 积分:1
-
读取配置文件(ini格式)的程序,可返回int,char*,float类型等的配置项数值。...
读取配置文件(ini格式)的程序,可返回int,char*,float类型等的配置项数值。-Read configuration file (ini format) procedures can return int, char*, float type of configuration item values.
- 2023-05-21 04:40:04下载
- 积分:1