The session layer allows users on different machines to establish sessions
between them. A session allows ordinary data transport, as does the transport layer, but it also provides some enhanced services
useful in a some applications. A session might be used to allow a user to log into a remote time-sharing system or to transfer
a file between two machines.
One of the services of the session layer is to manage dialogue control. Sessions can allow traffic to go in both directions
at the same time, or in only one direction at a time. If traffic can only go one way at a time, the session layer can help
keep track of whose turn it is.
A related session service is token management. For some protocols, it is essential that both sides do not attempt the same
operation at the same time. To manage these activities, the session layer provides tokens that can be exchanged. Only the
side holding the token may perform the critical operation.
Another session service is synchronization. Consider the problems that might occur when trying to do a two-hour file transfer
between two machines on a network with a 1 hour mean time between crashes. After each transfer was aborted, the whole transfer
would have to start over again, and would probably fail again with the next network crash. To eliminate this problem, the
session layer provides a way to insert checkpoints into the data stream, so that after a crash, only the data after the last
checkpoint has to be repeated.