zoukankan      html  css  js  c++  java
  • Network 5: Data Link Layer

      Some important issues related to Data Link Layer:

      

      Ethernet uses CSMA/CD with binary exponential backoff as multiple access control protocol, and stipulates the minimum frame length is 64 bytes.

      以下代码,仅供娱乐。如能运行,纯属巧合。

     1     public void transmit() {
     2         int collisionCnt = 0;
     3         boolean success = false;
     4         Random rand = new Random();
     5         while (!success) {
     6             int idleCnt = 0;
     7             while (idleCnt<96) {
     8                 // sensing the channel
     9                 if (isIdle(channel)) {
    10                     idleCnt++;
    11                 } else {
    12                     idleCnt = 0;
    13                 }
    14                 TimeUnit.BITTIME.sleep(1);
    15             }
    16             start_transmit();
    17             success = true;
    18             while (still_transmitting()) {
    19                 /* collision detection */
    20                 if (collision(channel)) {
    21                     stop_transmit();
    22                     send_jam_signal();
    23                     collisionCnt++;
    24                     int m = Math.min(1<<collisionCnt,10)
    25                     int k = rand.nextInt(m+1);
    26                     TimeUnit.BITTIME.sleep(k<<9);
    27                     success = false;
    28                     break;
    29                 }
    30             }
    31         }
    32     }

      Why does WiFi use CSMA/CA instead of CSMA/CD?

      (1) Most radios are half duplex because the received signal is typically very small compared to the transmitted signal.

      (2) WiFi adapters cannot detect all collisions due to hidden terminal problem and fading.

      区分以下几个概念:

      (1) Router: 处理网络层PCB,划分广播域(BR);

      (2) Switch: 处理链路层PCB,划分冲突域(CR);

      (3) Hub: 处理物理层PCB,大概和中继器差不多。

      Hence, to improve Ethernet performance, switch is used to replace hub, by separating collision domain.

    References:

      1. Kurose, James F., Keith W. Ross. Computer Networking: a top-down approach[M]. 北京:高等教育出版社, 2009-08

      2. Tanenbaum, Andrew S., David J. Wetherall. Computer Networks 5th edition[M]. 北京:清华大学出版社, 2011

  • 相关阅读:
    华为网络层协议介绍
    华为交换机基本原理
    对网络布线与数制转换粗浅认识
    对 计算机网络参考模型新认识
    我对5G的初步认识
    三层交换机单臂路由
    同网段中不同vlan间,客户机从服务器中下载数据
    Telnet远程配置
    华为模拟器里使用RIP协议跨越主类网络边界的实验现象
    7.10 IP地址的格式 以及 网段地址等
  • 原文地址:https://www.cnblogs.com/DevinZ/p/4589865.html
Copyright © 2011-2022 走看看