Have you ever wonder whether we can download and upload simultaneously?
Sometimes, we may listening the music online and chat with our friends, but that doesn’t really means download and upload at exact the same time. Because the the computer is faster than human being so much, if it switch its job fast enough, we can’t really tell the differences. This is the where ‘Concurrency’ and ‘Parallelism’ in computer science originates.
Before we start answering this questions, we need to introduce some terminology in network.
Duplex vs Simplex
Duplex means data can be sent in both direction of a communication system, while simplex means data can only be sent in one direction.
You can take the differences as normal street vs one-way street.
Full Duplex vs Half Duplex
Full duplex means data is sent in both direction at the same time (so we can rephrase our first question into: is our network full duplex?), while half duplex, like a single-plank bridge, you can sent in both direction, but not same time.
In order to answer our question, we need more info actually. That is, how we access the network, which also influences the answer to our question. The WiFi and Ethernet is two common forms to use network, so we focus on them.
WiFi
WiFi is a generic term for bunch of wireless protocols. The answer for WiFi is no. Because the following explanation:
WiFi devices wirelessly connect to the router using radio waves at 2.4GHz or at 5GHz. The router schedules and makes sure the correct information flows between each connected device and the Internet; without collision and loss; by a process call Time Division Duplexing (TDD) to behave like full-duplexing.
As we can see, every information is scheduled in different time slices to avoid collision, which, in terminology, is called CSMA/CA (carrier sense multiple access and collision avoid). Our packet of data for download and upload also share the media, but only one packet at the same time. In conclusion, WiFi is half-duplex.
Ethernet
The Ethernet has a similar terminology called CSMA/CD (collision detection). It sounds like even the Ethernet can’t be duplex, but we can dive deeper.
The modern Ethernet use a cable called twisted pair wires in which two conductors twisted in pairs:
The wired portion of the LAN communicates at full-duplex with two pairs of twisted wires forming the ethernet cable connection. Each pair is dedicated to transmit and receive information packets simultaneously, hence no collision of data and no interference.
The upper cites solve our question, but what does CSMA/CD mean?
In a modern Ethernet, the stations do not all share one channel through a shared cable or a simple repeater hub; instead, each station communicates with a switch, which in turn forwards that traffic to the destination station. In this topology, collisions are only possible if station and switch attempt to communicate with each other at the same time, and collisions are limited to this link. Furthermore, the 10BASE-T standard introduced a full duplex mode of operation which became common with Fast Ethernet and the de facto standard with Gigabit Ethernet. In full duplex, switch and station can send and receive simultaneously, and therefore modern Ethernets are completely collision-free.
Here, we can understand that it is because in early year, multiple station connect to same cable, which may cause collision. And now, every station connect to router/switch directly, so is collision free.
Conclusion
When we using WiFi, we can’t download and upload at the same time, but using Ethernet can.
What the use of knowing that? Maybe you can plug in a Ethernet cable rather than using WiFi when you play game and the latency is so high. Maybe you can understand why speed of your WiFi is so slow.
Ref
Written with StackEdit.
评论
发表评论