One of the greatest joys of riding on the subway is to sit in the front of the train and look out ahead. While many rapid transit lines do not allow this by preventing passengers from sitting in the area next to the motorman's cab, many still do. I have fond memories of my times riding in the front of a Toronto subway train looking out at the track ahead. One of the things that can be seen in front of the train are signals that look a lot like traffic lights. What do they mean?
First, subway (and indeed all train) tracks are divided into sections called blocks. On older tracks, blocks are static in location, while on newer tracks they may be movable depending on the location of trains. In any case, with few exceptions (mostly in yards) only one train is allowed on a block at any one time. Thus, the colors of the signals tell the train operator the status of the track ahead. Rapid transit blocks are usually only a couple of hundred yards long, although blocks on lightly used rural railroads may be several miles long.
Block length is determined by a wide variety of factors, including the maximum speed of the line, the maximum speed of different types of trains, the gradient of the line, braking characteristics of different types of trains, sightlines, and driver reaction time. Shorter blocks would also allow a higher frequency of train operation. Indeed, transit agencies often attempt to save money on the initial construction of a subway line by having fewer blocks (and therefore less equipment to buy) only to find out that when capacity requires a headway decrease expensive upgrades to the signaling system are necessary before such an upgrade can proceed.
A green signal indicates that at least the next two blocks are clear of trains. A yellow signal indicates that while the next block is free of trains, there is a train in the block after. A red signal indicates that there is a train in the next block. Virtually all rapid transit systems have devices that will automatically apply the emergency brakes of all trains that pass a red signal without authorization from the control tower; this from of passive train control is being quickly overtaken by positive train control where all vehicle movement can be controlled by the control tower (a feature that already exists on BART and Washington Metro).
Sometimes a "lunar" white light can be seen under the usual lights. When the white light is seen it means that the other light colors are not determined by the presence of other trains but by the current train itself. For example, in something known as "Grade Time" (GT) the default state of the signal will be red but will change to green if approached at a certain (slow) speed. The red light will start flashing just before it turns green - in my experience many Toronto subway operators take pleasure in passing a signal as close to when the signal turns green as possible. GT signals are important to avoid derailment if a curve is taken at too high of a speed. In addition to GT signals, some stations may have "Station Time" (ST) signals. ST signals are used for headway control , and will turn green once enough time has passed since the last train left the station.
When there is a junction, two sets of lights will be present. The top set of lights functions as described above: green means proceed, yellow means caution, etc. The bottom sets of lights informs the operator which path will be taken. Green means the straight path will be taken, while yellow means the angled path will be taken. Red on the bottom section means that the driver should stay at this location, and would usually be seen on sidings where "gap" trains wait to be inserted into service. In certain cases one might see red on the top section, red on the bottom section, and orange at the bottom where the lunar white light usually resides. This result means that the signal will stay red but the train operator may pass the red signal.
Rapid transit lines with automatic train control (like the aforementioned BART and Washington Metro as well as Vancouver's SkyTrain) do not have track-side signals, but in the event automatic train control fails and the train has to be operated manually "virtual" signals appear on the console in the operator's cab. As additional rapid transit lines get converted to automatic train control (the Toronto Transit Commission plans to do so in the next ten-fifteen years) expect to see rapid transit line signals to slowly disappear.