[comp.unix.questions] XON/XOFF buffer control

parker@zaphod.mpr.ca (Ross Parker) (11/29/89)

Hi...

	Does anyone know how flow control is handled in the
tty driver in the case where an external device is not able
to halt output immediately upon receiving an XOFF, i.e. it
must send 'a few' characters after getting the XOFF?

	Is there some kind of threshold involved such that the
XOFF goes out when the input buffer still has room? How much
room is left in the input buffer?

	In particular, I need to know this for LAT ttys under
ULTRIX 3.0 and 3.1, but any generic info would be useful.

Thanks,


Ross Parker				parker@mpre.mpr.ca
(604)293-5495				uunet!ubc-cs!mpre!parker

cpcahil@virtech.uucp (Conor P. Cahill) (11/30/89)

In article <1928@eric.mpr.ca>, parker@zaphod.mpr.ca (Ross Parker) writes:
> 	Does anyone know how flow control is handled in the
> tty driver in the case where an external device is not able
> to halt output immediately upon receiving an XOFF, i.e. it
> must send 'a few' characters after getting the XOFF?

Anyone inplementing a flow control mechanism must allow for additional
data to come in following a "turn off".  This must be the case because
as a minimum the following delays will occur:

	1. propagation time from sender for byte that "broke the camels back"
	2. Time to process the byte & determine that threshold has been 
	   reached (this will usually be near 0 when compared to the propagation
	   times).
	3. propagation time for the discontinue signal (XOFF in this case) to
	   be sent back.

The communications handler must be able to handle this case.  Usually the
threshold is set to a certain percentage like 

	at 80% full send XOFF  to turn off data flow
	at 50% full send XON   to turn it back on

The handler should also adjust the percentage depending upon the data rate (
a higher percentage, like 90%, could be used for a 1200 baud rate, while
at 56Kb, the handler may need to use a 40 or 50% threshold.)

> How much room is left in the input buffer?

This depends upon the implementation.


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+