bsize = scanner.nextInt(); if(bsize >= leavesCount - i){ System.out.print(\您输入的数据无法保证每分区块最少有1单位内存,请重新输入:\ } } insertFBlock(bsize); leavesCount -= bsize; System.out.println(\余下内存大小为\,请继续分bsize = scanner.nextInt(); 配!\ } } } System.out.println(\分配完毕!\System.out.println(\创建空闲分区表如下----------\System.out.println(\分区号\\t大小\FreeBlock temp = head.next; for(int i=1; i <= fblockNum; i++){ } System.out.println(\temp = temp.next; 测试类(主类): package com.kaiping.memorymanage; import java.util.Scanner; public class TestForMemManage { public static void main(String[] args) { MemoryManager mem_manage = new MemoryManager(); int choice=0; Scanner scanner=new Scanner(System.in); do{ System.out.println(\退出程序\System.out.println(\添加新作业\ } } System.out.println(\销毁一条作业\System.out.println(\显示作业信息\System.out.println(\显示空闲分区信息\System.out.print(\请输入您的选择:\choice = scanner.nextInt(); switch(choice){ case 0: } break; mem_manage.addJob(); break; mem_manage.delJob(); break; mem_manage.printJobInfo(); break; mem_manage.printFreeSubareaInfo(); break; System.out.println(\请输入正确的选择!\ case 1: case 2: case 3: case 4: default: }while(choice != 0); System.out.println(); System.out.println(\使用愉快!期待您下次使用!\五、实验测试结果及心得体会 1、测试结果 本人主要测试内存的分配与回收以及无足够大的空闲分区块时进行的重定向操作等功能。 初始化内存分区: 添加作业,分配内存: 打印分区信息: 添加大作业,无足够大的空闲分区块,重定向: 2、实验心得 通过本次实验,我掌握为实现多道程序并发执行,操作系统是如何通过作业调度选择作业进入内存以及系统是如何为进入内存的作业分配内存空间,实现多道作业同时驻留内存,就绪进程队列中的多个进程是如何以分式方式共享CPU,作业运行完成离开系统时,系统如何进行内存回收。
操作系统内存分配算法模拟实现(3)
2025-06-23
操作系统内存分配算法模拟实现(3).doc
将本文的Word文档下载到电脑
下载失败或者文档不完整,请联系客服人员解决!