[From the last episode: We saw how a packetA group of bits being sent from one place to another. How big the group is may vary depending on what kind of packet it is. Long messages -- like an email -- will typically be broken up into many packets, each of which travels independently until it gets to the destination, where they're reassembled into the email. comes together, with the original message as the payloadThe main contents of a message. Using an analogy, when you receive a letter in the mail, the letter itself is the payload; the envelope is merely a carrier. and then the other bits and bobs that get added on as it moves through the stackRelated to communications: A way of organizing parts of a complicated process (like communications) so that any task relies on tasks below it and feeds the tasks above it. Related to computing: A place in memory where you store “where was I?” information when you go from, say, one function into another. Before starting a new function, you store where you were in the old one so that, when the new function ends and you’re back in the old one, you can figure out where you were and continue on..]
We saw how to send a message in a packet last week. But, depending on the protocolAn agreed way of doing something. Like a convention, except that protocols tend to be related to processes. being used, some packets have size limits. So… what happens if you have a message that, with all the management stuff attached, will be too big?
Of course, if you’re sending the message, you have no idea how big it might be or should be – and you shouldn’t have to. This is something that the equipment does for you, so go ahead and send that long message – it will go. Here’s what happens when it does.
Break it Up, Break it Up!
We’ll take a simplistic look, since details mostly don’t matter for our discussion. Let’s say that a packet can carry a payload of at most 128 bytes. As a quick reminder, a byteA byte is 8 bits. is 8 bitsThe smallest unit of information. It is a shortened form of "binary digit." Since it's binary, it can have only two values -- typically 0 and 1., and each bit is a 1 or a 0. For English, it used to be that one text character would use roughly one byte. But with the newer scheme that covers more than just English or Latin scripts, it takes two bytes per letter (or other character).
So that means that our payload can be up to 64 characters (in my made-up example). That prior paragraph has 83 characters, so it wouldn’t work.
“But,” you say, “this isn’t for sending prose; it’s for sending commands from machine to machine!” Well, yes, that’s what we’re trying to do, but the same communication schemes handle email, web browsing – even phone texting. The details vary, but the concept still holds.
The texting example is particularly relevant. Texts can be only so long. So what happens if you mess that up? Well, in the old days, your phone would show you how many characters you had left – and you had to pay attention to that. Later, however, phones were – and still are – able to take your too-long text and break it into multiple right-sized texts. The receiving phone puts them back together again.
And that, in a nutshell, is fragmentation. Also referred to as segmentation and reassemblyThis can have two different contexts. For message packets: When the contents of a message are too long for a packet, then the message is fragmented into multiple packets for sending, and those fragments are reassembled on the receiving end of the message. For memory: A situation where free memory is broken up into small pieces throughout the memory rather than accumulated at one spot. This makes it harder to allocate the free memory, since the small pieces may be too small for a new allocation request..
When that happens in our packet scenario, each piece becomes its own packet, with headers and all. The pieces never see each other again until they finally reunite at the final destination. The packets may even travel on different routes to get there – no matter, as long as they come together again.
Keeping Track
This provides an illustration of one of the management things that goes into a packet header. Let’s say you break a message up into 5 smaller packets. And they get wrapped with their headers and signatures and such, and they’re tossed out into the wide world to find their way to the destination. Some go one way, some go another. One might happen to go through a routerAn electronic box that helps steer data on a network. For instance, you may have one in your home connecting your phone and computer and other devices to each other and to the internet. The data itself has information about where it's being sent; the router uses that information to send it in the right direction. At a really basic level, you can think of a router and a switch as being the same thing. If you want to get more technical, a switch creates a local subnetwork, and the router connects multiple subnetworks (or multiple networks). that’s really busy, so it gets stored for a second or so before being processed and sent on to the next hop. In other words, it’s going to get there later than the other ones.
So then all of these bits – as well as other unrelated packets – show up at the final destination. How does that receiving machine put it all together again? After all, it simply sees a bunch of packets coming in, and it can’t tell whether each packet is self-contained or part of a bigger whole.
It can’t, that is, unless you put information in the packet that helps with reassembly. For instance, you’d want an ID for the original (too-long) message; all of the fragments should share that same ID. Then you need an order number so you know which fragment comes first, second, etc.
With those two pieces of information, the receiving end can now put things back in order. If packet 3 arrives first, it will know that it’s not the first of that series, so it can do something to set it aside pending arrival of the earlier pieces. The following video attempts to illustrate this process graphically. (If you haven’t seen last week’s video, i’d encourage you to review that post and its video before this one. It will help this one make more sense.)
Different Sizes in Different Layers
One thing to note here: packet sizes aren’t necessarily the same for all layers. So you might have a longer packet that makes it down as far as, oh, say, the data link layer as a single packet. Then, at that layer, it has to be broken up. In that case, when it gets to the destination, it will be reassembled in the data link layer there and then move back up the stack as a single packet.
With that, we can now move on to different ways that a machine can communicate with one or more other machinesIn our context, a machine is anything that isn't human (or living). That includes electronic equipment like computers and phones..
Leave a Reply