Instruction chapter1(computer networks)

本文是计算机网络学习笔记,介绍了计算机网络与分布式系统的区别,阐述其商业、家庭、移动用户等应用场景及社会问题。还讲解了网络硬件,如个域网、局域网等,以及网络软件的协议层次结构等内容,最后列举了因特网、第三代移动电话网络等网络实例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Instruction  chapter1(computer networks)

大量相互独立但彼此连接的计算机共同完成任务,这些系统称作计算机网络。

如果两台计算机能够交换信息,则称这两台计算机是相互连接的

区分:计算机网络和分布式系统

两者的关键差别在于,由一组独立计算机组成的分布式系统呈现给用户的是一个关联系统。一般来说,在用户看来,分布式系统只是一个模型或泛型。通常在操作系统之上有一层软件负责这个模型,这个软件就称为中间件。最著名的分布式系统例子是万维网。万维网运行在Internet上,这个模型的所有一切都表现得像是一个文档(Web页面)一样。

在计算机网络中,这种一致性,模型以及软件都不存在。

实际上,分布式系统是建立在网络上的软件系统。

网络和分布式系统之间的区别在于软件(特别是操作系统),而不是硬件。

 

  • Uses of Computer Networks

    Network Hardware

    Network Software

    Reference Models

    Example Networks

    Network Standardization

    Metric Units


1.1 Uses of Computer Networks

Computer networks are collections of autonomous computers, e.g., the Internet

They have many uses:

Business Applications »

Home Applications »

Mobile Users »

These uses raise:

Social Issues »

This text covers networks for all of these uses

1.1.1 Business Applications

Companies use networks and computers for resource sharing with the client-server model:

电子邮件

IP电话:员工们之间可以通过计算机网络打电话,而不必再通过电话公司。

如果采用了Internet技术则称为IP语音(VoIP,Voice over IP)

电子商务

Client:客户   Server:服务器     Browser 浏览器

C/S  客户机-服务器模型

如果我们更仔细地考察客户机-服务器模型,可以看到该模型涉及两个进程,一个位于客户机器上,另一个位于服务器机器上。双方的通信形式是这样的:客户机进程通过网络将一个消息发送给服务器进程,然后客户机进程等待应答消息;当服务器进程获得了该请求消息后,它就执行客户所请求的工作,或者查询客户所请求的数据,然后发回一个应答消息。

对比 B/S  

VPN:虚拟专用网络 Visual Private Networks。VPN的目标是试图终结“地理位置的束缚”。

 

1.1.2 Home Applications

Homes contain many networked devices, e.g., computers, TVs, connected to the Internet by cable, DSL, wireless, etc.

Home users communicate, e.g., social networks, consume content, e.g., video, and transact, e.g., auctions

Some application use the peer-to-peer model in which there are no fixed clients and servers:

Some forms of e-commerce.(to 和 2 同音)

RFID(射频识别):无源芯片(无电池)RFID读写器可以定位数米范围内的物品,并与之通信,具体的都区范围取决于RFID的类型。

它们可能将现实世界变成物联网。

1.1.3 Mobile Users

Tablets, laptops, and smart phones are popular devices; WiFi hotspots and 3G cellular provide wireless connectivity.

Mobile users communicate, e.g., voice and texts, consume content, e.g., video and Web, and use sensors, e.g., GPS.

Wireless and mobile are related but different:

全球卫星定位系统,移动商务,传感器网络,可穿戴式计算机

1.1.4 Social Issues

Network neutrality – no network restrictions

Content ownership, e.g., DMCA takedowns

Anonymity and censorship

Privacy, e.g., Web tracking and profiling

Theft, e.g., botnets and phishing

1.2 Network Hardware(网络硬件)

从广义上讲,目前普遍使用的传输技术有两种,分别是广播式链路和点到点链路。
点到点(point-to-point)链路将一对单独的机器连接起来。在一个由点到点链路组成的网络中,为了从源端到达接收方,短消息必须首先访问一个或多个中间机器,这种短消息在某些情况下称为数据包或包1(packet)。通常在网络中有可能存在多条不同长度的路由,因此,找到一条好的路由对点到点网络非常重要。点-点传输只有一个发送方和一个接收方,有时候也称为单播(unicasting)。

广播系统往往还提供将一个数据包发送给所有目标机器的可能性,只要在地址字段中使用一个特殊的编码。如果被传输的数据包带有这样的地址编码,那么网络中的每一台机器都将会接收该包并对其进行处理。这种传输模式称为广播(boradcasting)。有些广播系统还支持给一组机器发送数据包的模式,这种传输模式称为组播(multicasting)。

 

Networks can be classified by their scale:

 

Scale

Type

Vicinity

PAN (Personal Area Network) »

Building

LAN (Local Area Network) »

City

MAN (Metropolitan Area Network) »

Country

WAN (Wide Area Network) »

Planet

The Internet (network of all networks)

1.2.1 Personal Area Network(个域网)

Connect devices over the range of a person  Example of a Bluetooth (wireless) PAN:

鼠标,锚:MODEM 调制解调器

ADSL MPDEM   电话线 Cable MODEM 同轴电缆

1.2.2 Local Area Networks(局域网)

Connect devices in a home or office building  当局余万别用于公司时,它们就称为企业网络 Called enterprise network in a company

 

H3C             H:HUAWEI           3C:3Ccom

在大多数情况下, 每台计算机与安装在天花板上的一个设备通信, 如上图所示。 这个设备, 称为接入点( AP, Access Point)、 无线路由器( wireless router)或者基站 ( base station), 它主要负责中继无线计算机之间的数据包, 还负责中继无线计算机和 Internet 之间的数据包。

无线局域网的一个标准称为IEEE 802.11,俗称WiFi。

许多有线局域网的拓扑结构是以点到点链路为基础的。俗称以太网(Ethernet)的IEEE802.3是迄今为止最常见的一种有线局域网。上图b显示了一个交换式以太网(switched Ethernet)的拓扑例子。每台计算机按照以太网协议规定的方式运行,通过一条点到点链路连接到一个盒子,这个盒子称为交换机(switch)。这就是交换式以太网名字的由来。一个交换机有多个端口(port),每个端口连接一台计算机。交换机的工作是中继与之连接的计算机之间的数据包,根据每个数据包中的地址来确定这个数据包要发送给哪台计算机。

VLAN:虚拟局域网

无线和有线广播网络可分为静态设计和动态设计,两种设计取决于如何分配信道。一个典型的静态分配方案是将时间划分成离散的时间间隔(译注:这段间隔就称为时间槽)并使用轮循算法,每台机器只能在分配给它的时间槽(time slot)到来时广播。当一台机器在分配给它的时间槽到来时没有任何数据需要发送,这种静态分配算法就浪费了信道容量(此时其他计算机也不允许发送),因此大多数系统都试图动态分配信道(即按需分配)。

1.2.3 Metropolitan Area Networks

Connect devices over a metropolitan area    Example MAN based on cable TV(最有名的城域网例子是许多城市都有有线电视网。这些系统由早期的社区电线系统发展而来):

Antenna :天线        Head end 头端   Junction box  接线盒

CATV的全称为Community Antenna Television,字面翻译为社区公共电视天线系统,国内一般指广电有线电视系统,或者广电有线电视网络。

1.2.4 Wide Area Networks (广域网)

Connect devices over a country  Example WAN connecting three branch offices:

上图为一个公司的广域网。

我们将按照传统的说法把这些机器称为主机,然后把连接这些主机的网络其余部分称为通信子网,或简称为子网。

子网的工作是把信息从一个主机携带到另一个主机。

子网由两个不同部分组成:传输线路和交换元素。

                       传输线路负责在机器之间移动比特。

                      交换元素或简称为交换机是专用的计算机,负责连接两条或两条以上的传输线路。

当数据到达一条入境线路时, 交换元素必须选择一条出境线路把数据转发出去。 这些负责交换的计算机在过去有各种不同的名称,现在最常用的名称是路由器(muter)。

An ISP (Internet Service Provider) network is also a WAN.      Customers buy connectivity from the ISP to use it.

A VPN (Virtual Private Network) is a WAN built from virtual links that run on top of the Internet.

在如上这种广域网中,子网由不同的公司负责运营。子网经营者称为网络服务提供商(network service provider),公司办事处是它的客户。这种结构如图1-12所示。其他客户只要能够支付费用并且它能提供客户所需的服务,子网运营商就把这些客户也连接进来。如果客户只能给连接在同一个网络内的其他客户发送数据包,那么这将是一个令人失望的网络服务,因此子网运营商还与Internet的其他网络相连。这样的子网运营商称为Internet 服务提供商(ISP,Internet Service Provider),相应的子网称为ISP网络(ISP network)。连接到ISP的客户就能享受Internet服务。


 

1.3 Network Software

Protocol layers »

Design issues for the layers »

Connection-oriented vs. connectionless service »

Service primitives »

Relationship of services to protocols »

1.3.1 Protocol Layers(协议层次结构)

为了降低网络设计的复杂性, 绝大多数网络都组织成一个层次栈( a stack of layer) 或分级栈(a stack of level),每一层都建立在其下一层的基础之上。层的个数、每一层的名字、每一层的内容以及每一层的功能各个网络不尽相同。每一层的目的是向上一层提供特定的服务,而把如何实现这些服务的细节对上一层加以屏蔽。从某种意义上讲,每一层都是一种虚拟机,它向上一层提供特定的服务。

一台机器上的第n层与另一台机器上的第n层进行对话,该对话中使用的规则和约定统称为第n层协议。基本上,所谓协议(protocol)是指通信双方就如何进行通信的一种约定。

图1-13显示了一个5层网络。不同机器上构成相应层次的实体称为对等体(peer)。这些对等体可能是软件过程、硬件设备,或者甚至是人类。换句话说,正是这些对等体为了实现彼此沟通才使用协议来进行通信。

实际上,数据并不是从一台机器的第n层直接传递到另一台机器的第n层。相反,每一层都将数据和控制信息传递给它的下一层,这样一直传递到最低层。第1层下面是物理介质(physical medium),通过它进行实际的通信。在图1-13中,虚线表示虚拟通信,实线表示物理通信。
在每一对相邻层次之间的是接口(interface)。接口定义了下层向上层提供哪些原语操作和服务。当网络设计者在决定一个网络中应该包含多少层,以及每一层应该提供哪些功能时,其中最重要的一个考虑是必须定义清楚层与层之间的接口。为了做到这一点,要求每一层完成一组特定的有明确含义的功能。

层和协议的集合称为网络体系结构 ( network architecture)。 网络体系结构的规范必须包含足够的信息, 以便实现者为每一层编写的程序或者设计的硬件能遵守有关的协议。
 

举例:

在许多网络中,对于第4层上传递的消息大小没有任何限制,但是几乎所有第3层协议对此总会强加一个限制。因此,第3层必须把入境消息分割成较小的单元,即数据包或包(packet),并且在每个数据包前面加上第3层的头。在这个例子中,M被分割成两部分:Mi和M2,这两部分内容是被单独传输的。

第 3 层决定使用哪些输出线路, 并且把分组传递给第 2 层; 第 2 层不仅在每一个信息上加上一个头信息还要加上一个尾, 然后将结果传输单元送给第 1 层以便进行物理传输。在接收端的机器上, 消息自底向上逐层传递, 在传递过程中各个头被逐层剥离。 没有一个第 n 层以下的头会被传递到第 n 层。


1.3.2 Design Issues for the Layers(层次设计问题)

1.3.3 Connection-Oriented vs. Connectionless (面向连接与无连接服务)

1.3.4 Service Primitives (服务原语)

一个服务由一组原语(primitive)正式说明,用户进程通过这些原语(操作)来访问该服务。原语告诉服务要执行某个动作,或者将对等实体所执行的动作报告给用户。如果协议栈位于操作系统中(大多数情况是这样的),则这些服务原语通常是一些系统调用。这些系统调用会陷入内核模式,然后在内核模式中取代操作系统来控制机器发送必要的数据包。

1.3.5 Relationship of Services to Protocols(服务与协议的关系)

服务和协议是两个截然不同的概念, 它们之间的区别非常重要, 我们有必要在这里再次强调。

服务是指某一层向它上一层提供的一组原语(操作)。 服务定义了该层准备代表其用户执行哪些操作, 但是它并不涉及如何实现这些操作。 服务与两层之间的接口有关, 低层是服务提供者, 而上层是服务用户。

与此不同的是, 协议是一组规则, 规定了同一层上对等实体之间所交换的数据包或者报文的格式和含义。 对等实体利用协议来实现它们的服务定义, 它们可以自由地改变协议,只要不改变呈现给它们用户的服务即可。 按照这种方式, 服务和协议是完全相分离的, 这是任何一个网络设计者应该很好理解的关键概念。

1.4 参考模型

Reference models describe the layers in a network architecture          体系结构

1.4.1 OSI参考模型

ISO 国际标准化组织 提出的模型,这个模型称为ISO的开放网络互联(OSI ,open system interconnection)

A principled, international standard, seven layer model to connect different systems

物理层:关注在一条通信信道上传输原始比特。

数据链路层:发送方将输入的数据拆分成数据帧,然后顺序发送这些数据帧。

网络层:控制子网的进行,数据包交换。

传输层:接受来自上一层的数据。端到端。它自始至终将数据从源端携带到接收方。

会话层:允许不同机器上的用户建立会话。会话通常提供各种服务,包括对话控制,令牌管理,以及同步功能。

表示层:关注的是所传递的语法和语义。

应用层:包含了用户通常需要的各种各样的协议,一个得到广泛使用的应用协议是超文本传输协议(HTTP,HyperText Transfer Protocol)

1.4.2 TCP /IP 参考模型

A four layer model derived from experimentation; omits some OSI layers and uses the IP as the network layer.

IP is the “narrow waist” of the Internet

Protocols are shown in their respective layers

链路层

互联网层

传输层

应用层

1.5 网络实例

1.5.1 因特网

Before the Internet was the ARPANET, a decentralized, packet-switched network based on Baran’s ideas.

The early Internet used NSFNET (1985-1995) as its backbone; universities connected to get on the Internet

1.5.2 第三代移动电话网络

1.5.3 无线局域网 802.11

1.5.4 RFID和传感器网络

 

 

Chapter 4: Processor Architecture. This chapter covers basic combinational and sequential logic elements, and then shows how these elements can be combined in a datapath that executes a simplified subset of the x86-64 instruction set called “Y86-64.” We begin with the design of a single-cycle datapath. This design is conceptually very simple, but it would not be very fast. We then introduce pipelining, where the different steps required to process an instruction are implemented as separate stages. At any given time, each stage can work on a different instruction. Our five-stage processor pipeline is much more realistic. The control logic for the processor designs is described using a simple hardware description language called HCL. Hardware designs written in HCL can be compiled and linked into simulators provided with the textbook, and they can be used to generate Verilog descriptions suitable for synthesis into working hardware. Chapter 5: Optimizing Program Performance. This chapter introduces a number of techniques for improving code performance, with the idea being that programmers learn to write their C code in such a way that a compiler can then generate efficient machine code. We start with transformations that reduce the work to be done by a program and hence should be standard practice when writing any program for any machine. We then progress to transformations that enhance the degree of instruction-level parallelism in the generated machine code, thereby improving their performance on modern “superscalar” processors. To motivate these transformations, we introduce a simple operational model of how modern out-of-order processors work, and show how to measure the potential performance of a program in terms of the critical paths through a graphical representation of a program. You will be surprised how much you can speed up a program by simple transformations of the C code. Bryant & O’Hallaron fourth pages 2015/1/28 12:22 p. xxiii (front) Windfall Software, PCA ZzTEX 16.2 xxiv Preface Chapter 6: The Memory Hierarchy. The memory system is one of the most visible parts of a computer system to application programmers. To this point, you have relied on a conceptual model of the memory system as a linear array with uniform access times. In practice, a memory system is a hierarchy of storage devices with different capacities, costs, and access times. We cover the different types of RAM and ROM memories and the geometry and organization of magnetic-disk and solid state drives. We describe how these storage devices are arranged in a hierarchy. We show how this hierarchy is made possible by locality of reference. We make these ideas concrete by introducing a unique view of a memory system as a “memory mountain” with ridges of temporal locality and slopes of spatial locality. Finally, we show you how to improve the performance of application programs by improving their temporal and spatial locality. Chapter 7: Linking. This chapter covers both static and dynamic linking, including the ideas of relocatable and executable object files, symbol resolution, relocation, static libraries, shared object libraries, position-independent code, and library interpositioning. Linking is not covered in most systems texts, but we cover it for two reasons. First, some of the most confusing errors that programmers can encounter are related to glitches during linking, especially for large software packages. Second, the object files produced by linkers are tied to concepts such as loading, virtual memory, and memory mapping. Chapter 8: Exceptional Control Flow. In this part of the presentation, we step beyond the single-program model by introducing the general concept of exceptional control flow (i.e., changes in control flow that are outside the normal branches and procedure calls). We cover examples of exceptional control flow that exist at all levels of the system, from low-level hardware exceptions and interrupts, to context switches between concurrent processes, to abrupt changes in control flow caused by the receipt of Linux signals, to the nonlocal jumps in C that break the stack discipline. This is the part of the book where we introduce the fundamental idea of a process, an abstraction of an executing program. You will learn how processes work and how they can be created and manipulated from application programs. We show how application programmers can make use of multiple processes via Linux system calls. When you finish this chapter, you will be able to write a simple Linux shell with job control. It is also your first introduction to the nondeterministic behavior that arises with concurrent program execution. Chapter 9: Virtual Memory. Our presentation of the virtual memory system seeks to give some understanding of how it works and its characteristics. We want you to know how it is that the different simultaneous processes can each use an identical range of addresses, sharing some pages but having individual copies of others. We also cover issues involved in managing and manipulating virtual memory. In particular, we cover the operation of storage allocators such as the standard-library malloc and free operations. CovBryant & O’Hallaron fourth pages 2015/1/28 12:22 p. xxiv (front) Windfall Software, PCA ZzTEX 16.2 Preface xxv ering this material serves several purposes. It reinforces the concept that the virtual memory space is just an array of bytes that the program can subdivide into different storage units. It helps you understand the effects of programs containing memory referencing errors such as storage leaks and invalid pointer references. Finally, many application programmers write their own storage allocators optimized toward the needs and characteristics of the application. This chapter, more than any other, demonstrates the benefit of covering both the hardware and the software aspects of computer systems in a unified way. Traditional computer architecture and operating systems texts present only part of the virtual memory story. Chapter 10: System-Level I/O. We cover the basic concepts of Unix I/O such as files and descriptors. We describe how files are shared, how I/O redirection works, and how to access file metadata. We also develop a robust buffered I/O package that deals correctly with a curious behavior known as short counts, where the library function reads only part of the input data. We cover the C standard I/O library and its relationship to Linux I/O, focusing on limitations of standard I/O that make it unsuitable for network programming. In general, the topics covered in this chapter are building blocks for the next two chapters on network and concurrent programming. Chapter 11: Network Programming. Networks are interesting I/O devices to program, tying together many of the ideas that we study earlier in the text, such as processes, signals, byte ordering, memory mapping, and dynamic storage allocation. Network programs also provide a compelling context for concurrency, which is the topic of the next chapter. This chapter is a thin slice through network programming that gets you to the point where you can write a simple Web server. We cover the client-server model that underlies all network applications. We present a programmer’s view of the Internet and show how to write Internet clients and servers using the sockets interface. Finally, we introduce HTTP and develop a simple iterative Web server. Chapter 12: Concurrent Programming. This chapter introduces concurrent programming using Internet server design as the running motivational example. We compare and contrast the three basic mechanisms for writing concurrent programs—processes, I/O multiplexing, and threads—and show how to use them to build concurrent Internet servers. We cover basic principles of synchronization using P and V semaphore operations, thread safety and reentrancy, race conditions, and deadlocks. Writing concurrent code is essential for most server applications. We also describe the use of thread-level programming to express parallelism in an application program, enabling faster execution on multi-core processors. Getting all of the cores working on a single computational problem requires a careful coordination of the concurrent threads, both for correctness and to achieve high performance翻译以上英文为中文
最新发布
08-05
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值