420 likes | 565 Views
Chapter 15: Networks. Data communication networks are set up in two basic configurations. The mesh configuration uses direct, point-to-point connections between each pair of communicating devices.
E N D
Chapter 15: Networks Data communication networks are set up in two basic configurations. The meshconfiguration uses direct, point-to-point connections between each pair of communicating devices. While this approach guarantees a direct connection between any pair of devices, the amount of cabling and I/O hardware required at each device makes it impractical in most situations. The alternative is to establish a broadcast network in which network lines are shared. Simple configurations associated with the broadcast approach include the ring and bus topologies, at left and right, respectively. Chapter 15 Networks Page 162
Local Area Networks Bus Cable Computer Computer Computer Computer Computer Computer LANs are privately owned networks containing perhaps dozens of devices. Example: Ethernet Ethernet uses a bus configuration and a protocol for accessing the bus called CSMA/CD. • CS - Carrier Sense: Each machine constantly listens to the traffic that’s passing by on the bus. • MA - Multiple Access: Every machine has equal access to the communication medium (i.e., the bus). • CD - Collision Detection: Each machine is capable of detecting whether its transmitted message “collided” with that of another machine, thus corrupting the message and forcing a retransmission. Chapter 15 Networks Page 163
Ethernet Carrier Sense: Incoming Traffic Bus Cable Computer Computer Computer Computer Computer Computer As messages pass by, each machine examines the first few bits of the message, the “address” of the message, and determines whether or not the message is intended for itself. message message message When the destination machine sees its address in the message’s prefix, it copies the passing message as the original proceeds down the bus. Chapter 15 Networks Page 164
Ethernet Carrier Sense: Outgoing Traffic Bus Cable Computer Computer Computer Computer Computer Computer When a machine wants to transmit a message, it waits a system-dependent amount of time, using its carrier sense to see if any traffic appears on the bus. If not, it transmits its message and “hopes” that no collision occurs. message When the transmitting machine detects no passing traffic for a certain time interval, it places its message on the bus. Chapter 15 Networks Page 165
Ethernet Carrier Sense: Colliding Traffic Bus Cable Computer Computer Computer Computer Computer Computer After a machine transmits a message, it continues to use its carrier sense to see if there’s any difference between its transmitted message and the message on the bus. If so, it interprets the problem as a collision. message message When each transmitting machine detects that its message has been corrupted, it waits a random interval of time, and then retransmits. Chapter 15 Networks Page 166
A LAN Alternative: Token Ring Ring Computer Computer Computer Computer Computer Computer Computer Computer Computer Computer Computer Computer Computer Collisions tend to exacerbate traffic problems on congested Ethernet LANs, so an alternative to the CSMA/CD approach is desirable. message TOKEN TOKEN message message Token Ring uses a ring topology, with a specially formatted “token” message perpetually traversing the ring. When a machine wishes to transmit, it merely waits for the token to arrive, removes it, and transmits its message. When its message returns to the transmitting machine, it’s removed from the ring, and the machine places the token back on the ring. Chapter 15 Networks Page 167
Wide Area Networks WANs are large collections of smaller networks, with special interconnection devices known as “routers” to make adjacent sub-networks compatible. Router Router Router Router Router Router Chapter 15 Networks Page 168
Switching Data communications is characterized by two switching technologies. Technology #1: Circuit Switching Once the circuit is established, it is maintained until one of the endstations terminates the connection. Chapter 15 Networks Page 169
Problems with Circuit Switching Circuit switching has one great advantage: once established, the circuit is dedicated, i.e., a communication line is completely open until formally terminated. However, this approach has a number of serious problems: • Many networked applications don’t require a dedicated circuit, so reserving a communication line until an endstation formally terminates it can represent a serious waste of resources. • The route originally selected for the circuit may be optimal to begin with, but may prove to be suboptimal as the communication continues. • An entire, end-to-end path must be found and reserved before any communication is allowed between the two endstations; this is definitely not conducive to many modern applications (e.g., Web surfing, videoconferencing). • Transmission errors are propagated all the way to the destination, requiring retransmission across the entire network. Chapter 15 Networks Page 170
An Alternative to Circuit Switching Technology #2: Packet Switching The source’s message is broken into manageable “packets” that are transmitted to the destination individually, not necessarily along the same path. Chapter 15 Networks Page 171
The Pros and Cons of Packet Switching • Packet switching remedies circuit switching’s principal problems: • Lines aren’t dedicated, so their utilization is higher. • Messages are “packetized”, so line-sharing is reasonably fair. • Routing may be dynamic, i.e., an alternate route may be chosen when traffic patterns change. • The entire route does not have to be chosen prior to sending any data. • Errors aren’t propagated end-to-end. • However, packet switching does have its own set of problems: • Switches must be programmed to make sophisticated routing decisions. • Switches must manage memory for queued packets that await forwarding. • Packets must be prefixed with control headers, increasing overhead. • Endstations must deal with missing packets and out-of-order packets. • Without a dedicated circuit, transmission times become unpredictable. Chapter 15 Networks Page 172
Multiplexing To more efficiently utilize a physical medium, multiple higher-level connections might “share” the medium simultaneously. Frequency-Division Multiplexing The spectrum of frequencies transmittable via the physical medium is divided into several channels (e.g., cable TV). Time-Division Multiplexing Each transmitter is allocated a periodic time interval in which to transmit. Chapter 15 Networks Page 173
Code Division Multiplexing Time Division Multiplexing Everyone gets to talk using the entire bandwidth, but they have to take turns talking. (Commonly user with fiber optics) Frequency Division Multiplexing Everyone gets to talk at the same time, but only across their narrow channels. (Commonly used with copper cables) Code Division Multiplexing Everyone gets to talk simultaneously, using the entire bandwidth! They do this by coding their transmissions in a unique fashion (as if every pair were speaking a different language, and each other language merely sounds like background noise). (Commonly used with wireless communications) Chapter 15 Networks Page 174
Modems Digital data must be modulated into analog signals if it’s going to be transmitted across an analog medium. After transmission, it must be demodulated back into its original digital form. Dial-in pool of 96 modems: Six terminal servers, each connecting 16 modems to a LAN Cables between the workstation and the modem and between the modem and the telephone jack Chapter 15 Networks Page 175
Network Protocol Layers Layer 5 Layer 5 Layer 4 Layer 4 Layer 4 Layer 4 Layer 3 Layer 3 Layer 3 Layer 3 Layer 2 Layer 2 Layer 2 Layer 2 Layer 2 Layer 1 Layer 1 Layer 1 Layer 1 Layer 1 Source Host Intermediate Router Low-Level Bridge Intermediate Router Destination Host In an effort to simplify networks, they are often organized as layered hierarchies of protocols, with hardware-intensive protocols on the bottom and user applications at the top. Physical Medium Chapter 15 Networks Page 176
Communicating Via Layered Protocols Layer 5 message Layer 4 Layer 4 hdr4 message hdr4 message Layer 3 Layer 3 hdr3 hdr4 msgA hdr3 hdr4 msgB hdr3 hdr4 msgB hdr3 hdr4 msgA Layer 2 Layer 2 hdr2 hdr3 hdr4 msgA trl2 hdr2 hdr3 hdr4 msgB trl2 hdr2 hdr3 hdr4 msgB trl2 hdr2 hdr3 hdr4 msgA trl2 Layer 1 Layer 1 hdr1 hdr2 hdr3 hdr4 msgB trl2 hdr1 hdr2 hdr3 hdr4 msgA trl2 Consecutive network nodes only communicate directly at the lowest (hardware) layer; to communicate at higher layers, networking software inserts certain relevant data as headers and trailers to the message coming from the source. Chapter 15 Networks Page 177
Layered Protocol Models Several models have been developed to implement protocol hierarchies for networks. Reference Model #1: Open Systems Interconnection (OSI) Chapter 15 Networks Page 178
Reference Model #2: Transmission Control Protocol/Internet Protocol (TCP/IP) Chapter 15 Networks Page 179
The IP Header Version HdrLen Service Type Total Length Identification Flags Fragment Offset Time To Live Protocol Header Checksum Source IP Address Destination IP Address Options & Padding (if any) Version HdrLen Service Type Total Length Identification Flags Fragment Offset Time To Live Protocol Header Checksum Source IP Address Destination IP Address Options & Padding (if any) Version: The version of IP used to create the packet, used by nodes to process it correctly. HdrLen: The length of the header in 32-bit words (because the Options field has no fixed size). Service Type: Six bits to represent the relative priority and delay sensitivity of the packet. Total Length: The length of the entire packet in bytes (16-bit field means a 65,535-byte max). Identification: All fragments of the same packet have the same ID number. Flags: Don’t-Fragment flag and More-Fragments flag. Fragment Offset: Offset from start of packet (in bytes) of current fragment. Time To Live: Length of time (in seconds) the packet may stay in the Internet. Protocol: Global ID # of the protocol used to create the packet (e.g., TCP). Header Checksum: Error-checking sum of all of the 16-bit values in the header. Source IP Address: 32-bit IP address of the packet’s original source. Chapter 15 Networks Page 180 Destination IP Address: 32-bit IP address of the packet’s final destination. Options & Padding: Options include: No-operation-just-align; Military-security-application; Loose-source-routing; Record-route; Strict-source-routing; Record-internet-timestamps.
Client System Server System control process control process Operating System Operating System TCP/IP Internet Client System Server System data transfer control process control process data transfer Operating System Operating System TCP/IP Internet File Transfer Protocol (FTP) One active TCP connection before and after data transfer, just for control. Two active TCP connections during data transfer, one for control and one for data. Chapter 15 Networks Page 181
Firewalls Firewall! To ensure the security of a private network, “firewall” programs have been developed. A common approach is to filter incoming and outgoing packets based upon header information, and to use an application gateway to inhibit application-specific traffic. My Secure Network packet packet packet packet packet Incoming packets for bad address/port combinations are rejected (e.g., no outsider can “finger” an internal site). Incoming or outgoing packets are rejected on the basis of size or payload info. Outgoing packets for bad address/port combinations are rejected (e.g., no insider can “http” an external site). Chapter 15 Networks Page 182
Chapter 16: The World Wide Web The World Wide Web applies point-and-click hypermedia application software to facilitate accessing documents on the Internet via TCP-based protocols. Click on this piece of hypertext, and you’re taken to... Type in a keyword and click the “Go!” pushbutton, and you’re taken to... And with additional downloaded software, elaborate Web sites that include more than text and simple images can be accessed. Click on this pushbutton, and you’re taken to... Chapter 16 The World Wide Web Page 183
HyperTextTransport Protocol (HTTP) HTTP is the software defining the format of requests relayed from a Web browser to a Web server, as well as the replies relayed from the server to the browser. HTML (HyperText Markup Language) is the standard used to write Web pages; it doesn’t require specific formatting instructions, so two browsers may display a page differently. <html><head><title>Welcome to IEEExpl</title></head> <body> <table width="550" border="0" cellspacing="0" cellpadding="0" align="center"> <tr><td valign="top"> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="3"><b> <font face="Verdana, Arial, Helvetica, sans-serif" size="3"><b> <font size="5" color="#3333CC"><imgsrc="/images/subidinfmast_01.gif" width="550" height="39“ vspace="3" hspace="0" border="0" alt="IEEE xpl Subscription Access Information“ usemap="#Map"></font></b></font> <map name="Map"> <area shape="rect" coords="6,5,182,31" href="http://ieeexpl.ieee.org"> </map> </b></font></p> <br> <table width=510 border=1 cellspacing=0 cellpadding=5 bordercolor=#CCCCCC align=center><tr><td> <font face=Verdana, Arial, Helvetica, sans-serif size=2 color=#3333CC> <b>Your institution subscribes to:</b></font></td></tr><tr><td bgcolor=#E8E8E8><strong> <font size=2 face=Verdana> </font><font face=Verdana, Arial, Helvetica, sans-serif size=2 color=#3333CC>•<b></b></font><font size=2 face=Verdana> Search Xplore Database</font></strong></td></tr></table><br> <table width=510 border=1 cellspacing=0 cellpadding=5 bordercolor=#CCCCCC align=center><tr><td> <font face=Verdana, Arial, Helvetica, sans-serif size=2 color=#3333CC><b>Your institution subscribes to:</b> </font></td> </tr> <tr> <td bgcolor=#E8E8E8><strong><font size=2 face=Verdana> </font><font face=Verdana, Arial, Helvetica, sans-serif size=2 color=#3333CC>•<b> </b> </font><font size=2 face=Verdana>IEEE All Society Periodicals Package (ASPP) </font></strong></td> </tr> <tr> <td bgcolor=#FFFFFF> <blockquote> <blockquote> <p><font face=Verdana size=2><b><font color=#3333CC>Your online subscription includes access to the abstracts and full-text of IEEE journals, transactions, and magazines published since 1998:</font></b> </font></p> <p><font size=2 face=Verdana> <font face=Verdana, Arial, Helvetica, sans-serif size=2 color=#3333CC><b>•</b> </font> <a href=/xpl/ieeejrns.jsp?hr=1>IEEE journals, transactions, and magazines</a> </p> </blockquote> </blockquote> </td> </tr> </table><br> <table width="500" border="0" cellspacing="0" cellpadding="0" align="center"><tr> <td> <p><font face="Verdana" size="2"> In addtion to the above, you may purchase individual IEEE journal/magazine articles and conference papers that are not included in your institution's online subscription. If you want a copy of an article or paper, first check with your librarian for a copy available locally.</font></p> <p><font face="Verdana" size="2"><font color="#000000">Any questions? <a href="/xpl/techform.jsp"> Contact IEEE Customer Service</a>.</font></font></p></td></tr></table><br> <table width="500" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td valign="top"> <div align="right"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br><A href='javascript:window.close();'> <imgsrc="/images/backbutton.gif" width="165" height="34" vspace="0" hspace="0" border="0" alt="Close this Window"></A> </font></div></td></tr></table></td></tr></table></body></html> Chapter 16 The World Wide Web Page 184
Extensible Markup Language(XML) Unlike HTML, XML allows users to include content-specific information in their files, facilitating its being formatted to suit various display devices. A job vacancy at the department of Tourism is added to the job database. XML technology stores the data separately from the presentation, allowing for a variety of platforms. Chapter 16 The World Wide Web Page 185 The vacancy is displayed on the job center kiosk... ...can be accessed by mobile devices... ...and is displayed on the Department of Tourism website.
Uniform Resource Locators (URLs) A URL specifies three pieces of information: 1. Type of file transfer 2. Name of computer 3. Name of file Different types of file transfer: http:// - hypertext transfer protocol ftp:// - file transfer protocol telnet:// - opens a telnet session gopher:// - transfer file from a gopher server mailto: - open a mail session For example: http://www.cs.siue.edu/undergrad/BS/files/prerequisites.pdf 1. http:// - type of file transfer 2. cs.siue.edu - name of the computer 3. /undergrad/BS/files/prerequisites.pdf - location of the file on the computer Chapter 16 The World Wide Web Page 186
Web Browsing Browser Controller Client software running on the workstation HTML Interpreter Display Driver Java Interpreter HTTP Client FTP Client Network Interface Interpreting downloaded Web pages and files Input from mouse & keyboard Output to user’s display Issuing requests for external files Communications with remote Web server Chapter 16 The World Wide Web Page 187
Internet Search Engines Search engines use “spider” programs to “crawl” through the Web, building a list of words. Some follow every link on every home page. Some ignore links that lead to graphics, sound, or animation files, or to newsgroups. Some concentrate primarily on the most popular Web pages. Chapter 16 The World Wide Web Page 188
Comparing Search Engines Share of Searches Security Issues Red = distribute adware, send a high volume of spam, or make unauthorized changes to a user's computer Yellow = send a high volume of "non-spammy" email, display many popup ads, or prompt a user to change browser settings Chapter 16 The World Wide Web Page 189
Chapter 17: Limitations of Computing What problems cannot be solved on a computer? What problems cannot be solved on a computer in a “reasonable” amount of time? These aren’t just philosophical questions; their answers will determine how practical it is to pursue computer-based solutions to real-world problems like hurricane prediction, disease control, and economic forecasting. Computability: What are the limitations to the problem- solving abilities of computers? Complexity: What kinds of problems can be solved on a computer in a reasonable time, using a reasonable amount of memory? Chapter 17 Limitations of Computing Page 190
Read/Write Head Tape Computability To examine the limits of what it is possible to do with a computer, Alan Turing (1912-1954) developed a simplified mathematical model, called a Turing machine. A Turing machine consists of three parts: • A tape of cells from which symbols can be read and into which symbols can be written, Control Unit • A read/write head that moves back and forth across the tape, reading the symbol inside the current cell and/or writing a new symbol into the current cell, and • A control unit that keeps track of what “state” the machine is in, and uses that state and the current symbol under the read/write head to: • Determine which symbol to place in the current cell, • Determine whether to move the read/write head one cell to the left or right, and • Determine the next state of the machine. Chapter 17 Limitations of Computing Page 191
State: START * 1 0 1 * State: ADD * 1 0 1 * State: CARRY * 1 0 0 * State: NO CARRY */*/L 1/0/L * 1 1 0 * START ADD CARRY 1/0/L State: NO CARRY 0/1/L 0/1/L */1/L * 1 1 0 * 0/0/L, 1/1/L NO CARRY OVERFLOW */*/R State: RETURN * 1 1 0 * */*/R */*/R State: RETURN * 1 1 0 * HALT RETURN 0/0/R, 1/1/R */*/- State: RETURN * 1 1 0 * State: RETURN State: HALT * * 1 1 1 1 0 0 * * State Transition Diagram A state transition diagram may be used to define a Turing machine. Each // transition signifies reading on the tape, replacing it with , and then moving the read/write head in the direction. The state transition diagram above defines a Turing machine that increments a binary number on the tape by one. Chapter 17 Limitations of Computing Page 192
The Church-Turing Thesis Computer scientists commonly accept the Church-Turing Thesis, which states that the set of functions that can be calculated on a computer is exactly the same as the set of functions for which a Turing machine can be devised. There are problems that have been proven to be non-computable (i.e., no Turing machine can be devised to calculate their solutions). One classical example: The Halting Problem Given a program with a set of input values, does the program halt on that input, or does it get stuck in an infinite loop? Chapter 17 Limitations of Computing Page 193
Number of Output Statements Executed: 4 Time Complexity: O(1) Number of Output Statements Executed: 100 Time Complexity: O(1) Number of Output Statements Executed: n Time Complexity: O(n) Number of Output Statements Executed: n2 Time Complexity: O(n2) Complexity The time complexity of an algorithm is a measure of how many steps are executed when the associated program is run. void printA() { cout << 0 << endl; cout << 0 << endl; cout << 0 << endl; cout << 0 << endl; } The “big-O” notation provides information regarding the program’s “order of complexity”. O(1) indicates that the execution time doesn’t relate to the size of the number n. O(n) indicates that the execution time increases linearly as n increases. O(n2) indicates that the execution time increases quadratically as n increases. void printB() { inti; for (i = 1; i <= 100; i++) cout << 0 << endl; } void printC(int n) { int i; for (i = 1; i <= n; i++) cout << 0 << endl; } void printD(int n) { inti,j; for (i = 1; i <= n; i++) for (j = 1; j <= n; j++) cout << 0 << endl; } Chapter 17 Limitations of Computing Page 194
Logarithmic/Polynomial/Exponential An algorithm is said to have logarithmic time complexity if the number of steps in its execution is bounded by some logarithmic function: k log2(n) Essentially, this means that doubling the size of the problem (n) would only increase the execution time by a constant amount (k). An algorithm is said to have polynomial time complexity if the number of steps in its execution is bounded by some polynomial function: aknk+ak-1nk-1+…+a2n2+a1n+a0 An algorithm is said to have exponential time complexity if the number of steps in its execution is bounded by some exponential function: k(2n) Essentially, this means that increasing the size of the problem (n) by one would double the execution time. Chapter 17 Limitations of Computing Page 195
Big-O An algorithm’s time complexity is dominated by its most significant term. For example, an algorithm that executes in time n2+10n is considered to be O(n2) because, as n increases, the n2 term ultimately dominates the n term. Additional examples: 5n + n2 + 0.125n3is O(n3) log2(n) + n2 + 2nis O(2n) 100n + max(n2, 1000 - n3) is O(n2) n3 - ⅞(n3 - 80n2 - 800n) is O(n3) Chapter 17 Limitations of Computing Page 196 1000000 + 0.000001log2(n) is O(log2(n))
P and NP Problems A problem is said to be a P problem if it can be solved with a deterministic, polynomial-time algorithm. (Deterministic algorithms have each step clearly specified.) A problem is said to be an NP problem if it can be solved with a nondeterministic, polynomial-time algorithm. In essence, at a critical point in the NP problem’s algorithm, a decision must be made, and it is assumed that some magical “choice” function (also called an oracle) always chooses correctly. For example, take the Satisfiability Problem: Given a set of n boolean variables b1, b2, … bn, and a boolean function f (b1, b2, …, bn), are there any values that can be assigned to the variables so the function value will evaluate to TRUE? To try every combination of boolean values would take exponential time, but the nondeterministic solution at right has polynomial time complexity. for (i = 1; i <= n; i++) bi = choice(true, false); if (f(b1, b2,…, bn) == true) satisfiable = true; else satisfiable = false; Chapter 17 Limitations of Computing Page 197
The Knapsack Problem The Knapsack Problem involves taking n valuable jewels J1, J2,…,Jn, with respective weights w1, w2,…, wn, and prices p1, p2,…, pn, and placing some of them in a knapsack that is capable of supporting a combined weight of M. The problem is to pack the maximum worth of gems without exceeding the capacity of the knapsack. (It’s not as easy as it sounds; three lightweight $1000 gems might be preferable to one heavy $2500 gem, and one 20-pound gem worth a lot of money might be preferable to twelve 1-pound gems that are practically worthless.) A Nondeterministic Polynomial Solution: TotalWorth = 0; TotalWeight = 0; for (i = 1; i <= n; i++) { bi = choice(true, false); if (b1 == true) { TotalWorth+= pi; TotalWeight += wi; } } if (TotalWeight <= M) cout << “Woo-hoo!” << endl; else cout << “Doh!” << endl; Chapter 17 Limitations of Computing Page 198
Supplement: Computer Ethics How dependable is computer technology? In 1994, Intel’s new Pentium processor was determined to have a flaw… 4195835–(4195835*3145727)/3145727 = 256 The Problem: Five values were left out of a table of 1,066 on the chip. Those five values were looked up when certain divisions were performed and, since they weren’t there, the values were interpreted as zeros. The Response:Initially denying that there was any error at all, Intel ultimately offered to replace customers’ chips with corrected versions. The Reaction:Intel’s competitors condemned Intel, but all of the press Intel received, while negative, turned it into a household name. Supplement Computer Ethics Page 199
Unsolicited Commercial E-Mail Various techniques have been developed for dealing with the “spam” that plagues people’s e-mail accounts. Blacklists One very effective technique for blocking spam is to maintain a blacklist of spam sources, and to refuse all e-mail from those sources. The problem: Aggressive blacklist policies might list sources that send legitimate e-mail as well as spam. Whitelists Instead of trying to block spam while allowing everything else, whitelist software blocks everything except messages from already known, accepted senders, thus changing e-mail from an open system to a closed one. Whitelists typically allow e-mail from everyone in a user's existing address book. Other, unknown senders receive an automated reply, asking them to take further action, such as explain who they are. Or senders may be asked to identify a partially obscured image of a word. A person can make out the word, but automated spammer software can't. Supplement Computer Ethics Page 200
Identity Theft Technological advances in recent years have facilitated the ability of criminals to obtain personal information about people and to unlawfully gain access to their financial accounts. * 2006 FTC Statistics Supplement Computer Ethics Page 201
Electronic Monitoring To combat employee “cyberslacking”, employers are increasing making use of monitoring software that records how employees are using their office communication capabilities. Legally, the courts have consistently defended the right of employers to monitor telephone conversations, voice-mail messages, e-mail, and Web browsing of employees using employer-provided equipment. Supplement Computer Ethics Page 202
E-Waste E-waste represents 2% of America's trash in landfills, but it equals 70% of overall toxic waste. The extreme amount of lead in electronics alone causes damage in the central and peripheral nervous systems, the blood and the kidneys. • Electronic items that are considered to be • hazardous include, but are not limited to: • Televisions and computer monitors that contain cathode ray tubes • LCD desktop monitors • Laptop computers with LCD displays • LCD televisions • Plasma televisions • Portable DVD players with LCD screens. Supplement Computer Ethics Page 203