Next Previous Contents

13. One Step Further...

This section is not required reading, but may give you some further insight into Unix, and the world of telecommunications.

13.1 What Are Lock Files?

Lock file are simply a file saying that a particular device is in use. They are kept in /usr/spool/uucp, or /var/lock. Linux lock files are named LCK..name, where name is either a device name, or a UUCP site name. Certain processes create these locks so that they can have exclusive access to devices. For instance if you dial out on your modem, a lock will appear telling other processes that someone is using the modem already. Locks mainly contain the PID of the process that has locked the device. Most programs look at the lock, and try to determine if that lock is still valid by checking the process table for the process that has locked the device. If the lock is found to be valid, the program (should) exit. If not, some programs remove the stale lock, and use the device, creating their own lock in the process. Other programs just exit and tell you that the device is in use.

13.2 ``baud'' Vs. ``bps''

``baud'' and ``bps'' are perhaps one of the most misused terms in the computing and telecommunications field. Many people use these terms interchangeably, when in fact they are not!

baud

The baud rate is a measure of how many times per second a signal, for instance one sent by a modem (modulator-demodulator) changes. For example, a baud rate of 1200 implies one signal change every 833 microseconds. Common modem baud rates are 50, 75, 110, 300, 600, 1200, and 2400. Most high speed modems run at 2400 baud. Because of the bandwidth limitations on voice-grade phone lines, baud rates greater than 2400 are harder to achieve, and only work under very pristine phone line quality. Multiple bits can be encoded per baud, to get bit rates that exceed the baud rate. ``baud'' is named after Emile Baudot, the inventor of the asynchronous telegraph printer.

bps

The bps rate is a measure of how many bits per second are transmitted. Common modem bps rates were formerly 50, 75, 110, 300, 1200, 2400, 9600. Today they are 14.4K, 28.8K, 33.6K, and 56K (these do not correspond to the rates over the serial-port-to-modem cable which are in addition to the old modem bps rates (50-9600): 19.2K, 38.4K, 57.6K and 115.2K). Using modems with V.42bis compression (max 4:1 compression), rates up to 115.2K bps are possible. This is what most people mean when they misuse the word ``baud''.

So, if high speed modems are running at 2400 baud, how can they send 14400 bps (or higher)? The modems achieve a bps rate greater than baud rate by encoding many bits in each signal change, or phase change. Thus, when 2 or more bits are encoded per baud, the bps rate exceeds the baud rate. If your modem connects at 14400 bps, it's going to be sending 6 bits per phase change, at 2400 baud.

How did this confusion start? Well, back when antique low speed modems were high speed modems, the bps rate actually did equal the baud rate. One bit would be encoded per phase change. People would use bps and baud interchangeably, because they were the same number. For example, a 300 bps modem also had a baud rate of 300. This all changed when faster modems came around, and the bit rate exceeded the baud rate.

13.3 What Are UARTs? How Do They Affect Performance?

UARTs (Universal Asynchronous Receiver Transmitter) are chips on your PC serial board (if you have one) or on the motherboard. The UART function may also be done on a chip that does other things as well. The UART's purpose is to convert data to bits, send the bits down the serial line, and then rebuild the data again on the other end. UARTs deal with data in byte sized pieces, which is conveniently also the size of ASCII characters.

Say you have a terminal hooked up to your PC. When you type a character, the terminal gives that character to it's transmitter (also a UART). The transmitter sends that byte out onto the serial line, one bit at a time, at a specific rate. On the PC end, the receiving UART takes all the bits and rebuilds the byte and puts it in a buffer.

There are two different types of UARTs. You have probably heard of dumb UARTs - the 8250 and 16450, and FIFO UARTs - the 16550A. To understand their differences, first let's examine what happens when a UART has sent or received a byte.

The UART itself can't do anything with the data, it just sends and receives it. For the original UARTS, the CPU gets an interrupt from the serial device every time a byte has been sent or received. The CPU then moves the received byte out of the UART's buffer and into memory somewhere, or gives the UART another byte to send. The 8250 and 16450 UARTs only have a 1 byte buffer. That means, that every time 1 byte is sent or received, the CPU is interrupted. At low rates, this is OK. But, at high transfer rates, the CPU gets so busy dealing with the UART, that is doesn't have time to tend to other tasks. In some cases, the CPU does not get around to servicing the interrupt in time, and the byte is overwritten, because they are coming in so fast.

That's where the 16550A UARTs are useful. These chips come with 16 byte FIFOs. This means that it can receive or transmit up to 14 bytes before it has to interrupt the CPU. Not only can it wait, but the CPU then can transfer all 14 bytes at a time. Although the interrupt threshold is not always set at 14, this is still a significant advantage over the other UARTs, which only have the 1 byte buffer. The CPU receives less interrupts, and is free to do other things. Data is not lost, and everyone is happy. (There is also a 16550 UART, but it is treated as a 16450 since it is broken.)

In general, the 8250 and 16450 UARTs should be fine for speeds up to 38400 bps. At speeds greater than 38400 bps, you might start seeing data loss. Other PC operating systems (definition used loosely here), like DOS aren't multitasking, so they might be able to cope better with 8250 or 16450s. That's why some people don't see data loss, until they switch to Linux.

Non-UART, and intelligent multiport boards use DSP chips to do additional buffering and control, thus relieving the CPU even more. For example, the Cyclades Cyclom, and Stallion EasyIO boards use a Cirrus Logic CD1400 RISC UART, and many boards use 80186 CPUs or even special RISC CPUs, to handle the serial I/O.

Keep in mind that these dumb UART types are not bad, they just aren't good for high speeds. You should have no problem connecting a terminal, or a mouse to these UARTs. But, for a high speed modem, the 16550A is definitely a must.

Most newer PC's (486's, Pentiums, or better) come with 16550A's. If you have something really old you may be able to upgrade it by buying 16550A chips and replacing your existing 16450 UARTs. If the functionality has been put on another type of chip, you are out of luck. If the UART is socketed, then upgrading is easy (if you can find a replacement). The new and old are pin-to-pin compatible. It may be more feasible to just buy a serial board from the Internet (few retail stores stock them today).


Next Previous Contents