Session Layer in the OSI Model

Session Layer in the OSI Model
Session Layer


The 'session layer' is responsible for establishing a connection between the source and destination devices, maintaining that connection, and terminating it when necessary. It also facilitates message-mode data transfer.

Functions of the Session Layer:

1. Unique Address Registration for Each Application Process: The session layer can register a unique address for each application process, such as NetBIOS. Through these addresses, the session layer can differentiate each process from the network adapter's address.

2. Connection Management: Using unique process addresses between two processes on different devices, the session layer establishes a connection, maintains it, and disconnects it when required. It creates a virtual circuit that facilitates communication between the two processes on different devices.

3. Identifying Message Boundaries: The session layer can identify the start and end of a message. This ensures that the receiving device's session layer knows whether the entire message has been received. The upper layer won't process the message data until the complete message has been received by the session layer.

4. Message Synchronization: The session layer performs message synchronization. After sending several data packets, the source device's session layer waits for an acknowledgment message (ACK) from the receiver device's session layer. Once the ACK is received, the source continues to send data. This process ensures periodic synchronization of messages.

5. Support for Network Processes: The session layer performs tasks that are necessary for different processes to work over a network, such as verifying usernames and passwords, verifying resource security, etc. The tasks of the session layer can be divided into three main categories. To understand these tasks, we will refer to some examples.


Building, maintaining, and disconnecting a connection:

You want to talk to your friend. So, what will you do? You will dial their telephone number. After the phone rings, they will pick up and say hello. In response, you will also say hello. After both of you say hello, you will be sure that a connection has been established between you, and then you can start talking. You continue speaking, and your friend is listening. Occasionally, you say hello to ensure that they can still hear you. When they say hello, you can be sure that they are listening and you can continue expressing your thoughts. Then, when the conversation ends, you say "Khoda Hafiz" (goodbye) and disconnect the call. The person who makes the ring usually disconnects the call. If it is done from the other end, it would be considered rude.

Just as you establish a connection on the telephone, a connection is established between two devices on a network. For this, the source device's session layer sends a SYN (synchronization) message to the recipient device. In response, the recipient device’s session layer sends an ACK (acknowledgment) message. Upon receiving this, it can be assumed that a session has been established between the two devices.

The session layer of the receiving device negotiates with the session layer of the sending device to establish communication protocols between them. These protocols are developed based on the capabilities of both devices. The protocols include aspects such as the amount of data to be sent at once, the intervals at which data will be sent, and so on.

Once the session and communication protocols are established, data transfer can occur between two devices. The session must be maintained until the data transmission is complete. The session layer ensures this by sending keep-alive messages at regular intervals (like saying "hello" periodically). After the data exchange between the two devices is complete, the session layer must terminate the session or connection. If this is not done, one device might make futile attempts to send data to the other end. It’s like your friend has hung up the phone, but you continue talking.

Dialogue Control

When a device wants to establish a connection, the session layer determines which devices will participate in the communication, how much data will be transmitted at a time, and at what intervals. This is called dialogue control. Three types of dialogue control can be utilized:

  • Simplex
  • Half-Duplex
  • Full-Duplex

In Simplex dialogue control, data flows in only one direction.

In Half-Duplex, data can flow in both directions, but only one direction at a time; the flow alternates.

In Full-Duplex, data flows simultaneously in both directions.

Dialog Separation

When a message is sent, the session layer adds markers along with it. These markers help the source device identify where to retransmit from if a message fails to reach the receiving device correctly. This process of adding markers and retransmitting as needed is called dialog separation.


Presentation Layer of OSI model

Post a Comment

Previous Post Next Post