OSI Model
Blog / OSI Model
So why is the OSI Model such an important computer science concept to understand?TL;DR Summary Layers7. Application Layer 6. Presentation Layer5. Session Layer 4. Transport Layer 3. Network Layer 2. Data Link Layer 1. Physical Layer Real World Example - Sending an EmailLet’s understand the OSI Model by stepping down the layers through a real-world example of sending an email:SummaryThe OSI model is a conceptual framework that standardizes how data is transmitted over a network, and the the modern Internet does not strictly follow the OSI Model. However, understanding the general flow of data through these layers provides a solid foundation for network communication and is well worth understanding.
- The OSI (Open Systems Interconnection) Model is a seven-layer conceptual framework that standardizes how data is transmitted over a network. Each layer serves a specific function, and they work together to enable communication between systems.
- Essentially, it helps different systems communicate by breaking the process into manageable layers, each with specific responsibilities. Lets gets get a deeper understanding by looking at each layer starting from the top.
Don't let one question ruin your next technical interview...
- The application layer is the only layer that directly interacts with user data. It provides protocols and processes that software applications, like web browsers and email clients, use to communicate.
- It is important to note, that applications themselves aren't part of the application layer; they simply rely on it to interpret and display data meaningfully for the user.
- Application layer protocols include HTTP as well as SMTP (Simple Mail Transfer Protocol is one of the protocols that enables email communications).
- The presentation layer ensures data is in a usable format and handles data encryption, compression, and translation.
- And it is responsible for translating data between the application and network format, ensuring compatibility across systems.
- It is important to note that in modern internet communication, encryption (like TLS) is often handled at the transport layer instead.
- The session layer is responsible for establishing, maintaining, and terminating the session between. It will keep the connection alive as long as necessary.
- It is also responsible for synchronizing data exchange and manages session checkpoints to recover from interruptions.
- Layer 4 handles end-to-end communication between devices. It receives data from the session layer, divides it into segments, and then passes these segments to Layer 3.
- Key Protocls include:
- TCP (Transmission Control Protocol): Reliable, ensures all packets are received and in order (e.g email).
- UDP (User Datagram Protocol): Faster but less reliable, used in applications like streaming (e.g. live video streaming).
- The network layer handles logical addressing and routing of data. Determines the best path for data to travel across networks. At this layer, the segments are broken down into packets and assigned IP addresses (source and destination).
- A key protocol is IP (Internet Protocol) which assigns IP addresses and routes packets.
- The data link layer Ensures reliable data transfer across the physical network by managing frame transmission and MAC (Media Access Control) addresses.
- It encapsulates packets into frames, which include MAC addresses for local network communication (e.g., between your computer and the router).
- Packets are converted into electrical signals, light pulses (fiber optics), or radio waves (Wi-Fi) for transmission.
- Defines hardware specifications, including voltage levels, cable types, and transmission rates.
- At the application layer, you compose an email in Gmail and hit "send." Gmail uses SMTP (Simple Mail Transfer Protocol) to prepare the email for transfer.
- The email will be optionally compressed and encrypted using SSL/TLS for secure transmission at the presentation layer (though in modern internet protocols, encryption is often handled at the boundary between the application and transport layers).
- The session layer establishes a session between your computer and Gmail’s mail server, allowing continuous communication until the email is fully sent.
- At the transport layer, TCP (Transmission Control Protocol) segments the email data into smaller chunks called segments, numbers them, and ensures they are delivered reliably and in the correct order.
- Those segments are then broken down into packets at the network layer. Each packet is assigned source and destination IP addresses. Routers use these addresses to determine the best path to the recipient’s mail server.
- The data link layer encapsulates the packets into frames, which include MAC addresses for local network communication (e.g., between your computer and the router).
- Finally, the data is transmitted as electrical signals over Ethernet cables or as radio waves if using Wi-Fi. This layer handles the physical transmission of raw bits across the network.
- Once the email reaches the recipient’s mail server, the data flows back up through the OSI layers on the recipient’s device, starting from the physical layer up to the application layer, where the email is reassembled and displayed in their inbox.
About TechPrep
TechPrep has helped thousands of engineers land their dream jobs in Big Tech and beyond. Covering 60+ topics, including coding and DSA challenges, system design write-ups, and interactive quizzes, TechPrep saves you time, build your confidence, and make technical interviews a breeze.