Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - INT 1
Search - INT 1 - List
这是一个在TI DSP上用C语言实现的DMA中断程序的试验例程-This is a TI DSP C language DMA interrupt program to the test routines
Date : 2026-01-07 Size : 16kb User : 刘小丽

简单轮转法进程调度 #include "stdio.h" #define getpch(type) (type*)malloc(sizeof(type)) struct pcb { /* 定义进程控制块PCB */ char name[10] char state /*状态 */ int ntime /*需要的运行时间 */ int rtime /*已执行的时间 */ struct pcb* link /*下一个进程控制块的地址 */ }*ready=NULL,*p /*ready为就绪队列,p指向现在操作的进程进行操作*/ -typedef struct pcb PCB
Date : 2026-01-07 Size : 1kb User : 张嘉玲

通过Mutex封装实现的读写锁类。写锁优先于读锁。如果有写锁在等待,则读锁一直等待,直到写锁获取锁,并释放后才能获取。读锁是共享锁,写锁是独占锁。提供Mutex与临界区两种方式可宏切换实现,Mutex为系统内核对象,速度比较慢,但比较好控制。临界区速度快,但无进入临界区无超时时间,对时间控制不精确。 BOOL ReadLock(int timeout=INFINITE) BOOL TryReadLock(int timeout=INFINITE,BOOL bLock=TRUE) BOOL ReadUnLock(int timeout=INFINITE) BOOL WriteLock(int timeout=INFINITE) BOOL TryWriteLock(int timeout=INFINITE,BOOL bLock=TRUE) BOOL WriteUnLock(int timeout=INFINITE) BOOL WriteToRead(int timeout=INFINITE) BOOL ReadToWrite(int timeout=INFINITE) -Achieved through the Mutex package to read and write locks. Priority read lock to write lock. If write lock is waiting, the time lock has to wait until the write lock for the lock, and release to get. Read lock is a shared lock, write lock is an exclusive lock. Mutex and critical section provides two ways to achieve macro switch, Mutex object for the system kernel, the speed is slower, but better control. Speed ​ ​ critical areas, without access to critical areas without timeout, time-control inaccurate. BOOL ReadLock (int timeout = INFINITE) BOOL TryReadLock (int timeout = INFINITE, BOOL bLock = TRUE) BOOL ReadUnLock (int timeout = INFINITE) BOOL WriteLock (int timeout = INFINITE) BOOL TryWriteLock (int timeout = INFINITE, BOOL bLock = TRUE) BOOL WriteUnLock (int timeout = INFINITE) BOOL WriteToRead (int timeout = INFINITE) BOOL ReadToWrite (int timeout = INFINITE)
Date : 2026-01-07 Size : 29kb User : ceofit

自己用的进程心跳状态监测动态库。心跳防护动态库用于实现无人值守的程序的自维护功能,使得被防护程序由于某种异常而导致崩溃时可以自动重新启动,满足无人值守的环境要求。 心跳防护程序的核心是在心脏跳动和心脏恢复两个模块之间创建一个信号量。心脏跳动模块负责给信号量增值,心脏恢复模块负责给信号量减值。-have two func, StartHeartBeat((char* pszProgamName,int nTimeOut) ,StopHeartBeat()
Date : 2026-01-07 Size : 16kb User : wangbo

单处理机系统的进程调度 //用running表示进程处于运行态 #define aready 2 //用aready表示进程处于就绪态 #define blocking 3 //用blocking表示进程处于等待态 #define sometime 5 //用sometime 表示时间片大小 #define n 10 //假定系统允许进程个数为n struct { int name //进程标识符 int status //进程状态 int ax,bx,cx,dx //进程现场信息,通用寄存器内容 int pc //进程现场信息,程序计数器内容 int psw //进程现场信息,程序状态字寄存器内容 int next //下一个进程控制块的位置 }pcbarea[n] //模拟进程控制块区域的数组 int PSW,AX,BX,CX,DX,PC,TIME //模拟寄存器 -//Indicates that the process is running with the running state# define aready 2// by aready means that the process is in the ready state# define blocking 3// by blocking means that the process is in a wait state# define sometime 5// use sometime said time slice size# define n 10// assume that the system allows the process number is n struct {int name // process identifier int status // process status int ax, bx, cx, dx // process the scene information, general register int pc // process the scene information, the program counter int psw // process the scene information, program status word register contents int next // Process Control position next block} pcbarea [n] // int array of analog process control block area PSW, AX, BX, CX, DX, PC, TIME // Analog register
Date : 2026-01-07 Size : 1kb User : 谭柳梅

可运行 #define W 10 //最大进程数W=10 #define R 20 //最大资源总数=20 int AVAILABLE[R] //可利用资源向量 int MAX[W][R] //最大需求矩阵 int ALLOCATION[W][R] //分配矩阵 int NEED[W][R] //需求矩阵 int Request[R] //进程请求向量 -Can run#define W 10 // maximum number of processes W = 10#define R 20 // maximum total resources = 20 int AVAILABLE [R] // resources available vector int MAX [W] [R] // maximum demand Matrix int ALLOCATION [W] [R] // assignment matrix int NEED [W] [R] // demand matrix int Request [R] // Process request vector
Date : 2026-01-07 Size : 91kb User : toy
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.