What is OSI Model?
The OSI model, or Open Systems Interconnection model, is a way of thinking about computer networking (specifically, the functionality and protocols that comprise it) as different layers of abstraction.
There are 7 layers: physical, data-link, network, transport, session, presentation and application. The layers build on one another, so each layer depends on the functionality of lower layers, and provides functionality to the layers above it.
Admittedly (at the time of writing this), networking isn’t something I know in-depth… yet. I have an EE degree and am searching out the CS concepts that I haven’t picked up by osmosis or studying during my time as a programmer. My takeaway so far is that the OSI Model is a nice taxonomy for understanding how computer networking happens. But… it doesn’t necessarily buy you anything in “real life”. It’s more of a compass than a detailed map.
Communicating with another computer is a much more involved involved process than you might think. Sleek, modern technology and UX hides a lot of the complexity from us as users.
But, as programmers, we need a way of reasoning about the complicated and interrelated set of protocols used for devices to communicate with one another.
By separating these protocols into layers of abstraction, we can reason about the system a little bit easier. It also gives us a shared model to talk about when discussing things with other programmers. If/when new protocols are developed, there’s a taxonomy to add them into (the OSI model).
A not-quite-perfect analogy might be bodily systems. There’s the nervous system, skeletal system, muscular system, and so on. They each have their own set of functions, and interact with other systems. When you want to do a certain task (for example, move your arm), the systems must communicate with one another to execute that task. For example, the nervous system might tell the muscular system to engage in a certain way to change the positioning of your arm.
Like the OSI model, some systems require other systems to serve underlying functions. For example, the muscular system would have a tough time without the framework of the skeletal system. Similarly, some systems serve higher-order systems, like how the muscular system relies on the nervous system to provide electrical signals and tell it what to do.
Of course, this isn’t a perfect metaphor. For instance, the body systems example isn’t as strictly hierarchical as the OSI model. Still, it helped me understand the point of the OSI model.
What would be a convenient and logical way to sort out the many parts required to make this whole “networking” thing, well, work?
There are seven layers, with the first layer (physical) being shown at the bottom and the seventh layer (application) being shown at the top, like so:
All seven layers must be implemented for someone to send or receive data (ex: you are browsing the internet or emailing from your computer). Routers are responsible for sending data packets to and from networks but don’t care what’s actually in the packets, so routers only need to implement up to the first three layers of the OSI model (physical, data-link and network).
The physical layer is the actual physical connection between the two network nodes (computers, etc.) trying to communicate. This layer describes the transmission of raw bit streams, which are physically manifested as pulses of electricity or light.
This layer describes the physical medium being used, including hardware: connectors, cable types, etc. and voltage levels, data rates, etc.
In short, the physical layer describes the physical infrastructure needed to make communication possible.
Examples: DSL, fiber optic cables, etc.
The data-link layer describes how bitstreams are grouped into frames and actually transmitted over the physical layer described previously. It is responsible for communication between two connected network nodes. Network switches operate at this layer.
There are two sublayers: Logic Link Control (LLC) and Media Access Control (MAC).
The physical layer (beneath the data-link layer) transports data as bits; the network layer (the layer above the data-link layer) transports data as packets. The data-link layer groups bits and then transports this data as frames. The LLC sublayer synchronizes these frames, does detection and handling of errors created at the physical layer, and flow control.
The MAC sublayer handles physical addressing, and regulates communication such that nodes are not transmitting data at the same time. Switches operate on this level, and keep a record of all of the MAC addresses of the devices on that network.
Example protocols: Ethernet, IEEE 802.11 wireless LAN
The network layer is responsible for passing information between the bottom two layers (physical and data link) and the higher layers. It provides addressing and routing.
Routers operate at this level. Routers can move packets from network nodes that are not directly connected (meaning that they have to be routed through other network nodes to arrive at their final destination).
This means that the network layer is concerned with finding the best available paths from one network to another (logical addressing, routing, traffic control), and ensuring that the data arrives at its destination (splitting up and reassembly packets of data, reporting errors, etc.).
Example protocol: IPv4/IPv6
The transport layer ensures delivery of messages between systems, and handles reliability- and efficiency-related concerns so higher layers don’t have to.
The transport layer is like the traffic cop for the network layer. It makes sure that each node can start the data transfer process. The transport layer also handles traffic flow to reduce network congestion. It lost or duplicate packets, and does error-checking and recovery.
Encryption and firewalls happen on this layer.
Example protocol: Transmission Control Protocol (TCP)
The session layer establishes and maintains connections between two network applications. Request and response communication happens at this layer, and this is the first layer where the concept of “client” and “server” exists.
This layer handles connections being established, managed, restarted, gracefully terminated. Information can be transmitted either simultaneously, in both directions at once (full duplex) or sequentially, with each direction taking a turn (half duplex).
Example protocols include: Network Basic Input Output System (NetBIOS), Short Message Peer-to-Peer (SMPP),
The presentation layer presents data to applications in a syntax that they can understand. In other words, it provides compatibility for the application layer to function. Data encryption, decryption, and compression also happens at this layer.
This layer must translate information into formats that the application layer can understand (like HTML). The presentation layer provides a mapping between different application-layer formats.
The application layer is the user-facing layer. It is the interface between network protocols and the software the the user interacts with.
Example application protocols include: File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), Internet Message Access Protocol (IMAP), and Hypertext Transfer Protocol (HTTP)
- Top Best Keylogger in Python 3 Make One
- What is Hacking?
- Secrets of the Deep Dark Web
- CODECHEF September Lunchtime 2020 SOLUTIONS
- August Lunchtime 2020 SOLUTIONS
June Long Challenge 2021 Solutions
- Maximum Frequent Subarray Sum solution codechef
- Dual Distance solution codechef
- Optimal Xor Set solution codechef
- Minimum Subtree Cover solution codechef
- Minimum Dual Area solution codechef
- Bitwise Tuples solution codechef
- Shortest Route solution codechef
- Bella ciao solution codechef
- Summer Heat solution codechef
March Long Challenge 2021 Solutions
- An Interesting Sequence ISS SOLUTION
- Tree House THOUSES SOLUTION
- Valid Paths VPATH SOLUTION
- Modular Equation MODEQ SOLUTION
- Tic Tac Toe TCTCTOE SOLUTION
- Xor Equality XOREQUAL SOLUTION
- Golf LKDNGOLF SOLUTION
- Solubility SOLBLTY SOLUTION
April Long Challenge 2021 Solutions
- Chef and Dice SDICE Solution
- Worthy Matrix KAVGMAT Solution
- Binary String MEX MEXSTR Solution
- Boolean Game BOOLGAME Solution
- Tree Permutations TREEPERM Solution
- Destroy the EMP Chip CHAOSEMP Solution
- Chef and Pair Flips PAIRFLIP Solution
- String Power STRPOW Solution
- Brahma and Shiva SHRINES Solution
- Water Sort Puzzle (Challenge) WTRSORT Solution
- World Record BOLT Solution
- Strong Language SSCRIPT Solution
- Valid Pair SOCKS1 Solution
Codechef Long Challenge Solutions
February Long Challenge 2021
- 1. Frog Sort Solution Codechef
- 2. Chef and Meetings Solution Codechef
- 3. Maximise Function Solution Codechef
- 4. Highest Divisor Solution Codechef
- 5. Cut the Cake Challenge Solution Codechef
- 6. Dream and the Multiverse Solution Codechef
- 7. Cell Shell Solution Codechef
- 8. Multiple Games Solution Codechef
- 9. Another Tree with Number Theory Solution Codechef
- 10. XOR Sums Solution Codechef
- 11. Prime Game Solution CodeChef
- 12. Team Name Solution Codechef
January Long Challenge 2021
- Chef and Division 3 DIVTHREE SOLUTION Code Chef
- Encoded String DECODEIT SOLUTION Code Chef
- Point Of Impact BILLRD SOLUTION Code Chef
- Fair Elections FAIRELCT SOLUTION Code Chef
- Watching CPL WIPL SOLUTION Code Chef
- Chef and Ants ANTSCHEF SOLUTION Code Chef
- Blackjack BLKJK SOLUTION Code Chef
- And-Or Game ORAND SOLUTION Code Chef
- Stack-Queue Sort (Challenge) SQSORT SOLUTION Code Chef
- Expected Number of SCCs RCTEXSCC SOLUTION Code Chef
- Curious Matrix CURMAT SOLUTION Code Chef
- Cool Subsets COOLSBST SOLUTION Code Chef
- Sequence Creation ARCRT SOLUTION Code Chef
- Greedy Students GRDSTD SOLUTION Code Chef
November Challenge 2020 SOLUTION CodeChef
- Ada and Dishes SOLUTION ADADISH
- Iron Magnet and Wall SOLUTION FEMA2
- Magical Candy Store SOLUTION CNDYGAME
- Unusual Queries SOLUTION UNSQUERS
- Red-Black Boolean Expression SOLUTION RB2CNF
- Chef and the Combination Lock SOLUTION CHEFSSM
- Scalar Product Tree SOLUTION SCALSUM
- Connect on a Grid (Challenge) SOLUTION CONGRID
October Lunchtime 2020 CodeChef SOLUTIONS
- AND Plus OR SOLUTION ANDOR
- Chef and Subtree MEXs SOLUTION SUBMEXS
- Chef Likes Good Sequences SOLUTION GSUB
- Cute Chef Gift SOLUTION COPAR
- Chef Is Just Throwing Random Words SOLUTION SSO
- Counting Spaghetti SOLUTION CDSUMS
- Chef and Edge Flipping SOLUTION EFLIP
- A. Shandom Ruffle SOLUTION
- B. Pear TreaP SOLUTION
- C. Sneetches and Speeches 3 SOLUTION
- D. The Grim Treaper SOLUTION
- Y. Sneetches and Speeches 1 SOLUTION
- Z. Trick or Treap SOLUTION
- A. Floor Number SOLUTION CODE FORCES
- B. Symmetric Matrix SOLUTION CODE FORCES
- C. Increase and Copy SOLUTION CODE FORCES
- D. Non-zero Segments SOLUTION CODE FORCES
- E. Rock, Paper, Scissors SOLUTION CODE FORCES
- F. Number of Subsequences SOLUTION CODE FORCES
- Chef and Easy Queries SOLUTIONS CHEFEZQ
- Covid Run SOLUTIONS CVDRUN OCTOBER CHALLENGE
- Positive AND SOLUTIONS POSAND
- Replace for X SOLUTIONS REPLESX
- Village Road Network SOLUTIONS VILLNET
- Random Knapsack SOLUTIONS RANDKNAP
- D-Dimensional MST SOLUTIONS DDIMMST
- Compress all Subsegments SOLUTIONS SEGCOMPR
- Adding Squares SOLUTIONS ADDSQURE
- Inversions SOLUTIONS INVSMOD2 OCOTBER CHALLENGE
- Rooted Minimum Spanning Tree SOLUTIONS ROOTMST