ru2aqare wrote:DPMI was an alternative to homebrew "DOS extenders" (Go32, etc.) as it had a standardised interface. Some early versions of Windows provided DPMI functionality as well (I think).
Wrong.
Come on people, just read wikipedia on DPMI, VCPI and DOS extenders. But to humour Troy, I'll explain a bit.
MS-DOS is a real mode, 16-bit operating system. At least until MS-DOS 5.0 (I'm not entirely sure about the 6.x series), it can even run on an XT. It's API is mainly accessed via int 21h (though a few other interrupts are used as well). It needs an IBM compatible BIOS to run, as it does not access most of the hardware itself (thus, it uses the BIOS services as drivers).
With the advent of the 386, the need to run programs in protected mode to take advantage of the 386 special features grew. Note that for the 286, this need was far less, as most machines still had only 1MB (yes, that is Mega, not Giga, byte) of RAM, as it was nigh impossible to access more than 1MB on a 286 (due to it's inability of switching back from protected to real mode in a 'normal' way, that is, without a processor reset, although iirc XMS did already exist (int 15h)). It was possible to run in protected mode directly, like we all do (that is, program the hardware yourself etc.), but not very practical. Thus, the DOS extender was born.
A DOS extender is, in its bare essence an API layer(or converter) that allows a program to run in protected mode (16 or 32 bit), but still call DOS as if in real mode. DOS extenders did this by converting protected mode pointers to real mode ones (and if needed copying buffers from > 1MB to 1MB), switching back to realmode (or sometimes using v86) and calling real DOS. DOS extenders usually also provide some memory management for the > 1MB memory.
When the 386 came, and people had more memory (it was becoming cheaper, and you could easily extend it by putting a DIMM in a slot, instead of plugging a handful of chips on your mobo), virtual EMS became available. I say virtual, because EMS was around even before XMS, even on the XT, in the shape of extender boards with RAM that plugged into an ISA slot. On the 386, EMS was emulated by switching to protected mode with paging, and running DOS and all DOS programs in a v86 mode task. This was a very nice (and quick, compared to XMS, that relied on copying chunks of memory) way of doing things, but caused a problem for programs aspiring to use protected mode: the processor already was in protected mode, so it was not possible to switch.
The solution was to extend the EMS drivers with an API that allowed a program that wants to go to protected mode to 'leave' the v86 task and run in full protected mode. Of course the EMS driver must still be allowed to operate, so there were certain restrictions, but the program ran in ring 0, and had full machine control. The first such extension standard was called VCPI, virtual control program interface, devised by Phar Lap and Quarterdeck (both popular DOS extender / extended DOS environment providing companies). The downside was that when VCPI was launched, so was Windows 3, which had both a 286 and 386 mode, both incompatible with VCPI.
As a solution, Microsoft specified a new API, DPMI, that allowed a program to run in protected mode under Windows, but only in ring 3. Both 16 bit and 32 bit protected mode was possible (even running in Windows 3 native 16-bit, you could run a 32-bit protected mode program using DPMI).
DOS extenders had to cope with all these specifications. The typical DOS extender (e.g. the very popular PMODE by Tran, or DOS/4GW) first tried whether it could run in plain protected mode (using an XMS driver if needed). If not possible, it tried VCPI. If not possible, it tried DPMI.
For the programmer, DOS extenders were quite a gift, as it removed the burden of dealing with all the peculiarities of XMS, EMS, VCPI, DPMI and the like, and ensured your main() just started in protected mode, and a malloc() used upper memory if needed.
Ok, that's enough talking for one day. As it may be clear,
all of this is totally irrelavant to the current day, as programs are written directly for an OS. But it never hurts to know a bit of history.
Disclaimer: all this comes from my memory, though I did a bit of fact checking here and there. Feel free to correct me, but please provide sources :).
JAL