home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 163 / QTEC9305.ZIP / VIRTUALI.TEC < prev    next >
Text File  |  1992-07-06  |  18KB  |  316 lines

  1. ID:V1 Virtualization:  What is it?
  2. Quarterdeck Technical Bulletin #201
  3. by Michael Bolton and Eric Wieling
  4. Last Revised: January 22, 1992
  5.  
  6. Q. What is virtualizing?
  7. Q. What does "virtualize text and graphics" mean?
  8. Q. What does "writes directly to screen" mean?
  9. Q. How can I tell if my program writes directly to screen?
  10. Q. I've set "Runs in background" to Y.  Why isn't my program running in
  11.    background?
  12.  
  13. Q. What is "virtualizing"?
  14.  
  15. Programs can handle display in three ways in DESQview parlance.  These are
  16. explained in more detail below, but briefly,
  17.  
  18. 1) the "well-behaved" application uses DOS or your system's BIOS services to 
  19.    display its information;
  20.  
  21. 2) the "DESQview-aware" program writes directly to the screen when not running 
  22.    under DESQview, but writes to a special area of memory (under DESQview's 
  23.    control) so that DESQview may properly manage display of multiple windows.
  24.  
  25. 3) the "misbehaved" application writes directly to the screen hardware with no 
  26.    consideration for DESQview.
  27.  
  28. Misbehaved applications present a special problem for most multitasking 
  29. environments, in that direct screen-writing can "bleed through" into 
  30. foreground windows.  However, on a 386 processor, DESQview 386 (which is 
  31. simply DESQview and QEMM running on the same computer) can "virtualize" 
  32. misbehaved applications; that is, it can fool these applications into 
  33. believing that they have exclusive control of the screen.  Thus, such 
  34. applications may be run in background and/or in a small window without 
  35. interfering with the display of other applications.
  36.  
  37. For the purposes of this discussion, the 80386SX, the 80386 (also known as the 
  38. 80386DX), the i486, and the i486SX are equivalent; all provide the memory-
  39. management features of the 386; henceforth, the term "386" refers to any 
  40. processor in this family.
  41.  
  42. Unless you are working on a 386, AND using both DESQview and QEMM-386 (which 
  43. together comprise DESQview 386), virtualizing means little to you; anything 
  44. less than a 386 is not capable of virtualizing the screen, and only DESQview 
  45. 386 provides the memory management services that allow this trick to be 
  46. performed.  This is another of the many compelling reasons to move to a 386 
  47. processor if you have not already done so.
  48.  
  49. From DESQview's perspective, there are two basic types of programs, as far as 
  50. display is concerned.  The first type of program, the "well-behaved" program 
  51. in DESQview parlance, uses DOS or the system's Basic Input/Output Services 
  52. (BIOS) to put text on the screen.  The BIOS gets instructions from the 
  53. program, and then puts values into screen memory addresses; these values are 
  54. then translated by the display adapter to show up as the characters that you 
  55. see on your monitor.  "Well-behaved" applications, then, use resources built 
  56. into the system to display information.  To run such programs in a small 
  57. window or in background, DESQview (without QEMM's help, and on any processor) 
  58. intercepts DOS and BIOS calls and places the results into a "virtual screen." 
  59. This is an area of memory (or "buffer") the same size as screen memory, which, 
  60. to the application, looks and feels exactly like the real screen.  The 
  61. application therefore behaves as it would if it had the computer all to 
  62. itself.  The "well-behaved" program believes that display work has been done, 
  63. and continues about its business without complaints.
  64.  
  65. Hercules, CGA, EGA, or VGA graphical applications (this includes all programs 
  66. with graphical user interfaces) normally do not use the BIOS for display.  
  67. Because of the greater complexity involved in displaying graphics, such 
  68. programs do not have the option of writing directly to a DESQview memory 
  69. buffer, nor are there BIOS services efficient enough to allow such programs to 
  70. run at a satisfactory speed.  These applications are therefore, by definition, 
  71. NOT well-behaved and are called (predictably) "misbehaved" in DESQview 
  72. parlance.  This type of program avoids DOS and the BIOS, and puts text or 
  73. graphics on the screen itself by writing values directly into screen memory 
  74. addresses.
  75.  
  76. For text-based applications, writing directly to the screen hardware is 
  77. considerably faster than using BIOS calls, so many text applications write 
  78. directly to in the interests of speed.  Graphics-oriented BIOS functions are 
  79. limited in power and flexibility, and in any case are unacceptably slow, so 
  80. graphical applications write directly to the screen.
  81.  
  82. The DESQview-aware program checks for the presence of DESQview (or TopView, an 
  83. IBM environment with which DESQview is compatible) and asks for the address of 
  84. the memory buffer that DESQview will use to store the program's video 
  85. information.  The program then writes directly to DESQview's memory buffer 
  86. instead of to the video hardware.  This method produces the same well-governed 
  87. results as writing through DOS or the BIOS, and is considerably faster.  This 
  88. type of application is called "DESQview-aware."
  89.  
  90. Writing directly to screen memory addresses eliminates the middleman, but the 
  91. catch is that direct-to-screen display information cannot be intercepted and 
  92. redirected as easily as BIOS calls.  Under anything other than DESQview-386, 
  93. misbehaved programs may interfere with the display of others.  Misbehaved 
  94. programs interact directly with the display hardware, and will write outside 
  95. the borders of their DESQview windows; if allowed to run in background or in a 
  96. small window, these programs will "leak" or "bleed" into the display windowsnd 
  97. of other applications.  The alternative is to suspend the operation of theay 
  98. misbehaved program while it is in background, which is DESQview's defaultf 
  99. method of managing such things.  This is quite satisfactory for those who want 
  100. to use DESQview as a task-switching environment, but not for those who desire 
  101. multitasking.
  102.  
  103. Happily, the 386 processor, QEMM-386, and DESQview, all working together, can 
  104. trap the direct screen writes of misbehaved text or graphics programs and 
  105. redirect the output of these applications to DESQview's virtual screen 
  106. buffers.  As far as the application knows, it is writing to the screen.  This 
  107. process is called "virtualizing."  The advantage of virtualizing is that, 
  108. under DESQview 386, misbehaved text programs and even programs using Hercules, 
  109. CGA, EGA, or VGA graphics can continue run in background or in a small window, 
  110. without causing display conflicts.
  111.  
  112. Q. What is the difference between "virtualizing text" and "virtualizing text 
  113.    AND graphics"?
  114.  
  115. First, memory usage:  a memory buffer for a virtualized text screen only takes
  116. up as much memory (in bytes) as there are places to display a character on the
  117. screen.  That works out to 80 (columns) X 25 (rows) X 2 bytes per character
  118. (one byte for the character, and the other for its display attribute -- color,
  119. highlighting, or underlining), for a total of 4000 bytes.  Creating  a virtual
  120. screen to hold text-based data costs relatively little memory.  DESQview uses
  121. expanded memory to virtualize video output, and expanded memory can only be
  122. allocated in 16K chunks (called "pages").  Consequently 16K (rather than 4000
  123. bytes) of expanded memory is needed to virtualize a text program. 
  124. Virtualizing a graphics program requires as much as 272K of available expanded
  125. memory, depending on the graphics mode that the program is using.  Check your
  126. DESQview manual for entries indexed under "graphics pages" for more detailed
  127. figures.
  128.  
  129. Second, there is a difference in the use of the processor's time.  A 
  130. virtualized text program is approximately as fast as a nonvirtualized text 
  131. program, but virtualizing graphics takes a heavier toll on the processor.  
  132. (Incidentally, when you are running a virtualized program full-screen and in 
  133. foreground, DESQview temporarily suspends virtualization and lets the program 
  134. write to the real video memory region; in this circumstance, there is little 
  135. extra processor overhead.)
  136.  
  137. Third, it is worth noting that under DESQview 386, even protected mode
  138. programs, also known as DOS-extended programs, can be multitasked. This is
  139. thanks to a memory-management specification co-authored by Quarterdeck called
  140. the Virtual Control Program Interface (VCPI).  It is possible in most
  141. circumstances to virtualize the text output of a program that runs in
  142. protected mode, because most protected mode programs actually switch into real
  143. mode to write text to the screen. However, programs that write graphics
  144. directly to the screen while in protected mode cannot be virtualized, so
  145. DESQview 386 will by default halt the operation of such programs when they are
  146. not using the full screen.  A newer specification for multitasking, the DOS
  147. Protected Mode Interface, will allow virtualization of graphical protected-
  148. mode programs; future versions of DESQview and QEMM are expected to support
  149. this specification.  If it is vital that a protected mode graphics program
  150. continue to run in background, it will not be halted if Runs in Background (on
  151. the second page of the Change a Program Menu) is set to Y.  The program will
  152. continue to write its graphics to the screen, which may interfere with the
  153. display of foreground programs, but the ability to run the program in
  154. background may be worth the inconvenience.
  155.  
  156. Q.  How can I tell if my program is writing directly to screen?
  157.  
  158. To tell if an application is writing directly to the video hardware inside 
  159. DESQview, make the following changes in the application's Change a Program 
  160. menu:
  161.  
  162.      1) Set "Writes text directly to screen" to N;
  163.  
  164.      2) Set "Virtualize text/graphics" to N;
  165.  
  166.      3) On the Advanced Options screen, blank out the following four fields
  167.         in the "Window Position" section:  Starting Height, Starting Width,
  168.         Starting Row, and Starting Column.  Put blanks in these fields, not
  169.         zeros.
  170.  
  171. After these changes have been made, open the program.  DESQview will place a 
  172. small window border on the screen; if the program comes up and stays within 
  173. the small window border, it does not write directly to the screen.  If the 
  174. program demolishes the window border, takes the full screen, or writes 
  175. anywhere outside the window, it is writing directly to the hardware.  Such a 
  176. program should be virtualized if it is to be run in background or in a small 
  177. window.
  178.  
  179. Q. Why doesn't my program STAY in background?  It bleeds through on to the 
  180.    screen when it's background; even though I've set "Runs in background" to Y, 
  181.    the information from this program keeps showing up in the foreground window.
  182.  
  183. If it is an application that writes text or graphics directly to screen, one 
  184. reason might be that it is not set up to virtualize.  You can amend this by:
  185.  
  186.      1) selecting Change a Program from the DESQview Open Window Menu,
  187.  
  188.      2) selecting the program that you want to change, and
  189.  
  190.      3) on page one of the Change a Program Menu, setting "Virtualize text
  191.         and graphics" to Y (for both text and graphics) or T (for text only).
  192.  
  193. Q.  When should I virtualize both text and graphics?
  194.  
  195. If an application does work which you want to continue while the program is in 
  196. background or in a small window, and it is a program that does this work while 
  197. displaying graphics, set "Virtualize text and graphics" to Y.
  198.  
  199. Q. When should I virtualize text only?
  200.  
  201. 1) If you have an application which writes text directly to the screen, but 
  202.    never uses graphics, set Virtualize to T.  Misbehaved text-based 
  203.    applications are good candidates for this treatment.
  204.  
  205. 2) If you have an application which writes both text and graphics directly to 
  206.    the screen, but which does not need to run in background while graphics are 
  207.    being displayed, set Virtualize to T.  A good example of this type of 
  208.    program is a word processor or a spreadsheet which has a graphical element 
  209.    to it (a charting or print preview module, for example) that you never need 
  210.    to run in background or in a small window.  Even if you're not virtualizing 
  211.    this type of program, you can still place your chart or print preview in a 
  212.    small window -- the program simply halts, while retaining the information on
  213.    screen.  You can still use DESQview's screen management to see all the parts
  214.    of the screen you like, but the program's operation is suspended while it's 
  215.    in the small window.  Recalculating and printing, since they usually take 
  216.    place while the screen is in text mode, can typically continue to run in 
  217.    background in such programs, since the text mode of the program is being 
  218.    virtualized.
  219.  
  220. 3) If you have an application which writes text in real mode, but writes 
  221.    graphics to the screen while in protected mode, again set "Virtualize text 
  222.    and graphics" to T.  Do this because the program can still be virtualized 
  223.    while it's in text mode, even though it can't be virtualized while it's 
  224.    displaying graphics.
  225.  
  226. Q. I've done all these things and my program STILL won't run in background. 
  227.    What's wrong?
  228.  
  229. There are a few possibilities.
  230.  
  231. * You may have set "Virtualize Text and Graphics" on Page 1 of the program's 
  232.   Change a Program Menu to N.
  233.  
  234.   Solution: set Virtualize Text and Graphics to Y
  235.  
  236. * You may simply be out of memory; when DESQview virtualizes an application's 
  237.   graphics, it can require up to 272K of free expanded memory.
  238.  
  239.   Solution:  make sure that you have enough memory available for virtualizing. 
  240.   If you have several applications open, close down one or more.  Make sure
  241.   that you have not allocated a large number of graphics pages unnecessarily;
  242.   if the number of graphics pages is greater than one, try decreasing it. If
  243.   you have a disk cache that "lends" memory to applications, try disabling
  244.   this feature and reducing the size of the cache.  Finally, you might also
  245.   want to consider upgrading your system by adding more memory.
  246.  
  247. * DESQview 386 cannot virtualize if you have set the Expanded Memory Page
  248.   Frame to 0 with QEMM's FRAME=NONE or FRAMELENGTH=0 parameters.
  249.  
  250.   Solution: make sure neither of the above parameters is on the QEMM line in 
  251.   CONFIG.SYS.
  252.  
  253. * Although DESQview can save and restore all standard IBM VGA video modes,
  254.   there are a few non-standard VGA modes, and Super VGA modes, that it can't
  255.   virtualize.  This is because Super VGA implementations vary from card to
  256.   card.
  257.  
  258.  Solution: try using a lower resolution for the program in question. Text
  259.  mode, sometimes known as "CGA mode" for some programs, is a good place to
  260.  start. "CGA mode" is something of a misnomer, since you'll actually still get
  261.  your normal resolution on an EGA or VGA -- the program just writes to the
  262.  screen without being in graphics mode.  If your program uses a very high
  263.   resolution graphics mode, (e.g. 1024 x 768), or a very high number of
  264.   colours (e.g. 256 colour mode), try using lower resolutions or lower numbers
  265.   of colours until you are successful.
  266.  
  267. * To virtualize graphics, you may need more graphics pages.
  268.  
  269.   Solution: on the Advanced Options screen of the Change a Program Menu, try 
  270.   setting Graphics Pages to a higher number, such as 2 or 4.  Keep in mind
  271.   that each graphics page can take up to 128K.
  272.  
  273. * You may not have enough Real Alternate Maps to virtualize a large number of
  274.   windows.
  275.  
  276.   Solution:  QEMM must provide DESQview with a Real Alternate Map for each 
  277.   virtualized window.  Since QEMM's default number of Real Alternate Maps is 
  278.   8, if you are using more than 8 windows, you'll be unable to virtualize 
  279.   window 9.  Close down an application or two, or specify MAPS=n on the QEMM 
  280.   line in CONFIG.SYS, where n is a number larger than 8.  Numbers larger than 
  281.   20 are unlikely to be helpful.  Each alternate map uses 4k of expanded
  282.    memory.
  283.  
  284. * Programs that start as part of a DESQview startup script, and are put into 
  285.   background by the script, may not virtualize if they change video modes; 
  286.   when the video mode changes, they will be suspended.
  287.  
  288.   Solution:  for this type of program, make sure that "Runs in Background" is 
  289.   set to Y, and is not left blank.
  290.  
  291. * A program may be grabbing a hardware interrupt, and may write directly to
  292.   screen from inside its hardware interrupt handler.  This most often results
  293.   in a trail of oddly-coloured blocks, left behind on the screen when the
  294.   mouse is moved (mouse droppings).
  295.  
  296.   Solution:  Consult Quarterdeck Technical Note #238, "'Mouse Droppings' in
  297.   DESQview" (MOUSDROP.TEC) for an explanation and a solution.  The file
  298.   should be available from the same source as this one; it is available on the
  299.   Quarterdeck BBS at (310) 314-3227, Compuserve (!GO QUARTERDECK), or large
  300.   local BBS systems.  It is also available through our QFAX fax
  301.   retrieval service at (310) 314-3214; call from the handset on your fax
  302.   machine.
  303.  
  304. Finally, it should be noted that DESQview 386 is presently the only DOS-based
  305. program in existence that will multitask and virtualize misbehaved DOS
  306. applications which use EGA and VGA graphics.  Virtualization is one of the
  307. principal ways by which DESQview can multitask these applications;
  308. understanding the above ideas about virtualization can help you to take the
  309. greatest advantage of DESQview's power.
  310.  
  311.   ************************************************************************
  312.   *This technical note may be copied and distributed freely as long as it*
  313.   *is distributed in its entirety and it is not distributed for profit.  *
  314.   *         Copyright (C) 1990-2 by Quarterdeck Office Systems           *
  315.   ************************ E N D   O F   F I L E *************************
  316.