91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-01-05
  • 語言: C/C++
  • 標簽: 最佳適應??

資源簡介

操作系統(tǒng)課程設計,采用固定分區(qū),用最佳適應算法實現(xiàn)管理內存分配與回收

資源截圖

代碼片段和文件信息

#include
#include
#define?LEN?sizeof(struct?jcb)
struct?jcb
{
int?num;//分區(qū)序號
int?start;//首地址
int?size;//大小
int?state;//狀態(tài)
int?end;//結束地址
struct?jcb?*next;
};

struct?jcb?*creat(void)
{
struct?jcb?*head;
struct?jcb?*j1*j2*j;
int?end_1;//記錄下一分區(qū)的首地址
j=(struct?jcb*)?malloc(LEN);
int?n=1;
head=NULL;
cout<<“請輸入第“< cin>>j->start?>>j->size?;
j->end?=j->start?+j->size-1?;
while(j->size?!=0)//大小為零則創(chuàng)建分區(qū)表結束
{
end_1=j->end?+1;
if(head==NULL)
{
head=j;j->next?=NULL;j->num?=n;j->state?=0;
}
j=(struct?jcb*)?malloc(LEN);
n++;
cout<<“請輸入第“<????????cin>>j->size?;
if(j->size?==0)break;
????????j->start?=end_1?;
j->end=j->start?+j->size?;
j1?=?head;???
j2=j1->next?;

評論

共有 條評論

相關資源