Lecture Notes

for

CSCI 1301: Great Ideas in Computer Science

(c) 1993 - 2007 John E. Howland, All Rights Reserved

Department of Computer Science

Trinity University

One Trinity Place

San Antonio, Texas 78212-7200

Internet: jhowland@ariel.cs.trinity.edu

11 Computer Networks

11.1 Network Terminology

A network is a collection of two or more connected machines together with operating system software which facilitates communication between machines (sometimes called nodes) on the network. There are several common interconnection topologies used to network computers. The choice of network connection architecture depends on many factors such as proximity of machines, building features, desired network performance, etc.

11.1.1 Bus Network Topology

Bus networks have a single network cable (plus ground wire or shield) which attaches to all machines on the network. Different types of wiring are widely used. One type, a coxial cable, uses a single copper wire with a special ground shield conductor which surrounds the copper core. Another type uses two pairs of twisted copper wire.

Each machine on the network sees every message sent on the network, but only processes messages which pertain to that machine. Special signaling techniques are used to detect and avoid message collisions when two machines attempt to transmit a message at the same instant in time. The method used to avoid future collision when two or more machines detect that their messages were transmitted at the same time is to have each machine compute a small, but random, delay time before trying to transmit again. This network access discipline is known as Carrier Sense Multiple Access Collision Detect (CSMACD).

11.1.2 Star Network Topology

Star networks use a single network node which connects to every other node in the net and provides communication services to other machines on the net.

In a star network, each machine may communicate with the Hub machine without worrying about whether or not their messages will collide with other messages. The performance of a star network is determined largely by the performance of the Hub machine. The Hub machine performs all message routing to the desired destination machine.

11.1.3 Ring Network Topology

Ring networks use a ring of connections from one machine to the next.

Messages are forwarded from one machine to the next until they arrive at the desired destination. A special message, called the token, is sent from one machine to the next around the ring. The message collision problem is solved in a ring network by requiring each machine to wait until the token arrives before transmitting a message. When a message arrives at a machine it is forwarded to the next machine in the ring unless the message is for that machine. If a message is circulated all the way around the ring and arrives back at the sending node, then this condition is recoginized as an error (the addressed machine was unavailable to receive the message).

11.1.4 Messages

Messages which are sent from one machine to another are subdivided into relatively small sized blocks called packets. This is done primarily to prevent one machine from unfairly monopolizing the network when transmitting long messages.

11.2 Internets

An internet is a collection of interconnected networks together with special software which facilitates communication between networks.

An internet is built from two or more networks by having a network connection between two machines, each of which are on different networks.

11.2.1 Connecting Two Networks

The machines M5 and M3 are sometimes called bridges, routers or gateways because these machines each exist on two networks. Special software is required to route messages between the networks through these machines. Sometimes, rather than use two general purpose computers to function as a bridge or gatway connecting two networks, a special purpose computer together with routing software is used to connect two networks.

11.3 Internet Network Software

When several different networks are connected together, a common set of operating system routines must be provided on each machine. Such software is referred to as a network protocol. When the machines run the Unix operating system, an often used protocol is TCP/IP. TCP/IP stands for Transmission Control Protocol / Internet Protocol. These protocols provides efficient and reliable communication mechanisms for sending data and messages across an internet.

An internet usually contains a variety of different machines which are not easily compatible with one another. Hence, there must be different implementations of the common network software protocols, such as TCP/IP, and each of these implementations must provide the necessary communication compatibility between the incompatible machines.

Other noteworthy protocols include Novel IPX, AppleTalk and DECNET. Each of these protocols has been developed by a particular vendor, but, because they are widely used, they are licensed by other vendors so as to provide greater compatibility. Each of these protocols has become a defacto standard for networking.

11.3.1 Internet Addressing

Machines on an internet need a naming scheme which uniquely identifies each machine on the internet. Ther world-wide internet uses a domain naming system. The top-level domains indentify the country in which a machine resides by a code (uk - United Kingdom or ca - Canada) , but for historical reasons, in the United States, top-level domains are: edu - school, gov - government, com - commercial site, net - network administration or mil - military. The next level domain includes a site name. trinity.edu, for example, is the domain containing all machines on the internet which are located at Trinity University. The next level domains specify one or more sub domains at a given site. For example, cs.trinity.edu is the domain name for all machines in the Trinity compter science department. However, the cs domain contains a subdomain mars.cs.trinity.edu which contains two machines. Similarly, engr.trinity.edu is the domain of all machines on the internet which are in the Trinity engineering science department. Finally, each machine in a domain must be uniquely named. For example, uranus.cs.trinity.edu is one of our laboratory machines and is uniquely identified even though other machines named uranus exist in other domains on the internet.

11.3.2 Network and Machine Numbers

Networks and machines are numbered with 32 bit integers which are represented usually in the form ddd.ddd.dddd.ddd where ddd is a number ranging from 0 to 255. Each number is subdivided into two parts; the network number and the machine network interface number. For example, the machine uranus.cs.trinity.edu is 131.194.71.11 . A special database system, Domain Name System (DNS) is used to associate the name uranus.cs.trinity.edu with its number 131.194.71.11 . Trinity's network number is 131.194 . The computer science department uses 71 as a prefix for all of the machines in the department with 11 being the number of the network interface for uranus.

11.4 Network Applications

Networks are used to share system resources between several machines. For example, a printer which is attached to one machine on a network might be accessed by other machines on that network. Similarly, files which are stored on one machine might be accessed by other machines on the network. So the sharing of resources involves not only sharing devices such as printers, but also the sharing of data.

Recent estimates of the size of the internet indicate that several million machines are connected and new connections are being made at a rate of more than 100,000 per month. It is also estimated that there are databases containing tens of thousands of Giga bytes of information available on the internet. A Giga byte is a thousand mega bytes!

11.5 Using Networks for Parallel Computation

Given the right permissions on unix machines which are connected to an internet, a program running on one machine on the internet can request that another program be run on another machine and have a resulting value returned to the first program over the internet.

11.5.1 Function remote_eval

The following function may be used to evaluate a J expression on another J equipped Unix workstation located somewhere on the Internet. This function returns the resulting value back to the requesting J session. This function assumes that the two involved machines share the same file system, since files are used to send the expression to the remote workstation and retrieve the value of the expression from the remote workstation.

remote_eval =: dyad define
y. write '../remote_eval_in'
spawn 'ssh ', x. , ' /usr/local/bin/j_rem_eval'
read_list '../remote_eval_out'
)
This dyad uses a Unix shell script, j_rem_eval, which starts the J system on the remote system. For example:

'janus10.cs.trinity.edu' remote_eval '10 + i. 10' ==>
10 11 12 13 14 15 16 17 18 19

11.5.1.1 j_rem_eval Script


#!/bin/csh
echo "((3 \!: 1) "'"'". (1 \!: 1) < 'remote_eval_in') 1 \!: 2 < 'remote_eval_out'" | /usr/local/bin/j