9

When a Gigabit network adapter is receiving data, how is it receiving the bits? Is it seeing it all in one stream of 0's and 1's? Or is there somehow multiple streams of 0's and 1's coming in at the same time?

For example... let's say there's two sending devices and one receiving device.

Devices 1 and 2 start sending network data to Device 3 at the same time.

My assumption is that from Device 3's Network adapter's point of view, all the 0's and 1's are coming across in a single stream of data. It can figure out what data is from Device 1 or 2, but the data is still just one stream of millions/billions of bits.

Am i totally wrong? :)

  • 1
    Do you mean for a half-duplex connection, or using full-duplex? There were never any half-duplex devices for 1000Base-T, even though it is still in that standard. With a full-duplex connection, there would not be frames from two devices contending for the third device at the same time on the link. – Ron Maupin Oct 17 '18 at 16:52
  • full-duplex. OK, so, there'd still be a single stream of 0's and 1's (ex: 01010101010001010010101001010100001101011010) and from Device 3's point of view (the receiver), while Device 1 and 2 could take turns on that stream, they'd never both be sending 0's and 1's at the exact same time, right? – shihku7 Oct 17 '18 at 16:57
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer. – Ron Maupin Dec 25 '18 at 9:43
14

It depends.

While many Ethernet PHYs transmit data in a purely serial fashion (e.g. 100BASE-TX, 1000BASE-SX, 10GBASE-SR), some split the data stream into multiple lanes that are transmitted in parallel.

Most commonly, 1000BASE-T - the common gigabit-over-copper variant - splits the encoded data stream into four lanes and transmits each separately on one of the four twisted pairs in a Cat-5 cable. All twisted-pair variants from gigabit upwards use these four lanes.

Some high-speed (10G+) fiber PHYs also use multiple lanes over up to sixteen fibers (with multi-mode fiber and short range) or wavelengths (with single-mode fiber and long range).

However, everything is transmitted in frames that each run from a single source to a single destination. Frames are generally atomic, ie. they are always transmitted in one piece. Each frame only transports data from a single specific connection/application. Its header contains source and destination addresses, so it can find its way over the network.

When the network receives two frames from different sources for the same destination port at the same time, one of the frames needs to be queued until the switch port toward the destination has finished transmitting the first frame.

This assumes that sources and destination run at the same speed which isn't necessarily true. You could have a file server connected by a 1 Gbit/s link and ten clients each sending full speed on their 100 Mbit/s links with no (significant) queueing. This comes somewhat close to your "multiple streams" suggestion, only that these streams are interleaved at the frame level, not the bit level.

The rate on a network port can be thousands or even millions of frames in a single second, so from a human perspective it's impossible to differentiate multiple streams - all seems 'simultaneous'.

  • Please get together with other answerer @jonathanjo and figure out which description of 1000Base-T is correct. – davidbak Oct 18 '18 at 2:52
  • 1
    jonathanjo's "same medium" is describing a multiport collision domain which doesn't (practically) exist with Gigabit Ethernet and is obsolete for 10/100 Mbit as well. – Zac67 Oct 18 '18 at 5:11
  • 2
    @davidbak seems all correct here to me -- Zac usually is! -- just different emphasis. I fixed a few things on my answer, including clarifying collisions don't occur in practical 1000baseT. – jonathanjo Oct 18 '18 at 8:59
  • 2
    To that you also have to add PAM16 and similar encodings which make basically multiple bits arrive at one. – PlasmaHH Oct 18 '18 at 9:13
  • 1
    @PlasmaHH 1000BASE-T already uses four lanes and PAM5, so there are roughly 9.3 raw bits in each clock step (and of course 8 "user" bits at 125 MBd for L1). – Zac67 Oct 18 '18 at 12:56
13

Let's ignore the Gigabit part for now, and focus on your "2 devices are sending at the same time" part for a bit.

On shared media, this can actually happen and be a problem. Most wireless transmissions are shared media, and Ethernet, back in the day, used to be:

  • 10base2 (coax) used what was more or less a single cable with every one on it. Obviously, two (or more) stations were able to transmit at the same time;
  • 10baseT and 100baseT (twisted-pair based), with hubs (rather than switches) also meant that two (or more) stations could transmit at the same time, as the signal received from any connected device was just repeated to all others.

Now, if two devices are sending at the same time, two things can happen:

  • you use some form of multiplexing (time division, frequency division...) that allows separate "channels" so that one can listen to a specific channel and not be bothered by the others. This is used a lot for wireless transmissions, much less for wired transmissions (WDM/DWDM on fibres being one exception).

  • or if two or more devices are sending at the same time on the same channel, then you get what is called a collision: like when two people are speaking at the same time, you can't understand what either says, receiving devices are not able to decode the data sent by any of the devices (or more often, they can decode it, but it makes no sense, and will not pass CRC checks).

This is where schemes like CSMA-CD (Carrier-Sense Multiple Access, Collision Detection) came in:

  • Before trying to transmit, a device would check if someone else was sending (carrier sense)
  • If the channel is free, it starts transmitting.
  • But even with that, two devices can start at exactly the same time, so you can still have a collision.
  • To avoid wasting too much time on the channel, the devices would detect collisions (by comparing what they send with what they receive: if it doesn't match, then it means someone else is sending at the same time), abort the transmission, and retry after a random delay (to try to avoid a new collision).

This was quite fun, and on lightly loaded networks it worked quite well, but as soon as traffic became significant, you would end up with tons of collisions, which in turn increase usage of the shared media, which in turns results in more collisions, so it could get pretty bad.

The answer to this was switching to full-duplex switched networks. Hubs just repeated the signal without thinking. Switches on the other hand really receive a frame, and then resend it on the destination link (additional bonus: the frame is not sent to everyone, just to the destination in most cases).

If two devices send to the same destination device, then the switch will queue one of the frames, so the two frames that were sent at the same time actually arrive one after the other at the destination.

Beyond that, on the physical level, it's quite possible data is exchanged over several pairs or even several cables in parallel. Whether this is done at the bit level or entire frames are sent on each pair/cable depends on the exact technology used. But I think that wasn't really your question.

  • 1
    This is an excellent point--probably the most appropriate answer for the question. I might add that as you get to really high speeds (fiber) they are generally restricted to a single sender and single receiver on a line to avoid collisions. If another input needs to be added it is taken in on another channel and combined with the incoming stream then sent to an outgoing stream. These days even ethernet tends to be "Switched" which avoids collisions--the main place you see collisions (2 devices talking to one as in the question) these days is wifi--most everything else is 1 sender to 1 receiver – Bill K Oct 18 '18 at 16:21
12

This particular case is a complex one.

Regarding 1000baseT.

First: when we say in general that two devices are transmitting at the same time, they are not normally actually sending bits at the same instant on the same medium. If they do so, there is a collision and all the listening devices work this out (eventually, through various collision detection schemes.) So two transmitting devices will gain access to the medium at slightly different moments. But in 1000baseT there are only two devices on a given set of pairs; normally one device is a switch and the other is a host.

Second, 1000baseT transmits two data bits at a time on a pair, encoded in a complex way at five voltage levels. So it's a series of base-4 digits on the wire, not a series of base-2 digits.

Third, 1000baseT can transmit in both directions at the same time, on the same pair. It can separate the outgoing signal from the incoming one by a circuit called a hybrid.

Gigabit ethernet over other media behaves differently. Slower speeds eg 10baseT and 100baseT have simpler schemes. 10baseT over a hub really does have actual collisions; over switches it's normally organised by the switch so that outgoing frames are queued; if it's full duplex there are no collisions at all.

  • Please get together with other answerer @Zac67 and figure out which description of 1000Base-T is correct. – davidbak Oct 18 '18 at 2:52
  • @jonathanjo You're right about the three-bit symbols but there's only five PAM levels. Roughly, it's an 8-bit to four 3-bit symbols plus scrambling encoding where the 3-bit symbols are mapped to (shifting) PAM levels. – Zac67 Oct 18 '18 at 5:34
  • @davidbak thanks for picking it up. I simplified the description to cover the main point (complex and not binary) and get rid of the mistake. Thanks Zac for clarifying. – jonathanjo Oct 18 '18 at 8:49
7

Assuming all wired ethernet links here.

When two devices on the same network segment send at the same time, no matter who they send to, that's called a collision. Neither message gets through when a collision happens. Fortunately, senders have the ability to detect collisions. When it happens, each sender will each pick a random amount of time (small fractions of a second) to wait and try again, and repeat the process until eventually only one sender is active.

But this hardly ever happens anymore.

Instead, today most wired connections are made over switched networks, where each device (both senders and receivers) are all connected to their own separate port on a switch. The data is divided up into packets (really: frames), and the switch will make sure only one packet is active on each port at a time. If a link is busy, the switch will store and forward other frames to the receiver when the link is available again.

With this scheme, the only way to have collisions is when either there is more than one device connected to the switch or each other via an unswitched hub (the ports on some models of home wifi "router" are still unswitched), or when a link between a switch and a device operates in half-duplex mode.

What we deal with instead is congestion. We may not have collisions, but a popular host on the network might have devices wanting to send more data and packets than the link will support, such that the buffer fills up. But that's a whole other issue.

  • 1
    Nitpicking, but at the Ethernet level, it would be frames rather than packets. – jcaron Oct 17 '18 at 20:40
  • 1
    @jcaron Nit-nit-picking: Of course normally we use 'packet' to mean 'IP packet', which is organised per RFC 791, and is the 'MAC Client Data' of an Ethernet Frame. But an 'Ethernet packet' is defined as everything transmitted, including the beginning of the preamble to the end of the extension bits; and 'frame' is the portion of that from the destination address to the frame check. (802.3-2015 Section 3.1.1 "Packet Format"). I'd have said the switch ensures one Ether packet is sent at a time, and stores and forwards Ether frames. – jonathanjo Oct 18 '18 at 10:21
5

I think you need to get some basic understanding of how ethernet works. For example, the sending host will send a preamble of alternating ones and zeroes to get the attention of the receiving host. When the receiving host sees two ones in a row, it knows that the frame is next. Once the frame is transmitted, then there must be silence on the line for 96 bits before another frame is sent.

Different ethernet standards will use different encoding. For example, 100Base-T uses 4B5B that sends five bits for every four bits of data.

1

(For this question I assume a Hub shared network.)

Do network adapters read incoming bits in a single stream?

Yes. Regardless of the PHY implementation, it is a single input stream. The communications from multiple devices cannot successfully arrive at a single NIC (MAC Address) at the same time.

My assumption is that from Device 3's Network adapter's point of view, all the 0's and 1's are coming across in a single stream of data"

"single stream" yes, but in your example of two devices sending concurrently there will be no stream of data arriving for further processing; the "frames" of 1s and 0s will collide.

It can figure out what data is from Device 1 or 2, but the data is still just one stream of millions/billions of bits.

Not it cannot. When the signals combine a collision is detected, and the frame is discarded.

Am i totally wrong?

Your question title is a correct statement, but your discussion in your Q post hints that your understanding and hypothesis was wrong.

Further

  • Regardless of the type of "Network Adaptor", they only receive a single stream of bits.
  • The physical means for transmitting a signal could include multiple substreams of data, but those substreams and such physical processing is not considered the "Network Adaptor"; those substreams are codependent, they need to be combined to make sense; and, those substreams must originate from a single source.
  • If you are unsure about this answer (and other answers here), you need to learn the fundamentals of switched packet ethernet/IP networks.
  • For this question I assume a Hub shared network - the OP referred to a Gigabit NIC and half-duplex mode doesn't (practically) exist for GbE. ;-) – Zac67 Aug 9 at 9:03
  • @Zac67 I'm like a generous and helpful stanger. I assumed the OP chose "Gigabit" arbitrarily and that they didn't realize there would be a contradiction. This let me ultimately answer the title of the question directly and simply. The OP can read the other answers to learn more about the contradiction. – Todd Aug 10 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.