⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 allocate.h

📁 按序分配策略实现资源分配
💻 H
字号:
#include "pcb.h" 
int allocate(int size)
{
   int i;
   int t=0;//用做标志作为返回条件 
   for(i=0;i<6;i++)
    if(empty[i].state==0&&empty[i].size>size)
	{
		empty[i].add_begin+=size;
		empty[i].size-=size;
		t=1;
		return empty[i].add_begin-size;//返回作业的起始地址 
	}
	else
	if(empty[i].state==0&&empty[i].size==size)
	{
		empty[i].state=1;
		t=1;
		return empty[i].add_begin;//返回作业的起始地址 
	}
	if(t==0)
		return 0;
	return 1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -