Practice
Data Structures and Algorithms
Machine Coding Round (LLD)
System Design & Architecture (HLD)
Frontend UI Machine Coding
Resources
Career Advice and Roadmaps
Data Structures and Algorithms
Machine Coding Round (LLD)
System Design & Architecture (HLD)
Backend Development
Frontend Development
Project Ideas for Software Developers
Core Computer Science
Companies
SDE Jobs & Internships
Interview Questions
Compare Companies
IDE
Online IDE
Collaborative IDE

OSI Reference Model | Computer Networks

Ujjwal Abhishek
Ujjwal Abhishek

What is OSI Reference Model?

The Open Systems Interconnection model (OSI model) is a conceptual model that describes how data is transmitted from one system to another system irrespective of distance and location. It consists of seven-layer architecture. All seven layers contribute to the transmission of data from one system to another system. All the seven layers are shown in the diagram below.

 

1. Physical Layer - The Physical Layer is the lowest layer of the OSI model. It is responsible for transmitting individual bits from over a medium. It converts the bits into signals. The bit rate or data rate control is done at the physical layer. It is also responsible for how the actual physical devices are connected. 

Some of the functionalities of the physical layer are:

  • Physical topology - It defines the arrangement of the devices in a network.
  • Data rate - Data rate or the number of bits sent per second is controlled by the physical layer.
  • Transmission mode - It is the data flow between two devices. It is of three types.
  1. Simplex - Data flows in one direction only.
  2. Half-duplex - Data flows in both directions but not at the same time.
  3. Full-duplex - Data flows in both directions at the same time.

2. Data Link Layer -The data link layer acts as a link between two nodes and transfers data or frames from one node to another node. Frames are created by the data link layer. It is the responsibility of the data link layer to transfer the error-free data from one node to another node.

It is divided into two sub-layers.

  1. Media Access Control (MAC) - It is responsible for controlling devices' access to a medium.
  2. Logical Link Control (LLC) - It is responsible for frame synchronization, identification of network layer protocol, and error control.

Some of the functionalities of the data link layer are:

  • Framing - The data in the form of bits are grouped in packets called frames. Frames are made identifiable to the receiver by attaching special bit patterns as the header or trailer of the frame.
  • Physical Addressing - The data link layer adds the MAC address ( physical address ) of the sender and the receiver for the smooth transmission of the data.
  • Flow Control - Flow control is necessary for saving the data from being corrupted. It is done by maintaining the constant data rate on both sender and receiver ends.
  • Error Control - This is the function of the data link layer to transfer the non-erroneous data. The erroneous data are traced and retransmitted by the data link layer.
  • Access Control  - The data link layer helps to determine which device has control over a link shared by multiple devices.

3. Network Layer - The Network Layer is responsible for transferring the data from the source to the destination by routing it through the intermediate nodes. Among the different possible paths, it chooses the best possible path to transfer the data from source to destination. 

Some of the functionalities of the network layer are:

  • Packetizing - If the message to be is large to be transmitted, it is split into several fragments and then delivered independently and reassembled at the destination node.
  • Logical Addressing - The network layer adds the IP address of the source and destination to the header of the frames for its identification among all the devices.
  • Routing - The best possible path is chosen by the network layer for the transfer of the data from source to destination and this is called routing.

4. Transport Layer - The transport layer creates various smaller units called segments out of the message received from the application layer. It adds source and destination port numbers in the header for the right transfer of the data. The main responsibility of the transport layer is the end-to-end delivery of the message and to ensure flow and error control.

Some of the functionalities of the transport layer are:

  • Segmentation - The message received from the upper layer is divided into smaller units called segments and is reassembled at the destination by the transport layer.
  • Port Addressing - The source and destination port numbers are added to the header for the correct handover of the data.
  • Connection Control - There can be two types of services between two devices
  1. Connection-Oriented - In this, the connection is established for the data transmission and is disconnected after the transmission.
  2. Connectionless - It is less reliable and faster and doesn't require establishing a connection before data transmission.
  • Error Control - It checks for erroneous data and retransmits the data on a failed delivery.

5. Session Layer - The main responsibility of the session layer is to establish, maintain and synchronize the communication among the devices. It allows communication either in half-duplex or full-duplex. It synchronizes the communication between the devices to avoid data loss.

Some of the functionalities of the session layer are:

  • Dialog Control - It allows communication between two systems in half-duplex or full-duplex.
  • Synchronization - It allows a process to add checkpoints to avoid data loss during a crash.

6. Presentation Layer - The presentation layer establishes context between application layer entities. The main responsibility of the presentation layer is concerning the syntax and semantics of the data exchange between the devices. It transforms data into the form that the application accepts. It is also sometimes called the syntax layer.

Some of the functionalities of the presentation layer are:

  • Translation - It is the conversion of the data into a commonly acceptable format.
  • Encryption - Encryption is done to secure the data from unauthorized access. The data is converted into a different code that is not understandable and is decrypted into an understandable form at the receiver's end.
  • Compression - Compression means compressing the data that is reducing the number of bits that need to be transmitted. It is helpful in the transfer of multimedia messages.

7. Application Layer - This is the closest layer to the end-user. It interacts directly with the software application. It acts as a window for the user and the software applications to access network services. It handles identifying communication partners and determining resource availability.

Some of the functionalities of the application layer are:

  • File transfer and access management - This allows the user to access the files on a remote computer.
  • Mail services - It provides access to send or receive email.
Ujjwal Abhishek
Ujjwal Abhishek
Ujjwal is final-year CSE Undergraduate, a competitive coder, and a web developer passionate about problem-solving and data structures and algorithms.
SDE Bootcamp - Become a software engineer at a product-based company
Practice Data Structures & Algorithms
Learning Resources
Interview Prep Resources
Community
Join our community
Blog
  • Career Advice and Roadmaps
  • Data Structures & Algorithms
  • Machine Coding Round (LLD)
  • System Design & Architecture
  • Backend Development
  • Frontend Development
  • Awesome Project Ideas
  • Core Computer Science
Practice Questions
  • Machine Coding (LLD) Questions
  • System Design (HLD) Questions
  • Topic-wise DSA Questions
  • Company-wise DSA Questions
  • DSA Sheets (Curated Lists)
  • JavaScript Interview Questions
  • Frontend UI Machine Coding Questions
Online Compilers (IDE)
  • Online Java Compiler
  • Online C++ Compiler
  • Online C Compiler
  • Online Python Compiler
  • Online JavaScript Compiler
Topic-wise Problems
  • Dynamic Programming Interview Questions
  • Linked List Interview Questions
  • Graph Interview Questions
  • Backtracking Interview Questions
  • Arrays Interview Questions
  • Trees Interview Questions
Company-wise Problems
  • Amazon Interview Questions
  • Microsoft Interview Questions
  • Google Interview Questions
  • Flipkart Interview Questions
  • Adobe Interview Questions
  • Facebook Interview Questions
DSA Sheets (Curated Lists)
  • Top Interview Questions
  • FAANG Interview Questions
  • Most Asked Interview Questions
  • 6 month DSA Practice Sheet
  • 3 month DSA Practice Sheet
  • Last minute DSA Practice Sheet