📄 vxd-e2.html
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Iczelion">
<meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; I) [Netscape]">
<title>Virtual Machine Manager: Overview</title>
</head>
<body text="#FFFFFF" bgcolor="#000080" link="#FFFF00" vlink="#8080FF" alink="#FF00FF">
<center>
<h1>
<font face="Arial,Helvetica"><font color="#FFFF99">Virtual Machine Manager</font></font></h1></center>
<font face="Arial,Helvetica"><font size=-1>Virtual Machine Manager (VMM)
is the <b><font color="#FFFF99">true</font></b> 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:</font></font>
<ul>
<li>
<font face="Arial,Helvetica"><font size=-1>Memory management</font></font></li>
<li>
<font face="Arial,Helvetica"><font size=-1>Interrupt handling</font></font></li>
<li>
<font face="Arial,Helvetica"><font size=-1>Thread scheduling</font></font></li>
</ul>
<h3>
<font face="Arial,Helvetica"><font color="#66FFFF"><font size=-1>Memory
Management</font></font></font></h3>
<font face="Arial,Helvetica"><font size=-1>VMM 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.</font></font>
<ul>
<li>
<font face="Arial,Helvetica"><font size=-1><b><font color="#66FF99">V86
region</font></b> extending from address 0h to 10FFEFh. This region belongs
to the currently executing virtual machine.</font></font></li>
<li>
<font face="Arial,Helvetica"><font size=-1><b><font color="#66FF99">Private
application region</font></b> 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).</font></font></li>
<li>
<font face="Arial,Helvetica"><font size=-1><b><font color="#66FF99">Shared
application region</font></b> extending from address 2 GB to 3 GB. This
area is shared to <b><font color="#FFFF99">ALL</font></b> 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.</font></font></li>
<li>
<font face="Arial,Helvetica"><font size=-1><b><font color="#66FF99">Shared
system region</font></b> extending from the address 3GB to 4GB. This is
where VMM and VxDs live.</font></font></li>
</ul>
<font face="Arial,Helvetica"><font size=-1>VMM provides three types of
memory services to VxDs</font></font>
<ul>
<li>
<font face="Arial,Helvetica"><font size=-1><b><font color="#FFFF99">Page-based
memory services</font></b>. 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.</font></font></li>
<li>
<font face="Arial,Helvetica"><font size=-1><b><font color="#FFFF99">Heap
memory services</font></b>. Manage smaller blocks of memory. This is a
higher-level of memory management services built on top of the page-based
ones.</font></font></li>
<li>
<font face="Arial,Helvetica"><font size=-1><b><font color="#FFFF99">List
services</font></b>. Manage fixed-size memory blocks suitable for implementing
linked lists.</font></font></li>
</ul>
<h3>
<font face="Arial,Helvetica"><font color="#66FFFF"><font size=-1>Interrupt
Handling</font></font></font></h3>
<font face="Arial,Helvetica"><font size=-1>Interrupts 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.</font></font>
<br><font face="Arial,Helvetica"><font size=-1>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)</font></font>
<h3>
<font face="Arial,Helvetica"><font color="#66FFFF"><font size=-1>Thread
Scheduling</font></font></font></h3>
<font face="Arial,Helvetica"><font size=-1>The VMM uses two scheduler components
to implement preemptive multitasking among threads and VMs.</font></font>
<ul>
<li>
<b><font face="Arial,Helvetica"><font color="#FFFF99"><font size=-1>primary
scheduler</font></font></font></b></li>
<li>
<font face="Arial,Helvetica"><font size=-1><b><font color="#FFFF99">time-slicer</font></b>
or <b><font color="#FFFF99">secondary scheduler</font></b></font></font></li>
</ul>
<font face="Arial,Helvetica"><font size=-1>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.</font></font>
<br><font face="Arial,Helvetica"><font size=-1>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.</font></font>
<p><font face="Arial,Helvetica"><font size=-1>You can get more detail about
these subjects from <b><font color="#FFFF99">Walter Oney's Systems Programming
for Windows 95</font></b> and the <b><font color="#FFFF99">Windows 95 DDK
documentation</font></b>.</font></font>
<br>
<hr WIDTH="100%">
<center><b>[<a href="http://win32asm.cjb.net">Iczelion's Win32 Assembly
Homepage</a>]</b></center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -