delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/04/03:39:10

Date: Sun, 4 Feb 1996 10:33:28 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Brendan Simon <brendan AT rdt DOT monash DOT edu DOT au>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Protected Mode Questions

On Fri, 2 Feb 1996, Brendan Simon wrote:

> When a PM program is running, what percentage of the time is the CPU in PM,
> and what percentage in RM.

It depends on what your program is doing (see below).

> What are the main reasons for the CPU switching to RM.
> Is it system call stuff ??  Such as file system access, timer ints, bios,etc ???

All of the above.  Most hardware interrupts eventually switch to real 
mode (sometimes even twice), unless a PM handler has hooked them.  DOS 
functions (like file access) also cause a switch to real mode, because 
DOS code cannot run in protected mode.

> If so, is it possible to write device drivers or other OS type routines to
> keep the CPU in PM as much as possible ??
> Am I asking the impossible, or not worth trying since I really want a simple
> protected mode OS ???

It's not impossible, but it *is* an OS.  If you only take over *some* of 
the OS functions, then the less functions you want to do in PM, the 
easier is the task of writing such a server.

> I ask this because I am under the impression that mode swaps are expensive
> in terms of performance, and if I/we can eliminate the swaps as much as possible
> then we will be much better off.

This is not necessarily true.  A mode switch indeed eats up many cycles, 
but not as much as you seem to think.  Consider this: Win95 with 32-bit 
file access does all file operations in protected mode, and yet it is 
only about twice as fast as DOS in file-oriented benchmarks.  This is 
impressive, but not impressive enough (IMHO) to make writing a 
full-fledged PM OS a worthy investment of your time, if the only thing 
that you are worried about is running applications.

Just my $0.02 worth.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019