KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/ap.belleisle/~belleisl/tune_faq/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/ap.belleisle/~belleisl/tune_faq/overrun.htm
<HTML>
<HEAD><TITLE>AL's WINSOCK TUNING FAQ</TITLE></HEAD>
<BODY BGCOLOR="#C0C0C0" TEXT="#000000" LINK="#0000FF" VLINK="#008000" ALINK="#FF0000">
<H3>COM PORT OVERRUN ERRORS:</H3>
<P>If your <B>UART</B> is of an older type (<B>8250</B> or <B>16450</B>), it can only hold eight bits of data from the modem (one byte). Most any CPU running MSDOS can service interrupts quickly enough to empty a one-byte UART without overruns, even if the modem is allowed to fill it at a 115,200 bps rate. However, the extra <B>overhead</B> imposed by <B>Windows</B> generally limits the 8250-interrupt servicing speed of even the fastest CPU to a rate which can only cope with a modem-to-com-port rate of <B>9600 bps</B> (19200 with only one program window open).
<P>Since <B>modem data compression</B> (<B>V.42bis or MNP-5</B>) can send 2-to-4 bytes of compressible data (like text) for each byte actually transmitted over the modem, a modem receiving data at a nominal 28,800 bps rate can fill a com port's UART at <B>57,600-to-115,200 bps</B>. The solution to this problem is a UART that can hold up to 16 bytes of data in a <I>First-In/First-Out</I> 
(<B>FIFO</B>) data buffer: the <B>16550A</B>.
<P>The <I>MicroSoft Diagnostic</I> program (<B>msd.exe</B>, which can only be run from the DOS prompt after exiting Windows) will tell you whether it detects a 16550 on your com port. Any modern combination disk controller/<B>serial port card</B> can provide one for about US$30. Any <B>internal modem</B> will emulate a 16550 in high-speed firmware. Alternatively, a <B>parallel port modem</B> can connect to your printer port with a software driver that emulates a 16550-based com port at speeds up to 300,000 bps.
<P>In any case, Windows must talk to the UART through a serial port driver (called <B>comm.drv</B>) which can make full use of the 16550A's FIFO. (A dynamically-linked library of functions for an applications program is a .dll-file; one that is loaded by Windows from the <B>windows\system</B> directory at start-up, so it's ready to serve any compatible applications program, is a .drv-file.) Windows uses an entry in the <B>[386enh]</B> section of the <B>system.ini</B> file to enable/disable use of the FIFO - it must say <B>Com#FIFO=1</B>, where # is the number of the com port (1,2, or whatever).
<P><BLOCKQUOTE><FONT SIZE=2><B>NOTE:</B> Com#FIFO=2 (or any numerical value except 
0 or 1) is the default value, which tells Windows to test for a 16550, and if it's there use its FIFO. However, Com#FIFO=1 eliminates any ambiguity about the reliability of  such a test with an emulated FIFO. Com#FIFO= anything else, such as  "true" or "on" will be interpreted as Com#FIFO=0, which turns <I>off</I> the FIFO. [Microsoft KnowledgeBase Article Q119579]</FONT></BLOCKQUOTE>
<P>The default setting of <b>Com#RxTrigger=8</b> tells the com port to interrupt Windows to come get data when 8 of the 16 bytes in the FIFO are full. To do so, Windows must remember what it was doing, doing a <i>context switch</i>,empty the data, do a context switch back again, and resume what it was doing at the time of the interrupt. The time it takes to come get the data must not exceed the time it will take the modem to fill the remainder of the FIFO with a serial bit stream at 10 bit-times per 
byte, or there will be an overrun. 
<P>At 115,200 bps, one bit-time is less than 9 microseconds, so the modem can serially load the FIFO with a new byte every 87 microseconds.  At a 57,600 bps rate, the modem won't load the FIFO any faster than one byte every 175 microseconds. This is why the first line of defense from overruns is to reduce the rate setting your com port advertises to your modem.
<P><BLOCKQUOTE><FONT SIZE=2><B>NOTE:</B> Any well-written communications program sets the com port it uses with the byte format and bit-rate it will need at program start-up. These settings wipe out any previous settings, such as those which Windows makes at Windows start-up with the com port settings in Control Panel. For this reason, <i>the com port rate setting must be specified in the communications program.</i> In the case of Trumpet WinSock, the rate setting is specified in the trumpwsk.ini file. It is written there by the setup screen, or can be edited directly with any ASCII text editor, like Notepad (as opposed to a word processor like Write, which will corrupt the file with formatting 
characters).</FONT></BLOCKQUOTE>
<P>Putting Com#RxTrigger=4 in the [386enh] section of system.ini will allow 120 bit-times for Windows to respond.  However, this will force Windows to do a pair of context switches every 40 bit-times, rather than only every 80 bit times - 50% more time to respond at the price of 100% more overhead.  Really severe overrun problems can be addressed by setting Com#RxTrigger=1, but at the very severe 
cost of using a vast percentage of your machine's resources in context-switching, rather than updating your other program windows.
<P><B>Windows 3.1</B> (and <B>Windows 3.11</B>, a cosmetic upgrade with the same com port 
capabilities) includes a comm.drv that  has limited flexibility in utilizing a FIFO. It has a fixed setting of 14 for RxTrigger, allowing only 20 bit-times for responding to the IRQ before overruns occur. Among the replacements for the Win3.x comm.drv that allow tuning RxTrigger points under Windows 3.x is a "freeware" driver from CyberCom. To use it, place a copy of <b>cybercom.drv</b> in the windows\system directory, and in the <b>[boot]</b> section of system.ini change the line that says 
"comm.drv=comm.drv" to <b>comm.drv=cybercom.drv</b>, in order to tell Windows which driver to load at start-up.
<P><BLOCKQUOTE><FONT SIZE=2><B>NOTE:</B> Some FAX program installers replace comm.drv with their own driver, which may or may not be an improvement for WinSock applications. Check the comm.drv= line in the [boot] section of system.ini to see what driver Windows is actually loading from the windows\system directory at start-up. It has been reoprted that the installer for WinFAX actually disables the FIFO by setting COMxFIFO=0 in the [386enh] section of system.ini - almost guaranteed to cause overruns.</FONT></BLOCKQUOTE>
<P><B>Windows for Workgroups 3.11</B> was actually the test-bed for many of the features of Microsoft's <i>Chicago</i> project, which produced Windows95. Consequently, it has many high performance internal structures not found in Win3.1 or Win3.11. It uses a 32-bit <I>virtual device driver</I> (<B>VxD</B>) called VCOMM.386 to virtualize the com ports.
<P><BLOCKQUOTE><FONT SIZE=2><B>NOTE:</B> A VxD is like a .dll for the operating system. It can talk directly to hardware in ring-0 "privileged" mode, unlike .dlls and application programs, which must operate in ring-3 "protected" mode.</FONT></BLOCKQUOTE>
This VxD talks to another, called serial.386, which actually talks to the FIFO. Application programs still issue their serial communications API function calls to a ring-3 dll called comm.drv. However, this small comm.drv is only there to forward their requests to VCOMM. The whole serial communications architecture of WFW3.11 is quite different from the "everything-in-a-ring3-dll" (comm.drv) serial communications architecture of Windows, and it yields much faster interrupt response performance.
<P><BLOCKQUOTE><FONT SIZE=2><B>NOTE:</B> The original version of serial.386 contained a bug that caused the issuance of an extra NUL character to the com port when closing a session. This causes some integrated chipsets with a built-in 16550A-type UART cell to hang, requiring a system re-boot in order to open the com port for a second use. The corrected version of serial.386 has a file creation date of 2/17/94.</FONT></BLOCKQUOTE>
<P>Neither the Windows comm.drv nor any of its replacements (like cybercom.drv) are designed to properly talk to VCOMM in Windows for Workgroups (unlike the WFW comm.drv). You should <B><I>never</I> replace the Windows for Workgroups comm.drv with <I>anything</I></B>. (Since it's only designed to talk to VCOMM, you also can't use the WFW comm.drv in Windows.)
<P>
<HR WIDTH=50%>
<P>Inadequate FIFO buffering is not the only cause of com overrun errors. Anything that prevents your CPU from responding quickly enough to interrupts from your UART can cause overruns.
<P>One of the more insideous causes are S3-chip-based video cards which gain high-speed graphics performance by having their software driver <B>steal interrupt cycles</B> from your CPU in the background. This keeps your CPU too busy to respond to com port interrupts in time. The solution is an up-to-date driver, and using its option to turn-off this "speed-up" mode.
<P><BLOCKQUOTE><FONT SIZE=2><B>NOTE:</B>These drivers seem to configure themselves from the [display] section of system.ini at load time. If your board vendor doesn't supply you with a driver installation utility that does so via option check-boxes, manually add a line  to the <B>[display]</B> section of <B>system.ini</B> saying <B>bus-throttle=on</B>. </FONT></BLOCKQUOTE>
<P>Another cause is <B>poorly written 32-bit disk drivers</B> that aren't WD1003-compatible (needed 
for Windows' caching software to work properly), and which lock-out lower priority interrupts (like com port interrupts) for an inordinately long time while they dump-to-disk a large write-behind cache. While awaiting longer term fixes by upgrading disk/drivers/BIOS, you can get temporary relief by turning-off write-behind caching.
<P><FONT SIZE=2><BLOCKQUOTE><B>NOTE:</B> Windows uses a Terminate-and-Stay-Resident (<B>TSR</B>) program for disk-caching called <B>smartdrv</B> which is loaded by your <B>autoexec.bat</B> file. Add the switch <B>/X </B>to turn-off write-behind caching. Windows for Workgroups uses a VxD called <B>VCACHE</B>, ignoring smartdrv except for floppy disk drives. Write-behind caching for VCACHE is turned-off with a line in the <B>[386enh]</B> section of <B>system.ini</B> that says <B>ForceLazyOff=C</B> (or =CD if you have two hard drives) with no spaces and no <B>:</B> after drive letters.</BLOCKQUOTE></FONT>
<P>A fully compatible disk driver (like Western Digital's WDCTRL.DRV for its Caviar drives, or Ontrack Software's Drive Rocket) will enable Windows for Workgroups to use both <B>32-bit file access</B> (with a VxD called VFAT) and <B>32-bit disk access</B> which bypasses the DOS disk interrupt services through a Digital Protected Mode Interface. This provides much faster disk reads and           
writes to allow more time for handling com port interrupts.
<P>In general, any upgrade of a peripheral that results in the sudden appearance of com overruns should be debugged by commenting-out the lines in system.ini that load their accompanying new Windows drivers, or the lines in config.sys or autoexec.bat that load their driver TSRs, then rebooting with each one added in succession until the culprit is found. Brain-dead driver software written by people who assume exclusive rights to their customers' machines is an all-too-frequent cause of crippled system interrupt response speed, and com overruns.
<P ALIGN=CENTER><FONT SIZE=2><B>This FAQ is available as a <a href="../mtu_mss_rwin.html#BOTTOM">Windows Help&reg; file</a> for off-line viewing </B></P></FONT>
<P ALIGN=RIGHT><A HREF="../mtu_mss_rwin.html#TOP"><IMG SRC="contents.gif" ALIGN=LEFT></A><A HREF="slip-ppp.htm"><IMG SRC="l_arrow.gif" ALIGN=BOTTOM></A><A HREF="settings.htm"><IMG SRC="r_arrow.gif" ALIGN=BOTTOM></A></P>
<P><FONT SIZE=1>Copyright&copy; 1995 by Albert P. Belle Isle</FONT>
</BODY>
</HTML>

Anon7 - 2021