文档介绍:GDOU-B-11-112
广东海洋大学学生实验报告书(学生用表)
实验名称
存储管理
课程名称
操作系统
课程号
学院(系)
软件学院
专业
软件工程
班级
学生姓名
学号
实验地点
实验日期
一、实验目的
修改MINIX操作系统内存管理的源程序,将MINIX的首次适应算法改为最佳适应和最差适应算法,对修改之后的MINIX源代码进行重新编译和重新启动,以测试你修改的正确性。
实验内容
打开Minix3,
2、修改原算法为最佳适应算法(BEST_FIT)和最差适应算法(WORST_FIT)的程序如下:
#include ""
#include <minix/.h>
#include <minix/>
#include <>
#include <>
#include ""
#include "../../kernel/"
#include "../../kernel/"
#include "../../kernel/"
#define NR_HOLES (2*NR_PROCS) /* max # entries in hole table */
#define NIL_HOLE (struct hole *) 0
PRIVATE struct hole {
struct hole *h_next; /* pointer to next entry on the list */
phys_clicks h_base; /* where does the hole begin? */
phys_clicks h_len; /* how big is the hole? */
} hole[NR_HOLES];
PRIVATE u32_t high_watermark=0;
PRIVATE struct hole *hole_head; /* pointer to first hole */
PRIVATE struct hole *free_slots;/* ptr to list of unused table slots */
#define swap_base ((phys_clicks) -1)
FORWARD _PROTOTYPE( void del_slot, (struct hole *prev_ptr, struct hole *hp) );
FORWARD _PROTOTYPE( void merge, (struct hole *hp) );
#define swap_out() (0)
/*===========================================================================*
* alloc_mem *
*==========================================================