当前位置: 首页 > news >正文

深圳做网站推广嵩明建设局网站

深圳做网站推广,嵩明建设局网站,网站建设需求调研表模板,网站优化排名方法一、实验目的#xff1a; 实验目的#xff1a; 通过编写一个内存分配模拟程序#xff0c;实现首次适应算法#xff08;First Fit#xff09;、循环首次适应算法#xff08;Next Fit#xff09;、最佳适应算法#xff08;Best Fit#xff09;和最差适应算法#xff08…  一、实验目的 实验目的 通过编写一个内存分配模拟程序实现首次适应算法First Fit、循环首次适应算法Next Fit、最佳适应算法Best Fit和最差适应算法Worst Fit对比这些算法在内存管理中的性能表现加深对内存分配策略的理解。   实验设备与实验环境 计算机,Java编译系统,idea,ChatGPT   二、实验程序设计内容 实现一个MemoryAllocation类包含首次适应算法firstFit()、循环首次适应算法nextFit()、最佳适应算法bestFit()和最差适应算法worstFit()方法以及打印内存状态的方法printMemory()。在Main类中初始化一个内存空间并通过MemoryAllocation类模拟不同的内存分配算法输出内存分配结果以及每种算法的性能表现。通过比较不同算法的内存分配效果总结各算法在实际应用中的优缺点加深对内存管理策略的理解。三、实验程序设计思路及流程图 在MemoryAllocation类中实现首次适应算法、循环首次适应算法、最佳适应算法和最差适应算法的具体逻辑。在Main类中初始化内存空间并调用MemoryAllocation类中的不同算法方法观察内存分配情况并输出各算法的性能表现。根据实验结果分析不同算法的优缺点理解各算法在不同场景下的适用性和性能表现。  四、实验源程序及注释 package homework.os;/*** Date2024/5/25  22:14* Descriptionmem allocation** author Leon* version 1.0*/class MemoryAllocation {private int[] memory;public MemoryAllocation(int memorySize) {memory new int[memorySize];}public int firstFit(int processSize) {for (int i 0; i memory.length; i) {int count 0;int startIndex -1;if (memory[i] 0) {startIndex i;while (i memory.length memory[i] 0 count processSize) {count;i;}if (count processSize) {for (int j startIndex; j startIndex processSize; j) {memory[j] 1;}return startIndex;}}}return -1;}public int nextFit(int processSize) {int startIndex 0;for (int i 0; i memory.length; i) {if (memory[i] 0) {if (i - startIndex processSize) {for (int j startIndex; j startIndex processSize; j) {memory[j] 1;}return startIndex;}} else {startIndex i 1;}}return -1;}public int bestFit(int processSize) {int bestFitIndex -1;int minHoleSize Integer.MAX_VALUE;int currentHoleSize 0;for (int i 0; i memory.length; i) {if (memory[i] 0) {currentHoleSize;} else {if (currentHoleSize processSize currentHoleSize minHoleSize) {bestFitIndex i - currentHoleSize;minHoleSize currentHoleSize;}currentHoleSize 0;}}if (currentHoleSize processSize currentHoleSize minHoleSize) {bestFitIndex memory.length - currentHoleSize;}if (bestFitIndex -1) {return -1;}for (int i bestFitIndex; i bestFitIndex processSize; i) {memory[i] 1;}return bestFitIndex;}public int worstFit(int processSize) {int worstFitIndex -1;int maxHoleSize 0;int currentHoleSize 0;for (int i 0; i memory.length; i) {if (memory[i] 0) {currentHoleSize;} else {if (currentHoleSize maxHoleSize) {maxHoleSize currentHoleSize;worstFitIndex i - currentHoleSize;}currentHoleSize 0;}}if (currentHoleSize maxHoleSize) {maxHoleSize currentHoleSize;worstFitIndex memory.length - currentHoleSize;}if (worstFitIndex -1) {return -1;}for (int i worstFitIndex; i worstFitIndex processSize; i) {memory[i] 1;}return worstFitIndex;}public void printMemory() {for (int cell : memory) {System.out.print(cell );}System.out.println();} }public class exm7_MemoryAllocation {public static void main(String[] args) {MemoryAllocation memoryAllocation new MemoryAllocation(20);System.out.println(First Fit:);System.out.println(memoryAllocation.firstFit(3));memoryAllocation.printMemory();System.out.println(Next Fit:);System.out.println(memoryAllocation.nextFit(4));memoryAllocation.printMemory();System.out.println(Best Fit:);System.out.println(memoryAllocation.bestFit(5));memoryAllocation.printMemory();System.out.println(Worst Fit:);System.out.println(memoryAllocation.worstFit(2));memoryAllocation.printMemory();} }   五、实验程序测试过程及解释说明 调用Main方法分别对四个内存分配算法进行调试   六、实验程序测试过程与结果分析、 First Fit: 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Next Fit: 3 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 Best Fit: 7 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 Worst Fit: 12 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0   Process finished with exit code 0   七、理论学习与实践能力锻炼方面的个人心得体会 通过本次实验我深入了解了首次适应算法、循环首次适应算法、最佳适应算法和最差适应算法在内存分配中的应用和性能特点。观察实验结果可以发现不同算法在内存分配中的表现有所差异例如最佳适应算法可以更好地利用碎片空间而最差适应算法可能造成更多的碎片等。通过比较不同算法的表现我对内存管理中不同的分配策略有了更深入的理解为进一步学习和研究操作系统提供了有益的参考。                      实验评价及结论   实验目的明确、设计内容符合要求独立完成了操作系统存储器管理的内存分配算法程序设计任务且源程序与注释、测试过程记录完整正确能够很好地将课程理论运用于解决实际问题实验报告内容完整态度认真总体质量优秀。       实验指导老师签字                                   2024年    月    日
http://www.hkea.cn/news/14327510/

相关文章:

  • 郑州网站建设郑州扬州网站建设小程序
  • 口碑好的常州做网站专业网站建设推荐
  • 网站快速建站线上推广团队
  • 做电商网站公司网站最新一次改版时间什么意思
  • 怎么用群晖nas做网站wordpress发布外网访问
  • 南昌智能建站模板网站建设jiage
  • 网站建设论文百度云盘广告推广网站怎么做
  • 下载中心官方网站建设银行河间市网站建设价格
  • 山西省城乡建设厅网站wordpress编辑器推荐
  • 做网站公司商丘代运营套餐价格表
  • 太原网站建设推广公司推荐黄冈智能网站建设平台
  • 合肥的网站建设公司哪家好沈阳网站制作 房小二网
  • 做flash网站框架引擎公司网站开发比选
  • 广州外贸建站手机网站 兼容
  • 一级a做爰片软件网站沈阳好的男科医院是哪一家
  • 温州建设诚信网站制作好的网页
  • 遵义网站制作和推广外贸产品销量排名
  • 家具网站asp小门户网站模版
  • 手机免费网站制作 seo won
  • 做网站的抬头标语怎么沈阳网站制作方法
  • 南宁网站开发软件怎么把网站放到空间
  • 网站设计工资怎么样公司网站兰州建设需要多少钱
  • 微信做模板下载网站买服饰网站建设
  • 门头沟富阳网站建设遵义网站开发公司
  • 网站怎么做免费seo搜索ios中国地图行政区划图sdk
  • 西安必途网站建设培训中心电子网站建设前台设计
  • 织梦网站主页hdmi高清wifi无线传输器
  • 京东网站推广方式wordpress调用错误模板的原因
  • 恩施哪里有做网站的网络推广优化能有排名吗
  • 黄岛网站建设价格有哪些游戏可以做网站