操作系统课程设计实验报告_可变分区存储管理和多级队列调度算法模拟实现

上传人:r****d 文档编号:125324525 上传时间:2022-07-26 格式:DOC 页数:34 大小:292KB
返回 下载 相关 举报
操作系统课程设计实验报告_可变分区存储管理和多级队列调度算法模拟实现_第1页
第1页 / 共34页
操作系统课程设计实验报告_可变分区存储管理和多级队列调度算法模拟实现_第2页
第2页 / 共34页
操作系统课程设计实验报告_可变分区存储管理和多级队列调度算法模拟实现_第3页
第3页 / 共34页
点击查看更多>>
资源描述
First compliance review of the application of the appraisal Committee, only through the compliance review of the application to take part in a detailed review. 8.1 application compliance review: does not meet one of the following conditions, procuratorial Agency to submit application through compliance reviews, be invalidated: (1) application of the formats, contents, meet the requirements of selected files, powers of Attorney, declarations by the legal representative and the tender agent application to meet the requirements; (2) licence and a bidding agent qualifications meet the requirements; (3) the similar project tendering agency agent number and provide proof of material compliance; (4) the tendering Agency intends to put into this project the number of professionals to meet the requirements; (5) are intended to the agent of the project as a project manager has similar projects the number of and references to meet the requirements; (6) no fraud case. 8.2 application review in detail the Evaluation Committee through compliance reviews will be selected for detailed review of the application. 8.2.1 tender agent institutions similar project tender performance requirements (16 points) tender agent institutions similar project tender performance 16 points, by two part composition (1) agent similar project of cumulative bid amount scored calculation rules for: Agent water project bid amount (on January 1, 2007 has has bid notice for associate) cumulative each reached 100 million Yuan have 2 points, water project cumulative bid amount scored up not over 6 points. In addition, completes a bid worth more than 500 million yuan in total 1 minute, but other items score accumulated winning amount up to a maximum of 6 points. (2) calculation rule for the number of agents similar projects: proxy bid amount (since January 1, 2007 winning notice shall prevail) bidding projects in more than 50 million Yuan by 2 points, but the Agency projects the number of scores up to 3 minutes. 8.2.2 to be agents of the construction project as a project manager in the same project performance (10 points) Project Manager agent performance scores including agents of the bidding agencies of similar projects, as well as in other similar project tendering agency service agent during performance. Total 10 Project Manager agent performance, made up of two parts (1) acting like the accumulated winning amount calculation rule: agents for water conservancy project bid amount (since January 1, 2007 winning notice for example) cumulative average reached 100 million Yuan 3 but scored no more than 5 minutes. (2) calculation rule for the number of agents similar projects: proxy bid amount (since January 1, 2007 winning notice for example) in the more than 50 million Yuan water conservancy project period of 3 minutes, but scores the number of agents similar projects up to a maximum of 5 points. Project Manager demonstrated to provincial-level and higher peoples Government or the development and Reform Commission published the winning bidder on the designated media publicity shall prevail. 8.2.3 staff requirement (25 points) 1, to the construction project serving personnel, 4 years experience in tendering agent, 2 points per person, 2 years experience in tendering agent .Pig is not a pig. With domestic international market and technology big environment of changes, as China traditional industry of pig production of job way and profit way are requirements related industry for resources integration, to quality security for premise, regulation based farming, and management cost and the production, and sales cost, go standardization, and scale, and intensive, and market road, fast upgrade whole industry chain of regulation capacity, market competition capacity and anti-risk capacity. First, industry analysis (a) the basic situation in China is a traditional hog production and consumption country, 2008 46.15 million tons of pork, pig stock 462.64 million head by the end pig slaughter 609.6 million. National pig industrys annual production value at around 650 billion yuan, nearly 50% per cent of annual output value of animal husbandry. Sichuan province in 2008 produced 6.52 million tons of pork, with 694,000 tons of Chengdu city, live pig sell 10.46 million, first 15 Vice-provincial cities in the country. The whole nation advantage regional planning (2008-2015) there are 437 counties (cities), 55, Sichuan, Chengdu has 7 (including in pengzhou). International pig industry mainly include the European Union, the United States, and Canada, and Brazil and other absolute scale of animal husbandry industry and technology developed countries. Market 1, the domestic market from Chinas meat consumption habits and economic analysis of the development situation, the emergence of new trends in the market of domestic pork and its products. Docking is a pig production and sales more closely. The Yangtze River Delta, Pearl River Delta and the Bohai rim economic developed area industrial structure adjustment gathered pace, two or three industries to the Central and Western bias. Second, the rigid domestic consumption growth. For a long period, pork is still the largest variety of meat consumption in China, the absolute consumption continues to grow. Especially in the vast rural market growth potential. Third, market for pork and higher product quality requirements. Pollution-free pork safety and health has shown a very good market prospects. Four is the market changing. Currently, cold meat, more and more varieties of meat and pork meat products, which accounted for a large proportion of pork consumption, stores, chain stores, supermarkets and other marketing methods is on the rise, and transport has been extended to more than 2000 km in RADIUS. Chengdu is an important River pig resource market, the citys commercial rate reaches above 60% of live pigs, pork and raw materials primary processing products in the domestic and international reputation is high. Western hog trading center in Chengdu and provides disease-free areas of construction in order to further accelerate the development of swine industry realizes space and conditions. 2, the international markets at present, annual volume of trade in live pigs in the world year around 18 million, about 6 million tons of pork trade. A large net exporter of pork is mainly the EU and North America,-importing countries mainly in Asia, Japan, and Korea, and Singapore, the Philippines, Hong Kong and other countries and regions, as well as Russia, about 3 million tonnes were imported. It is predicted that the world meat consumption increase of 80% in Asia in the future, our country has obvious geographical advantages, export potential. With the advancement of live pigs superiority industry belt construction, animal disease .操作系统课程设计报告姓 名: 学 号: 班 级: 院 系: 日 期: 指导教师: 实验一:可变分区存储管理一、实验要求 设计合理的数据结构来描述存储空间:对于未分配出去的部分,可以用空闲分区队列来描述,对于已经分配出去的部分,由装入内存的作业占据,可以将作业组织成链表或数组。 实现分区存储管理的内存分配功能,要求选择至少两种适应算法(如首次适应算法,最佳适应算法,最后适应算法,最坏适应算法)。 实现分区存储管理的内存回收算法:要求能够正确处理回收分区与空闲分区的四种邻接关系。 当碎片产生时,能够进行碎片的拼接。二、设计目的在掌握了计算机可变分区存储管理方式的原理的基础上,利用C语言在windows操作系统下模拟实现操作系统的可变分区存储管理的功能,以便加深对可变分区存储管理原理的理解,提高根据已有原理通过编程解决操作系统实际问题的能力,另一方面提高根据已有原理通过编程解决实际问题的能力,为进行系统软件开发和针对实际问题提出高效的软件解决方案打下基础。三、各功能模块分析实现需要设计合理的数据结构来描述存储空间,包括:被程序占用的存储空间、空闲的存储空间、多个程序的组织。通常用链表把这些同种类型的存储空间连接起来,使用结构体来描述每个存储空间的属性信息。根据可变分区存储管理的基本原理,程序的实现主要包括以下几个部分:1内存的初始化:包括确定内存的起始地址、内存的大小等。2要进入内存的程序链表的产生:多个要进入内存运行的程序的产生,包括程序编号、所占存储空间的大小。可以把这些内容以记录式文件的形式保存到磁盘上,也可以把他们存放在二维数组中。若保存在文件中,则可以多次使用,如保存在数组中只能使用一次。3为程序分配存储空间: 可以采用首次适应、最佳适应、最后适应算法来实现。主要是按照这三种算法的思想对空闲块进行排序,以便找出符合要求的那个空闲块。对空闲块的排序思路可以使用冒泡排序算法的思想。4记录和显示内存被程序占用的情况5记录和显示内存中空闲块的情况6回收存储空间:程序运行完毕后,要及时回收内存空间。四、主程序流程图创建分区头节点删除上次的结果文件键盘输入字符stepInitializiation字符step为? step=1 step=2 Put job into memory step=6Move fragment together step=3step=4 Finish job step=5 Show current memory used by jobsShow current free liststep=7Exit五丶主要实验代码4.1 application of the Chinese language application for proxy bidding agency application system. 4.2 bidding agent applications should be submitted by the Agency included in the 5th chapter of the content, and than select file asked to provide appropriate documentation. 4.3 proxy application shall affix its official seal coding and page by page in the specified location. Agent a copy of the application shall have to number the pages and signed original copy (copy) (including supporting documents), and copy should be exactly the same. 4.4 application there shall be no loose pages. 4.5 agent application should be complete with indelible ink (powdered) prints, the agent shall not alter any page of the application. 4.6 bidding agencies offer should be based on the interim measures for the management of tendering agents service charges (meter prices 20021980) rules of the Nineth, tender agent service charges using the difference progressive billing rate. Charges in accordance with the tendering agents service charges and, in conjunction with the provisions of the specific circumstances of the project shall not be floating up and down-floating range must not exceed 20%, otherwise the application cannot pass compliance checks, be invalidated. Due to bidding agency selection and principal-agent contracts signed during charging base bid amount has not yet been produced, it can only be according to the rates of price, bid and the bid amount determines after the end, controlled response rates calculated shall pay tender fee (tender agency fee accounts for the actual bidding agent item for fares). Than the selected person tendering agents service charge control the upper and lower limits, Cap for the State Development Planning Commission of the interim measures for the management of tendering agents service charges (meter prices 20021980) of tendering agents service fees under 100%, the lower limit for the State Development Planning Commission of the interim measures for the management of tendering agents service charges (meter prices 20021980) of tendering agents service fees under 80%. Tendering agents service charge base should include the following tenders: construction, supervision and material over the above tenders are expected to be important, with each tendering agency entrusted with tender bid amount as a base for a separate computation of tendering agents service fees. Tendering agents service fee payment in accordance with the General Office of the State development and Reform Commission on tendering agents service charge of notification on the relevant issues (the change price 2003857). Sale of prequalification documents and solicitation documents going to choose all, pricing should be based on the principle of profit not files, must not violate the relevant provisions in the price Department. 4.7 requirements in the form of application proxy application shall be prepared in the 5th chapter of the format. Application of various supporting documents should be requested by the selection of files grouped by order. Comparison and selection of the bidding agencies must provide supporting documents required by the file; the file you selected does not have the required supporting documents, bidding agency acknowledged the need to provide, or you can provide. Proxy application shall be bound, and page-by-page coded in the order. 5th chapter application format notes: bidding agent .void init()/初始化,设置物理内存中用户区的大小,选取适应算法fl = NULL;/将各值复位al = NULL;jl = NULL;userMemory = 0;fitAlgorithm = 0;count = 0;printf(n请设置用户区的大小(整型):);cin userMemory;setFitAlgorithm();fNode * tmp = (fNode *)malloc(sizeof(fNode);tmp-startAddress = 0;tmp-size = userMemory;/初始化时,将整个用户内存划分到一个分区里tmp-last = NULL;tmp-next = NULL;fl = tmp;void setFitAlgorithm()/设置适应算法fitAlgorithm = 0;while(fitAlgorithm 4 | fitAlgorithm fitAlgorithm;doFitAlgorithm();void doFitAlgorithm()/执行适应算法fNode * t = (fNode *)malloc(sizeof(fNode);int tmpStartAddress = 0;int tmpSize = 0;for (fNode * i = fl; i != NULL; i = i-next)t = i;for (fNode * j = i-next; j != NULL; j = j-next)switch(fitAlgorithm)case 1:if (j-size size)/最佳适应算法,找到链表中分区大小最小的分区t = j;break;case 2:if (j-size t-size)/最坏适应算法,找到链表中分区大小最大的分区t = j;break;case 3:if (j-startAddress startAddress)/首次适应算法,找到链表中分区起始地址最小的分区t = j;break;case 4:if (j-startAddress t-startAddress)/最后适应算法,找到链表中分区起始地址最大的分区t = j;break;tmpStartAddress = i-startAddress;/将剩余链中找到的分区交换到剩余链的最前端tmpSize = i-size;i-startAddress = t-startAddress;i-size = t-size;t-startAddress = tmpStartAddress;t-size = tmpSize;void addJob()/添加作业int num = 0;int size = 0;printf(n);printf(请输入要加入的作业的编号(整型):);cin num;printf(请输入要加入的作业的大小(整型):);cin size;count+;jNode * job = (jNode *)malloc(sizeof(jNode);/初始化一个新作业结点job-id = count;job-num = num;job-size = size;job-status = 0;job-last = NULL;job-next = NULL;if (jl = NULL)/将新作业加入作业链表中/若jl链为空,则直接将jl指向该结点jl = job; else/若jl不为空,则将该结点插入jl链的前端job-next = jl;jl-last = job;jl = job;doFitAlgorithm();/在进行内存分配之前需执行适应算法if (allocateMemory(job) = 0)/开始内存分配printf(n没有足够的内存空间分配給该作业!n); elseprintf(n该作业成功得到内存分配!n);int allocateMemory(jNode * tmp)/内存分配int flag = 0;/用于标记新作业是否能被分配,0为不能for (fNode * i = fl; i != NULL; i = i-next)if (i-size = tmp-size)/找到一个符合要求的分区装入作业tmp-status = 1;/更改作业状态为已装入内存aNode * t = (aNode *)malloc(sizeof(aNode);/初始化新加入的已分配分区结点t-jid = tmp-id;t-size = tmp-size;t-startAddress = i-startAddress;t-last = NULL;t-next = NULL;if (al = NULL)/将已分配的分区接入已分配分区链表中/若al链为空,则直接将al指向该结点al = t; else/若al不为空,则将该结点插入al链的前端t-next = al;al-last = t;al = t;if (i-size tmp-size)/若该分区大小大于作业大小,则将剩余大小重新赋给该分区i-startAddress = i-startAddress + tmp-size;i-size = i-size - tmp-size; else/若该分区大小恰好等于作业大小,则从空闲分区链表中删除该分区if (i-last = NULL)fl = i-next; else if (i-next = NULL)i-last-next = NULL; elsei-last-next = i-next;i-next-last = i-last;delete i;flag = 1;break;return flag;void finishJob()/完成作业jNode * job = (jNode *)malloc(sizeof(jNode);int flag = 0;/用于标记该ID是否存在,0为不存在int id = 0;printf(n请输入要完成的作业的ID(整型):);cin id;for (jNode * i = jl; i != NULL; i = i-next)/找出该ID的作业if (i-id = id)job = i;flag = 1;break;if (flag = 0)printf(n该ID不存在!n); elseif (job-last = NULL)/将已完成的作业从作业链表中删除jl = job-next;/若该job为链表头结点,则jl链表直接指向其下一个结点 else if (job-next = NULL)job-last-next = NULL; elsejob-last-next = job-next;job-next-last = job-last;delete job;deallocateMemory(id);/开始内存回收printf(n该作业成功完成!n);void deallocateMemory(int jid)/内存回收aNode * a = (aNode *)malloc(sizeof(aNode);int startAddress;/待合并分区的起始地址int endAddress;for (aNode * i = al; i != NULL; i = i-next)/找到该作业所占的已分配分区if (i-jid = jid)a = i;break;startAddress = a-startAddress;endAddress = startAddress + a-size - 1;if (a-last = NULL)al = a-next; else if (a-next = NULL)a-last-next = NULL; elsea-last-next = a-next;a-next-last = a-last;delete a;mergeMemory(startAddress, endAddress);/传入待合并分区的起始地址void mergeMemory(int startAddress, int endAddress)/合并分区fNode * ls = NULL;fNode * ns = NULL;fNode * t = (fNode *)malloc(sizeof(fNode);t-startAddress = startAddress;t-size = endAddress - startAddress + 1;t-last = NULL;t-next = NULL;for (fNode * i = fl; i != NULL; i = i-next)if (endAddress + 1) = i-startAddress)/查找与其结束地址后相邻的空闲分区ns = i;if (i-startAddress + i-size) = startAddress)/查找与其起始地址前相邻的空闲分区ls = i;if (ls = NULL) & (ns = NULL)/没有相邻的空闲分区可以合并,则单独作为一个分区插入空闲分区链表if (fl = NULL)fl = t;elset-next = fl;fl-last = t;fl = t;if (ls != NULL) & (ns = NULL)/有前一个分区可以与之合并ls-size = ls-size + t-size;if (ls = NULL) & (ns != NULL)/有后一个分区可以与之合并ns-startAddress = t-startAddress;ns-size = ns-size + t-size;if (ls != NULL) & (ns != NULL)/前后两个分区都与之合并if (ns-last = NULL)/若ns为头结点,则fl链表直接指向其下一个结点fl = ns-next; else if (ns-next = NULL)/若ns为尾结点,则直接将该结点删除ns-last-next = NULL; elsens-last-next = ns-next;ns-next-last = ns-last;ls-size = ls-size + t-size + ns-size;delete ns;void defragment()/碎片整理,进行碎片拼接int sum = 0;/记录已分配空间的总大小for (aNode * i = al; i -next != NULL; i = i-next)i-startAddress = i -next -size + i -next-startAddress;/更改已分配分区的起始地址,将这些分区的地址移到内存的低址部分sum = sum + i-size;if (fl != NULL)/fl不为空表示还存在空闲空间,否则不存在空闲空间fl-next = NULL;/将剩余的空闲分区合并为一个分区fl-startAddress = sum;fl-size = userMemory - sum;printf(n碎片拼接完成!n);void reload()/重新装入作业链中未装入内存的作业for (jNode * i = jl; i != NULL; i = i-next)if (i-status = 0)doFitAlgorithm();/在进行内存分配之前需执行适应算法if (allocateMemory(i) = 0)/开始内存分配printf(n没有足够的内存空间分配給 %d号作业!n, i-id); elsei-status = 1;printf(n %d号作业成功得到内存分配!n, i-id);void showFList()/显示当前空闲分区链的信息printf(n);printf(#当前空闲分区链信息#n);printf(#分区起始地址分区大小n);for (fNode * i = fl; i != NULL; i = i-next)printf(#%10d, i-startAddress);printf();printf(|%10d, i-size);printf(n);printf(#n);printf(n);void showAList()/显示当前已分配分区链的信息printf(n);printf(#当前已分配分区链信息#n);printf(#分区起始地址分区大小分区作业号n);for (aNode * i = al; i != NULL; i = i-next)printf(#%10d, i-startAddress);printf();printf(|%10d, i-size);printf();printf(|%10d, i-jid);printf(n);printf(#n);printf(n);void showJList()/显示当前作业链的信息printf(n);printf(#当前作业链信息#
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业管理 > 商业计划


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!