The OSI Reference Model
Created | Updated Jan 28, 2002
The OSI1 reference model is a way of talking about and reasoning about networks, which splits different functionality into different layers. Each layer uses the layer below in order to provide services to the layer above. There are seven layers in the OSI reference model: Physical, DataLink, Network, Transport, Session, Presentation, and Application. Between them these cover all aspects of the network from the very simplest to the most complicated.
People sometimes talk about these layers by number rather than name, so you might overhear a mention of 'layer three routers' and so forth. It's also worth bearing in mind that this is a conceptual structure, not a hard and fast set of rules. Not all networks are perfectly modelled by the OSI reference model, the relative sizes of each layer may fluctuate wildly, and there are strong disagreements over where particular functionalities of particular networks should be placed. The map is not the territory.
Physical
The physical layer is the very simplest, defining only exactly what a bit is. In other words how to transmit a one or a zero. For example, you would specify at this layer things like what shapes the sockets2 are, what frequencies to broadcast at, and what frequencies are allowed and will not blow up the network cards. In a snail-mail network (ie a network made up of people posting letters to one another), the physical layer is all about how you write and read individual letters of the alphabet.
DataLink
The DataLink is all about getting information from one place to a selection of other places. At this layer you don't need to be able to go everywhere, just able to go somewhere else. So in social contact, you need to know at least one other person, but not necessarily know Fred Jones of Ohio, USA.
This layer is made up of two components. The first component is Logical Link Control. This component determines where one frame of data ends and the next one starts. In a snail-mail network, each letter is one frame of data, and you can tell where it begins and ends because it is inside an envelope. You might also specify that a letter will begin with a phrase like 'Dear Sir', and end with a phrase like 'Yours sincerely'.
The second component is the Media Access Control component. This component determines who is allowed to access the media at any one time. In a network made up of people speaking (ie a conversation), we look for clues from our fellow talkers to see if any of them appear to be about to speak. If two people speak at the same time, they will back off and begin a long and elaborate game of saying 'no, you first'. In the UK Houses of Parliament, the speaker determines who can speak at any time and gets to say 'order' very loudly if anybody breaks the rules.
Network
The network layer deals with transmitting information all the way from its source to its destination - and transmitting things from anywhere you like, to anywhere else you like. If you can't contact a place at the network layer, then you can't contact that place at all. However, it does it in a very basic way, without error detection or flow control, or anything else. Here are some things that the network layer needs to address:
Whether the network is connection-orientated or connectionless - For example, snail-mail is connectionless, because you can send a letter to someone completely out of the blue. On the other hand, the telephone system is connection orientated, because you have to make a connection before you can talk to them.
What are the Global Addresses? - Everybody in the network needs to have a unique address which determines who they are. This address will normally be hierarchical, so you can be 'Fred Bloggs' to Londoners, or 'Fred Bloggs, London' to people in the UK, or 'Fred Bloggs, London, UK' to people anywhere in the world. On the Internet, these addresses are known as IP Numbers.
How do you forward a message? - This is of particular interest to mobile applications, where a user may rapidly move from place to place, and it must be arranged that his messages follow him. IPv4 doesn't really allow for this, though - it has been somewhat 'hacked on' at a later date. Fortunately, the forthcoming IPv6 has a much better designed solution, which should make these kinds of applications much smoother.
On the Internet, IP, or Internet Protocol, sits at this layer. In snail-mail, this is where your beloved postman fits into the picture.
Transport
This layer turns the dodgy and very basic service provided by the network layer into one worthy of the term 'communication'. There is a long list of services that can be optionally provided at this level. None of them are compulsory, because not all applications want all the services available; some can be wasted overhead, or even counterproductive in some cases.
Connection-oriented - This is normally easier to deal with than connectionless models, so where the network layer only provides a connectionless service, often a connection-oriented service is built on top of that in the transport layer.
Same-order Delivery - The network layer doesn't generally guarantee that packets of data will arrive in the same order that they were sent, but often this is a desirable feature, so the transport layer provides it. The simplest way of doing this is to give each packet a number and allow the receiver to reorder the packets.
'Error Free' Data - The underlying network may well be noisy and the data received may not always be the same as the data sent. The transport layer can fix this: typically by providing a checksum of the data that detects if there has been a glitch of some kind. Of course, error free is impossible, but it is possible to substantially reduce the numbers of undetected errors. This layer may also retransmit packets which have gone missing en route.
Flow Control - The amount of memory on a computer is limited, and without flow control a larger computer might flood a computer with so much information that it can't hold it all before dealing with it. Nowadays, this is not a big issue, as memory is cheap while bandwidth is comparatively expensive, but in earlier times it was more important. Flow control allows the receiver to say 'Whoa!' before it is overwhelmed. Sometimes this is already provided by the network, but where it is not, the transport layer may add it on.
Byte Orientation - Rather than dealing with things on a packet-by-packet basis, the transport layer may add the ability to view communication just as a stream of bytes. This is nicer to deal with.
Ports - Ports are essentially ways to address multiple entities in the same location. For example, the first line of a postal address is a kind of port and distinguishes between different occupants of the same house. Computer applications will each listen for information on their own ports, which is why you can use more than one network-based application at the same time.
On the Internet there are a variety of transport services, but the two most common are TCP and UDP. TCP is the more complicated, providing a connection and byte-oriented stream that is almost error free, with flow control, multiple ports, and same-order delivery. UDP is a very simple 'datagram' service, which provides limited error reduction and multiple ports. TCP stands for Transport Control Protocol, while UDP stands for Uniform Datagram Protocol.
Some things, such as connection orientation, can be implemented at either transport or network layer. The idea is that the network layer implements whatever set of options is easiest: for some underlying networks it is easiest to implement connectionless communication, while for others it is easiest to implement connection-oriented communication. The transport layer uses this simplest set of options to implement whatever combination of options is actually desired.
Session
The session layer is typically completely unused, but it does have a few places where it is useful. The idea is to allow information on different streams, perhaps originating from different sources, to be properly combined. In particular, it deals with synchronisation issues, and ensuring nobody ever sees inconsistent versions of data, and similar things.
One application that is fairly intuitively clear is multimedia conferencing. Here, we want to make sure that the streams of audio and video match up - or in other words, that we don't have lip-synch problems. We may also want to do 'floor control' - ensuring that the person displayed on screen and whose words are relayed is the one selected by the speaker, or by some other criteria.
Another big application is in live TV programmes, where streams of audio and video need to be seamlessly merged from one to the other so that we don't have half a second of blank airtime, or half a second when we transmit two pictures simultaneously.
Presentation
The presentation layer is the first one where people start to care about what they're sending at a more advanced level than just a bunch of ones and zeros. This layer deals with issues like how strings are represented - whether they use the Visual Basic method ('13,thisisastring') or the C++ method ('thisisastring/0'). The idea is that the application layer should be able to point at the data to be moved, and the presentation layer will deal with the rest.
Encryption is typically done at this level too, though it can be done at the transport or network layer for higher security. Another example is the representation of structure, which is normally standardised at this level, often by using XML. As well as simple pieces of data, like strings, more complicated things are standardised in this layer. Two common examples are 'objects' in object orientated programming, and the exact way that streaming video is transmitted.
Application
Simply put, the application layer is everything else. This is usually complete applications, but some very high level building blocks are in this layer too. It's difficult to make generalisations, but it can include things like file transfer, file sharing, printer sharing, transfer and receipt of mail, transfer of Web pages, distributed time, and many others.