The Open Systems Interconnection model (OSI) is a conceptual model that characterizes and standardizes the internal functions of a communication system by partitioning it into abstraction layers. The model is a product of the Open Systems Interconnection project at the International Organization for Standardization (ISO), maintained by the identification ISO/IEC 7498-1
In the seven-layer OSI model of computer networking, the physical layer or layer 1 is the first (lowest) layer. The implementation of this layer is often termed PHY. The physical layer consists of the basic networking hardware transmission technologies of a network.
The data link layer is analogous to a neighborhood traffic cop; it endeavors to arbitrate between parties contending for access to a medium, without concern for their ultimate destination. When devices attempt to use a medium simultaneously, frame collisions occur. Data-link protocols specify how devices detect and recover from such collisions, and may provide mechanisms to reduce or prevent them.
While the datalink layer tells packets how to form and arbitrates collisions, the network layer tells packets which roads to take, which station to go to. In the seven-layer OSI model of computer networking, the network layer is layer 3. The network layer is responsible for packet forwarding including routing through intermediate routers.
The transport layer is kind of like a full-service mail room - it seals the envelopes and puts addresses on them, and turns them into a format that the receiver will understand. The transport layer is responsible for delivering data to the appropriate application process on the host computers. This involves statistical multiplexing of data from different application processes, i.e. forming data packets, and adding source and destination port numbers in the header of each transport layer data packet. Together with the source and destination IP address, the port numbers constitutes a network socket, i.e. an identification address of the process-to-process communication.
In the seven-layer OSI model of computer networking, the session layer is layer 5. The session layer provides the mechanism for opening, closing and managing a session between end-user application processes, i.e., a semi-permanent dialogue. It's basically the layer that says, "OK, let's start," and "OK, we're done."