分享
 
 
 

iczelion Vxd tut2

王朝other·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

Virtual Machine ManagerVirtual Machine Manager (VMM) is the true operating system behind Windows 95. It erects and maintains the framework for managing virtual machines. It also provides many important services to other VxDs. The three important services are:

Memory management

Interrupt handling

Thread scheduling

Memory ManagementVMM uses paging capability of Intel 80386 and later processors to create a 32-bit virtual address space for the system VM. It divides the address space into four distinct areas.

V86 region extending from address 0h to 10FFEFh. This region belongs to the currently executing virtual machine.

Private application region extending from the address 4MB to 2GB. This is the area where win32 applications run. Each win32 process will have its own private 2GB (minus 4 MB).

Shared application region extending from address 2 GB to 3 GB. This area is shared to ALL applications in the system VM. This region is where the system DLLs (user32, kernel32, and gdi32) reside. All Win16 apps run here as well because they are ill-behaved: they are used to reading/writing from/to other win16 apps in memory. In this region, Win16 apps can see all other Win16 apps. Memory mapped files are stored here as well as the memory allocated for DPMI calls.

Shared system region extending from the address 3GB to 4GB. This is where VMM and VxDs live. VMM provides three types of memory services to VxDs

Page-based memory services. This kind of services allocate/manage memory in pages of 4 KBs. It's the lowest level memory services available. All other memory services use page-based memory services as their base.

Heap memory services. Manage smaller blocks of memory. This is a higher-level of memory management services built on top of the page-based ones.

List services. Manage fixed-size memory blocks suitable for implementing linked lists.

Interrupt HandlingInterrupts in protected mode vector to Interrupt Descriptor Table (IDT). VMM supervises the IDTs of VMs with the help of VxDs. Normally VMM handles nearly all the entries in IDTs. It provides first-level interrupt handlers which save the state of interrupted program on the stack and transfer control to the second-level interrupt handlers which may be provided by various VxDs for the actual processing. When the second-level handler finishes its job, it transfers control to the redispatch routine which will restore the state of the interrupted program and resume execution at the previous point of interruption.

The above description is an oversimplified one. Redispatching may not be immediate because the interrupted VM's timeslice may expire. VxDs can install interrupt handlers via VMM services such as Set_PM_Int or Hook_V86_Int_Chain. VxDs must not modify IDT entries directly (but you can do it if you are sure you know what you're doing)

Thread SchedulingThe VMM uses two scheduler components to implement preemptive multitasking among threads and VMs.

primary scheduler

time-slicer or secondary scheduler Primary scheduler's task is to choose the thread with highest execution priority to run. This selection occurs while the VMM is servicing an interrupt (such as timer interrupts). The outcome determines which thread/VM will be given control when the VMM returns from servicing the interrupt. Primary scheduler works under all-or-nothing rule. Either a thread will be run or it will not. Only one thread is chosen. VMM and other VxDs can boost/adjust execution priority of threads via VMM services. For example, if a hardware interrupt occurs, VMM will boost the interrupt handler's execution priority so that it will have higher chance of completion in the shortest possible time.

Secondary scheduler uses the services of the primary scheduler to allocate CPU time among threads that share the highest execution priority by giving each thread a time slice. When a thread executes until its time slice expires, the secondary scheduler boosts the execution priority of the next thread so that it will be chosen by the primary scheduler to run.

You can get more detail about these subjects from Walter Oney's Systems Programming for Windows 95 and the Windows 95 DDK documentation.

[Iczelion's Win32 Assembly Homepage]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有