Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Software flow control

From Wikipedia, the free encyclopedia
(Redirected fromXON)
Flow control method
"Xon" redirects here; not to be confused withXon (character) orXON (company).
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Software flow control" – news ·newspapers ·books ·scholar ·JSTOR
(March 2009) (Learn how and when to remove this message)

Software flow control is a method offlow control used in computerdata links, especiallyRS-232 serial. It uses special codes, transmittedin-band, over the primary communications channel. These codes are generally calledXOFF andXON (from "transmit off" and "transmit on", respectively). Thus, "software flow control" is sometimes called "XON/XOFF flow control". This is in contrast to flow control via dedicatedout-of-band signals — "hardware flow control" — such asRS-232 RTS/CTS.

Representation

[edit]

For systems using theASCII character code, XOFF is generally represented using acharacter orbyte with decimal value 19; XON with value 17.

The ASCII standard does not reserve anycontrol characters for use as XON/XOFF specifically. However, it does provide four generic "device control" characters (DC1 through DC4). TheTeletype Model 33 ASR adopted two of these, DC3 and DC1, for use as XOFF and XON, respectively. This usage was copied by others, and is now ade facto standard. The keyboard equivalents ofCtrl+S for XOFF, andCtrl+Q for XON, also derive from this usage.

XOFF/XON representations in ASCII
CodeMeaningASCIIDecHexKeyboard
XOFFPause transmissionDC31913Ctrl+S
XONResume transmissionDC11711Ctrl+Q

Mechanism

[edit]

When one end of a data link is unable to accept any more data (or approaching that point), it sends XOFF to the other end. The other end receives the XOFF code, and suspendstransmission. Once the first end is ready to accept data again, it sends XON, and the other end resumes transmission.

For example, one may imagine acomputer sending data to a slowprinter. Since the computer is faster at sending data than the printer can print it, the printer falls behind and approaches a situation where it would be overwhelmed by the data. The printer reacts to this situation by sending XOFF to the computer, which temporarily stops sending data. When the printer is again ready to receive more data, it sends XON to the computer, which starts sending data again.

XOFF/XON can be employed in both directions, for example, twoteleprinters connected to each other.

Comparison with hardware flow control

[edit]

The principal advantage of software flow control is the reduction in the number ofelectrical conductors between sender and receiver. Given acommon ground, only two signals are needed, one to send and the other to receive. Hardware flow control requires additional wires between the two devices. It also requires specific hardware implementation, which had more significant costs in earlier days of computing (i.e., 1960s and 70s).

However, software flow control is not without its problems. The most important drawback is that software flow control is less reliable. Sending XOFF requires at least one character time to transmit, and may be queued behind already-transmitted data still in buffers. Hardware signals may be asserted almost instantaneously, and out-of-order.


Summary of flow control tradeoffs
TypeData integrityLow costOut of Band
Hardware flow controlMost reliableNoYes
On-chip software f.c.GoodSomeNo
Software f.c. (FIFO disabled)Good, but slowYesNo
Software f.c. (FIFO enabled)UnreliableYesNo

As the name "software flow control" implies, flow control using this method isusually implemented in software (orfirmware), which can cause further delays in XOFF response. These delays can lead to data corruption due tobuffer overruns. Hardware flow control, on the other hand, is typically under the direct control of the transmittingUART, which is able to cease transmission immediately, without the intervention of higher levels. To handle the latency caused by builtinFIFOs, more advanced UARTs, like the 16950, provide "on-chip" software flow control.[1] UARTs that lack such support, like the16550, may suffer from buffer overruns when using software flow control, although this can be somewhat mitigated by disabling the UART's FIFO.[1]

Finally, since the XOFF/XON codes are sent in-band, they cannot appear in the data being transmitted without being mistaken for flow control commands. Any data containing the XOFF/XON codes thus must be encoded in some manner for proper transmission, with corresponding overhead. This is frequently done with some kind ofescape sequence. For printing devices that directly interpret ASCII codes, this is not a large problem, because the XON and XOFF codes useASCII "device control" code numbers.

Applications

[edit]

Software flow control is used extensively by low-speed devices, especially olderprinters anddumb terminals, to indicate they are temporarily unable to accept more data. Typically, this is due to a combination of limitedoutput rate and anybuffers being full. Some terminal control packages, such astermcap, employ "padding" (short delays using millisecond granularity[2]) to allow such equipment sufficient time to perform the requested actions without the need to assert XOFF.

XOFF/XON are still sometimes used manually by computer operators, to pause and restart output which otherwise wouldscroll off the display too quickly.

Terminal emulator software generally implements XOFF/XON support as a basic function. This generally includes thesystem console on modernUnix andLinux machines, as well asGUI emulators such asxterm and theWin32 console.

Robust XON is a technique to restart communication, just in case it was stopped by an accidentally received XOFF. The receiving unit sends periodic XON characters when it can receive data, and the line is idle. One common use is by serial printers (likeHP LaserJet II) to indicate they are online and ready to receive data. The XON is sent every 1 to 30 seconds depending on the printer's firmware design.

See also

[edit]

References

[edit]
  1. ^abYang, Casper (2009).The Secrets of Flow Control in Serial Communication(PDF). Moxa Tech Note (1.0 ed.). Moxa Technical Writing Center (published September 30, 2009). Archived fromthe original(PDF) on Aug 4, 2022. RetrievedAug 4, 2022.
  2. ^"The Termcap Library - Describe Padding".www.gnu.org.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Software_flow_control&oldid=1258975753"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp