欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    操作系统实验 第四讲 物理存储器与进程逻辑地址空间的管理(21页).doc

    • 资源ID:36340020       资源大小:668KB        全文页数:21页
    • 资源格式: DOC        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    操作系统实验 第四讲 物理存储器与进程逻辑地址空间的管理(21页).doc

    -操作系统实 验 报 告课程名称操作系统实验实验项目名称物理存储器与进程逻辑地址空间的管理学号班级20120616姓名专业计算机科学与技术学生所在学院计算机科学与技术学院指导教师初妍实验室名称地点21#428 哈尔滨工程大学计算机科学与技术学院一、实验概述1. 实验名称物理存储器与进程逻辑地址空间的管理2. 实验目的通过查看物理存储器的使用情况,并练习分配和回收物理内存,从而掌握物理存储器的管理方法。通过查看进程逻辑地址空间的使用情况,并练习分配和回收虚拟内存, 从而掌握进程逻辑地址空间的管理方法。3. 实验类型验证+设计4. 实验内容3.1 准备实验3.2 阅读控制台命令“pm”相关的源代码,并查看其执行的结果3.3 分配物理页和释放物理页3.4 阅读控制台命令“vm”相关的源代码,并查看其执行的结果3.5 在系统进程中分配虚拟页和释放虚拟页3.6 在应用程序进程中分配虚拟页和释放虚拟页3.6.1 要求3.6.2 测试方法3.6.3 提示二、实验环境操作系统 windos xp编译器 OS Lab语言 c语言三、实验过程1. 设计思路和流程图MiAllocateAnyPages函数的流程图 MiFreePages函数的流程图2. 需要解决的问题及解答(1)在实验指导的P160-4.和5.按F10单步调试MmAllocateVirtualMemory函数的执行过程,要求给出监视窗口BaseAddress和RegionSize个变量前后变化截图界面。截图见3.5。在实验指导的P160-1.和2. 按F10单步调试MmFreeVirtualMemory函数的执行过程,要求给出监视窗口BaseAddress和RegionSize个变量前后变化截图界面。 截图见3.5。(2)按照实验指导的P160-3.6 在应用程序进程中分配虚拟页和释放虚拟页,编写代码。要求至少给出源代码及其解释。程序见3.6.2。 (3)按F10单步调试MiAllocateAnyPages函数的执行过程,尝试回答下面的问题:本次分配的物理页的数量是多少?分配的物理页的页框号是多少?物理页是从空闲页链表中分配的?还是从零页链表中分配的?哪一行语句减少了空闲页的数量?哪一行语句将刚刚分配的物理页由空闲状态修改为忙状态?答:本次分配的物理页的数量是1,分配的物理页的页框号是0x409;物理页是从空闲页链表中分配的第226行MiFreePageListHead=MiGetPfnDatabaseEntry(Pfn)->Next;和第227行MiFreePageCount-;减少了空闲页的数量,第229行将刚刚分配的物理页由空闲状态修改为忙状态;(4)按F10单步调试MiFreePages函数的执行过程,尝试回答下面的问题:本次释放的物理页的数量是多少?释放的物理页的页框号是多少?释放的物理页是之前分配的物理页吗?释放的物理页是被放入了空闲页链表中?还是零页链表中?绘制MiFreePages函数的流程图。答:本次释放的物理页的数量是1,释放的物理页的页框号0x409,释放的物理页是之前分配的物理页;释放的物理页被放入了空闲页链表中;见实验过程开头流程图部分。(5)按F10单步调试MmAllocateVirtualMemory函数的执行过程,尝试回答下面的问题:分配的虚拟页的起始地址是多少?分配的虚拟页的数量是多少?它们和参数BaseAddress和RegionSize初始化的值有什么样的关系?分配虚拟页的同时有为虚拟页映射实际的物理页吗?这是由哪个参数决定的?分配的虚拟页是在系统地址空间(高2G)还是在用户地址空间(低2G)?这是由哪个参数决定的?参考MiReserveAddressRegion函数的定义和注释,说明该函数的功能。答:分配的虚拟页的起始地址是0xa0003000,分配的虚拟页的数量是1,BaseAddress和RegionSize初始化的值是期望保留或者提交的地址区域的起始地址和大小;分配虚拟页的同时有为虚拟页映射实际的物理页,这是由第三个参数AllocationType决定的;分配的虚拟页是在系统地址空间(高2G),这是由第四个参数SystemVirtual决定的;MiReserveAddressRegion函数的功能是保留一段虚拟地址区域。(6)按F10单步调试MmFreeVirtualMemory函数的执行过程,尝试回答下面的问题:本次释放的虚拟地址是多少?释放的虚拟页是之前分配的虚拟页吗?参考MiFindReservedAddressRegion函数、MiFreeAddressRegion函数和MiDecommitPages函数的定义和注释,说明这些函数的功能。答:本次释放的虚拟地址是0xa0003000,是之前分配的虚拟页;MiFindReservedAddressRegion函数用于查找已保留地址区域,如果目标区域非已保留区域则返回失败,MiFreeAddressRegion函数用于释放已保留地址区域和MiDecommitPages函数用于释放映射在连续虚拟页框上的物理页框。(7)在本实验3.3中,如果分配了物理页后,没有回收,会对EOS操作系统造成什么样的影响?目前EOS操作系统内核函数MiAllocateAnyPages能处理所有物理页被分配完毕的情况吗?例如在没有可分配的物理页的情况下调用该内核函数,是否会返回失败?如果内核函数MiAllocateAnyPages还不能处理这种极端情况,尝试修改代码解决这个问题。答:如果分配了物理页后,没有回收,将会使可分配自由页和零页越来越少,最终导致内存溢出,系统无法运行。目前EOS操作系统内核函数MiAllocateAnyPages不能处理所有物理页被分配完毕的情况,在没有可分配的物理页的情况下,不会分配物理页,但仍然会返回成功,添加以下代码即可:Elsereturn STATUS_MEMORY_NOT_ALLOCATED;(8) 在本实验 3.3 中,在分配物理页时是调用的内核函数 MiAllocateAnyPages,该函数会优先分配空闲页,尝试修改代码,调用内核函数MiAllocateZeroedPages优先分配零页,并调试分配零页的情况。尝试从性能的角 7 度分析内核函数 MiAllocateAnyPages 和 MiAllocateZeroedPages。尝试从安全性的角度分析分配零页的必要性。 答:将MiAllocateAnyPages(1, PfnArray);修改为MiAllocateZeroedPages(1, PfnArray);即可。系统启动时,所有空闲物理页都是未初始化的,此时零页链表为空,MiAllocateAnyPages函数可以直接从自由页链表分配,而MiAllocateZeroedPages函数会对从自由页链表中分配的每一页进行零初始化,确保所有分配页都是被零初始化的,再进行分配,因此MiAllocateZeroedPages函数效率较低。但因为MiAllocateZeroedPages函数对自由页进行了初始化,减小了出错的可能性,从而安全性较高。3.主要数据结构、实现代码及其说明typedef struct _MMPFN     ULONG Unused : 9;   / 未用   ULONG PageState : 3;  / 物理页的状态   ULONG Next : 20;   / 下一个物理页的页框号  MMPFN, *PMMPFN;   typedef enum _PAGE_STATE    ZEROED_PAGE,  / 零页   FREE_PAGE,   / 自由页   BUSY_PAGE,   / 占用页   PAGE_STATE;   / 虚拟地址描述符 typedef struct _MMVAD  ULONG_PTR StartingVpn;   / 被使用区域的开始虚页框号    ULONG_PTR EndVpn;     / 被使用区域的结束虚页框号   LIST_ENTRY VadListEntry;  / 链表项,用于将描述同一地址空间的所有VAD串/成链表  MMVAD, *PMMVAD; / 虚拟地址表 typedef struct _MMVAD_LIST  ULONG_PTR StartingVpn;     / 记录的进程地址空间的开始虚页号  ULONG_PTR EndVpn;    / 记录的进程地址空间的结束虚页号  LIST_ENTRY VadListHead;    / VAD链表头  MMVAD_LIST, *PMMVAD_LIST; 4.程序运行时的初值和运行结果3.1准备实验1. 启动 OS Lab。2. 新建一个 EOS Kernel 项目。3.2阅读控制台命令“pm”相关的源代码,并查看其执行的结果执行控制台命令“ pm”,查看物理存储器的信息:3.3分配物理页和释放物理页使用 pm.c 文件中 ConsoleCmdPhysicalMemory 函数的 函数体替换 ke/sysproc.c 文件中ConsoleCmdPhysicalMemory 函数的函数体。调试并执行控制台命令“ pm”,查看物理存储器的信息:分配和释放多个物理页调用 MiAllocateAnyPages 函数时分配多个物理页,然后在调用 MiFreePages 函数时将分配的多个物理页释放。3.4阅读控制台命令“vm”相关的源代码,并查看其执行的结果执行控制台命令“ vm”,查看系统进程的虚拟地址描述符信息:按 F5 启动调试。待 EOS 启动完毕,在 EOS 控制台中输入命令“pt”后按回车。“pt”命令可以输出当前系统中的进程列表,其中系统进程的 ID 为 1。在 EOS 控制台中输入命令“ vm 1”后按回车得到虚拟地址描述符信息。执行控制台命令“ vm”,查看当创建了一个应用程序进程后,系统进程和应用程序进程中虚拟地址描述符的信息:切换到“Console-2”, 然后输入命令“ pt”后按回车。 输出的信息:输入命令“ vm 1”后按回车,可以查看系统进程中虚拟地址描述符的信息输入命令“ vm 31”后按回车,可以查看应用程序进程中虚拟地址描述符的信息3.5在系统进程中分配虚拟页和释放虚拟页使用 vm.c 文件中 ConsoleCmdVM 函数的函数体替换 ke/sysproc.c 文件中 ConsoleCmdVM 函数的函数体。在 EOS 控制台中输入命令“vm 1”后按回车调试分配虚拟页和释放虚拟页的过程:vm 命令开始执行后,会在调用 MmAllocateVirtualMemory 函数的代码行处中断。 此时要注意参数BaseAddress 和 RegionSize 初始化的值。分配虚拟页的调试过程中BaseAddress 和RegionSize 的值的变化:进入函数之前BaseAddress 和RegionSize 的值退出函数以后BaseAddress 和RegionSize 的值释放虚拟页的调试过程中BaseAddress 和RegionSize 的值的变化:进入函数前BaseAddress 和RegionSize 的值刚退出函数时BaseAddress 和RegionSize 的值在调用 MmAllocateVirtualMemory 函数时将 RegionSize 参数的值设置为 PAGE_SIZE+1时“输出”窗口中转储的信息:Total Vpn from 655360 to 657407. (0xA0000000 - 0xA07FFFFF)1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)4# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)5# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)6# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)7# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)8# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)9# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)10# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)11# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)Total Vpn Count: 2048.Allocated Vpn Count: 21.Free Vpn Count: 2027.Zeroed Physical Page Count: 0.Free Physical Page Count: 7126.New VM's base address: 0xA0017000. Size: 0x3000.1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)4# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)5# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)6# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)7# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)8# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)9# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)10# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)11# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)12# Vad Include 3 Vpn From 655383 to 655385. (0xA0017000 - 0xA0019FFF)Allocated Vpn Count: 24.Free Vpn Count: 2024.Zeroed Physical Page Count: 0.Free Physical Page Count: 7126.Free VM's base address: 0xA0017000. Size: 0x3000.1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)4# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)5# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)6# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)7# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)8# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)9# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)10# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)11# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)Allocated Vpn Count: 21.Free Vpn Count: 2027.Zeroed Physical Page Count: 0.Free Physical Page Count: 7126.在调用 MmAllocateVirtualMemory 函数时将 BaseAddress 参数的值设置为已经被占用的虚拟内存,例如 0xA0000000, “输出”窗口中转储的信息:Total Vpn from 655360 to 657407. (0xA0000000 - 0xA07FFFFF)1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)4# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)5# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)6# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)7# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)8# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)9# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)10# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)11# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)Total Vpn Count: 2048.Free Vpn Count: 2027.Zeroed Physical Page Count: 0.Free Physical Page Count: 7126.New VM's base address: 0xA0003000. Size: 0x1000.1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 1 Vpn From 655363 to 655363. (0xA0003000 - 0xA0003FFF)4# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)5# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)6# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)7# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)8# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)9# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)10# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)11# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)12# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)Free Vpn Count: 2026.Zeroed Physical Page Count: 0.Free Physical Page Count: 7126.Free VM's base address: 0xA0003000. Size: 0x1000.1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)4# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)5# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)6# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)7# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)8# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)9# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)10# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)11# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)Free Vpn Count: 2027.Free Physical Page Count: 7126.在调用 MmAllocateVirtualMemory 函数时将 RegionSize 参数的值设置为 PAGE_SIZE*2, 将BaseAddress 参数的值设置为 0xA0017004,“输出”窗口中转储的信息:Total Vpn from 655360 to 657407. (0xA0000000 - 0xA07FFFFF)1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)4# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)5# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)6# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)7# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)8# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)9# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)10# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)11# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)Total Vpn Count: 2048.Allocated Vpn Count: 21.Free Vpn Count: 2027.Zeroed Physical Page Count: 0.Free Physical Page Count: 7126.New VM's base address: 0xA0017000. Size: 0x3000.1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)4# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)5# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)6# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)7# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)8# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)9# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)10# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)11# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)12# Vad Include 3 Vpn From 655383 to 655385. (0xA0017000 - 0xA0019FFF)Free Vpn Count: 2024.Zeroed Physical Page Count: 0.Free Physical Page Count: 7126.Free VM's base address: 0xA0017000. Size: 0x3000.1# Vad Include 1 Vpn From 655360 to 655360. (0xA0000000 - 0xA0000FFF)2# Vad Include 2 Vpn From 655361 to 655362. (0xA0001000 - 0xA0002FFF)3# Vad Include 2 Vpn From 655365 to 655366. (0xA0005000 - 0xA0006FFF)4# Vad Include 2 Vpn From 655367 to 655368. (0xA0007000 - 0xA0008FFF)5# Vad Include 2 Vpn From 655369 to 655370. (0xA0009000 - 0xA000AFFF)6# Vad Include 2 Vpn From 655371 to 655372. (0xA000B000 - 0xA000CFFF)7# Vad Include 2 Vpn From 655373 to 655374. (0xA000D000 - 0xA000EFFF)8# Vad Include 2 Vpn From 655375 to 655376. (0xA000F000 - 0xA0010FFF)9# Vad Include 2 Vpn From 655377 to 655378. (0xA0011000 - 0xA0012FFF)10# Vad Include 2 Vpn From 655379 to 655380. (0xA0013000 - 0xA0014FFF)11# Vad Include 2 Vpn From 655381 to 655382. (0xA0015000 - 0xA0016FFF)Free Vpn Count: 2027.Zeroed Physical Page Count: 0.3.6在应用程序进程中分配虚拟页和释放虚拟页3.6.1要求创建一个 EOS 应用程序,并编写代码完成下列功能:1. 调用 API 函数 VirtualAlloc,分配一个整型变量所需的空间,并使用一个整型变量的指针指向这个空间。2. 修改整型变量的值为 0xFFFFFFFF。在修改前输出整型变量的值,在修改后再输出整型变量的值。3. 调用 API 函数 Sleep, 等待 10 秒钟。4. 调用 API 函数 VirtualFree,释放之前分配的整型变量的空间。5. 进入死循环,这样应用程序就不会结束。3.6.2编写的代码:#include "EOSApp.h" int main(int argc, char* argv) #ifdef _DEBUG _asm("int $3n nop"); #endif INT *d; /*调用API 函数 VirtualAlloc,分配一个整型变量所需的空间,并使用一个整型变量的指针指向这个空间。*/ if(d=VirtualAlloc(0,sizeof(int),MEM_RESERVE|MEM_COMMIT) printf("Allocated %d bytes virtual memory of 0x%xnn",*d); /*修改整型变量的值为0xFFFFFFFF。在修改前输出整型变量的值,在修改后再输出整型变量的值*/ printf("virtual memory original value :0x%x nn",*d); *d=0xFFFFFFFF;printf("a new virtua

    注意事项

    本文(操作系统实验 第四讲 物理存储器与进程逻辑地址空间的管理(21页).doc)为本站会员(1595****071)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

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

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开