资源简介
包含首次适应分配算法,循环适应分配算法,最佳适应分配算法,伙伴系统分配算法,源代码流程图齐全

代码片段和文件信息
#include
#include
#include
using namespace std;
//TEXTLOG为0时不输出记录文件,否则输出记录文件RunlogSM1.txt
#define TEXTLOG 1
struct AREA
{
int startaddress; //分区始址
int size; //分区大小
AREA *next;
};
AREA freehead; //空闲分区链头结点,size记录总空闲分区大小
AREA usehead; //应用分区链头结点,size记录总应用分区大小
char ch;
#if TEXTLOG
FILE *txtlog; //文本文档形式输出日志文件指针
#endif
int Alloc(int applyarea); //主存分配函数
void Combine(AREA *link int startaddress int size); //分区合并函数
bool Recycle(int startaddress int size); //主存回收函数
void Print(); //主存状态打印
bool Check(int x const bool canzero); //输入非负数检查
int main()
{
int size sadd tmp;
bool flag;
AREA *p;
#if TEXTLOG
txtlog = fopen(“RunlogSM1.txt“ “w“);
fprintf(txtlog “##############################################################\n“);
fprintf(txtlog “Memory variable regional management system - first adaptation (FF) algorithm\n“);
fprintf(txtlog “Programmer: Jobs Peng\n“);
fprintf(txtlog “Date: 25 / 5 / 2012\n“);
fprintf(txtlog “Note: The program has no input-error-debugger.\n“);
fprintf(txtlog “##############################################################\n\n“);
#endif
printf(“##############################################################\n“);
printf(“Memory variable regional management system - first adaptation (FF) algorithm\n“);
printf(“Programmer: Jobs Peng\n“);
printf(“Date: 25 / 5 / 2012\n“);
printf(“Note: The program has no input-error-debugger.\n“);
printf(“##############################################################\n\n“);
freehead.next = p = new (AREA);
printf(“How much memory: “);
do
{
scanf(“%d“ &p->size);
} while (!Check(p->size false));
freehead.size = p->size;
usehead.size = 0;
usehead.next = NULL;
p->next = NULL;
printf(“Memroy start address: “);
do
{
scanf(“%d“ &p->startaddress);
} while (!Check(p->startaddress true));
#if TEXTLOG
fprintf(txtlog “How much memory: %d\n“ p->size);
fprintf(txtlog “Memroy start address: %d\n“ p->startaddress);
#endif
printf(“\n\n***** README (Input Format) *****\n“);
printf(“Allocate memory: a XXX (\“XXX\“ replace by size)\n“);
printf(“Recycle memory: r YYY XXX (\“YYY\“ replace by startaddress\“XXX\“ replace by size)\n“);
printf(“Exit system: e\n“);
printf(“\nAttention! If input by any other format the system maybe error or broke.\n“);
printf(“*********************************\n\n“);
flag = true;
while (true)
{
if (flag)
{
Print();
flag = false;
}
printf(“You want (Use format to input): “);
do
{
ch = getchar();
} while (ch == ‘\n‘);
while (ch == ‘ ‘)
{
ch = getchar();
}
switch (ch)
{
case ‘a‘:
scanf(“%d“ &size);
if (!Check(size false))
{
break;
}
printf(“You want to allocate %d units of memory.\n“ size);
#if TEXTLOG
fprintf(txtlog “You want to allocate %d units of memory.\n“ size);
#endif
tmp = Alloc(size
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9515 2012-05-23 00:32 实验3\1空闲分区链-首次适应分配算法.cpp
文件 266351 2012-05-23 00:32 实验3\1空闲分区链-首次适应分配算法(有记录文件输出).exe
文件 10099 2012-05-23 00:33 实验3\2空闲分区链-循环适应分配算法.cpp
文件 266351 2012-05-23 00:33 实验3\2空闲分区链-循环适应分配算法(有记录文件输出).exe
文件 9684 2012-05-23 00:34 实验3\3空闲分区链-最佳适应分配算法.cpp
文件 266351 2012-05-23 00:34 实验3\3空闲分区链-最佳适应分配算法(有记录文件输出).exe
文件 14586 2012-05-23 00:35 实验3\4空闲分区链-伙伴系统分配算法.cpp
文件 270447 2012-05-23 00:35 实验3\4空闲分区链-伙伴系统分配算法(有记录文件输出).exe
文件 0 2013-01-09 17:34 实验3\RunlogSM1.txt
文件 4411 2012-05-23 00:36 实验3\sample RunlogSM1.txt
文件 4837 2012-05-23 00:37 实验3\sample RunlogSM2.txt
文件 4410 2012-05-23 00:37 实验3\sample RunlogSM3.txt
文件 5784 2012-05-23 00:37 实验3\sample RunlogSM4.txt
文件 68096 2010-11-16 22:48 实验3\流程图1.vsd
文件 68096 2010-11-16 22:49 实验3\流程图2.vsd
文件 68096 2010-11-16 22:51 实验3\流程图3.vsd
文件 73728 2010-11-16 23:00 实验3\流程图4.vsd
目录 0 2013-01-09 17:34 实验3
----------- --------- ---------- ----- ----
1410842 18
- 上一篇:meanshift跟踪算法及源码
- 下一篇:thinkcell 注册程序,绝对好用
相关资源
- 升腾Win终端系统升级方法新版.doc
- Uninstall_Cortana_WINCLIENT.CN.rar
- VisualStudioUninstaller vs卸载工具
- 组态王驱动开发包3.0.0.7(中文)
- 多窗口后台鼠标连点器
- 使用选择性重传协议实现UDP可靠通信
- VC 获得文件属性 获取文件的创建时
- STM32基于rt_thread操作系统的SDHC卡文件
- 读者写者问题(读者优先,写者优先
- 用VC 编写的仿QQ聊天室程序源代码
- 外点法程序
- 外罚函数程序
- qt-电子点菜系统
- 操作系统 LRU算法 实验报告 及 程序代
- [免费]车载CE6.0操作系统
- 分页系统模拟实验 操作系统 课程设
- 推箱子及人工智能寻路C 源代码
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- MUSIC算法c 实现
- 模拟段页式虚拟存储管理中地址转换
- C 餐厅叫号系统(QT平)
- 国际象棋c 完整版
-
ob
jectARX给Auto CAD加工具条 - 画图程序MFC/VC/VC CRectTracker 串行化
- MFC网络编程实例
- 操作系统实验——虚存管理实验
- c 课程设计 职工信息管理系统
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
评论
共有 条评论