Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 15: Networks Chapter 15 Networks Page 162 Data communication networks are set up in two basic configurations. While this approach guarantees a.

Similar presentations


Presentation on theme: "Chapter 15: Networks Chapter 15 Networks Page 162 Data communication networks are set up in two basic configurations. While this approach guarantees a."— Presentation transcript:

1

2 Chapter 15: Networks Chapter 15 Networks Page 162 Data communication networks are set up in two basic configurations. 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. The mesh configuration uses direct, point-to- point connections between each pair of communicating devices.

3 Local Area Networks Chapter 15 Networks Page 163 LANs are privately owned networks containing perhaps dozens of devices. Example: Ethernet ComputerComputer Bus Cable ComputerComputerComputerComputerComputerComputerComputerComputerComputerComputer 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 thats passing by on the bus.CS - Carrier Sense: Each machine constantly listens to the traffic thats passing by on the bus. MA - Multiple Access: Every machine has equal access to the communication medium (i.e., 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.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.

4 Ethernet Carrier Sense: Incoming Traffic Chapter 15 Networks Page 164 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. ComputerComputer Bus Cable ComputerComputerComputerComputerComputerComputerComputerComputerComputerComputer messagemessage When the destination machine sees its address in the messages prefix, it copies the passing message as the original proceeds down the bus. messagemessage messagemessage

5 Ethernet Carrier Sense: Outgoing Traffic Chapter 15 Networks Page 165 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. ComputerComputer Bus Cable ComputerComputerComputerComputerComputerComputerComputerComputerComputerComputer When the transmitting machine detects no passing traffic for a certain time interval, it places its message on the bus. messagemessage

6 Ethernet Carrier Sense: Colliding Traffic Chapter 15 Networks Page 166 ComputerComputer Bus Cable ComputerComputerComputerComputerComputerComputerComputerComputerComputerComputer After a machine transmits a message, it continues to use its carrier sense to see if theres any difference between its transmitted message and the message on the bus. If so, it interprets the problem as a collision. When each transmitting machine detects that its message has been corrupted, it waits a random interval of time, and then retransmits. message message message message

7 A LAN Alternative: Token Ring Chapter 15 Networks Page 167 ComputerComputer ComputerComputer ComputerComputer ComputerComputerComputerComputer ComputerComputer Ring ComputerComputer ComputerComputerComputerComputer ComputerComputer ComputerComputer ComputerComputerComputerComputer Collisions tend to exacerbate traffic problems on congested Ethernet LANs, so an alternative to the CSMA/CD approach is desirable. Token Ring uses a ring topology, with a specially formatted token message perpetually traversing the ring. TOKENTOKEN messagemessage TOKENTOKEN messagemessage messagemessage 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, its removed from the ring, and the machine places the token back on the ring.

8 Wide Area Networks Chapter 15 Networks Page 168 WANs are large collections of smaller networks, with special interconnection devices known as routers to make adjacent sub-networks compatible. RouterRouter RouterRouter RouterRouter RouterRouter RouterRouter RouterRouter

9 Switching Chapter 15 Networks Page 169 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. Once the circuit is established, it is maintained until one of the endstations terminates the connection.

10 Problems with Circuit Switching Chapter 15 Networks Page 170 Circuit switching has one great advantage: once established, the circuit is dedicated, i.e., a communication line is completely open until formally terminated. Many networked applications dont require a dedicated circuit, so reserving a communication line until an endstation formally terminates it can represent a serious waste of resources.Many networked applications dont require a dedicated circuit, so reserving a communication line until an endstation formally terminates it can represent a serious waste of resources. However, this approach has a number of serious problems: The route originally selected for the circuit may be optimal to begin with, but may prove to be suboptimal as the communication continues.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).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.Transmission errors are propagated all the way to the destination, requiring retransmission across the entire network.

11 An Alternative to Circuit Switching Chapter 15 Networks Page 171 Technology #2: Packet Switching The sources message is broken into manageable packets that are transmitted to the destination individually, not necessarily along the same path.

12 The Pros and Cons of Packet Switching Chapter 15 Networks Page 172 Packet switching remedies circuit switchings principal problems: Lines arent dedicated, so their utilization is higher.Lines arent dedicated, so their utilization is higher. Messages are packetized, so line- sharing is reasonably fair.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.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.The entire route does not have to be chosen prior to sending any data. Errors arent propagated end-to-end.Errors arent 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 be programmed to make sophisticated routing decisions. Switches must manage memory for queued packets that await forwarding.Switches must manage memory for queued packets that await forwarding. Packets must be prefixed with control headers, increasing overhead.Packets must be prefixed with control headers, increasing overhead. Endstations must deal with missing packets and out-of-order packets.Endstations must deal with missing packets and out-of-order packets. Without a dedicated circuit, transmission times become unpredictable.Without a dedicated circuit, transmission times become unpredictable.

13 Chapter 15 Networks Page 173 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. Multiplexing To more efficiently utilize a physical medium, multiple higher- level connections might share the medium simultaneously.

14 Chapter 15 Networks Page 174 Code Division Multiplexing Frequency Division Multiplexing Everyone gets to talk at the same time, but only across their narrow channels. Everyone gets to talk at the same time, but only across their narrow channels. (Commonly used with copper cables) Frequency Division Multiplexing Everyone gets to talk at the same time, but only across their narrow channels. Everyone gets to talk at the same time, but only across their narrow channels. (Commonly used with copper cables) Time Division Multiplexing Everyone gets to talk using the entire bandwidth, but they have to take turns talking. (Commonly user with fiber optics) Time Division Multiplexing Everyone gets to talk using the entire bandwidth, but they have to take turns talking. (Commonly user with fiber optics) 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) 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)

15 Chapter 15 Networks Page 175 Modems Cables between the workstation and the modem and between the modem and the telephone jack Digital data must be modulated into analog signals if its 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

16 Network Protocol Layers Chapter 15 Networks Page 176 Physical Medium 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. Layer 5 Layer 4 Layer 3 Layer 2 Layer 1 SourceHost Layer 5 Layer 4 Layer 3 Layer 2 Layer 1 DestinationHost Layer 4 Layer 3 Layer 2 Layer 1 IntermediateRouter Layer 4 Layer 3 Layer 2 Layer 1 IntermediateRouter Layer 2 Layer 1 Low-LevelBridge

17 Communicating Via Layered Protocols Chapter 15 Networks Page 177 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. Layer 5 Layer 4 Layer 3 Layer 2 Layer 1 Layer 4 Layer 3 Layer 2 Layer 1 messagemessage msgBmsgBhdr4hdr4hdr3hdr3 msgAmsgAhdr4hdr4hdr3hdr3 msgBmsgBhdr4hdr4hdr3hdr3trl2trl2hdr2hdr2hdr1hdr1msgAmsgAhdr4hdr4hdr3hdr3trl2trl2hdr2hdr2hdr1hdr1 msgBmsgBhdr4hdr4hdr3hdr3 msgAmsgAhdr4hdr4hdr3hdr3 trl2trl2 trl2trl2 hdr2hdr2 hdr2hdr2 msgAmsgAhdr4hdr4hdr3hdr3 msgBmsgBhdr4hdr4hdr3hdr3 trl2trl2 trl2trl2 hdr2hdr2 hdr2hdr2 messagemessagehdr4hdr4 msgAmsgAhdr4hdr4hdr3hdr3 msgBmsgBhdr4hdr4hdr3hdr3 messagemessagehdr4hdr4

18 Layered Protocol Models Chapter 15 Networks Page 178 Several models have been developed to implement protocol hierarchies for networks. Reference Model #1: Open Systems Interconnection (OSI) End-user protocols, e.g., e-mail, file transfer, Web browsing, network management, videoconferencing.End-user protocols, e.g., e-mail, file transfer, Web browsing, network management, videoconferencing. Application Format data according to negotiations between source and destination; encrypt and decrypt messages.Format data according to negotiations between source and destination; encrypt and decrypt messages. Presentation Establish, maintain, and discontinue dialogues between a source and a destination; synchronize data transfer.Establish, maintain, and discontinue dialogues between a source and a destination; synchronize data transfer. Session Detect and handle end-to-end transmission errors; alter transmission rate when too much congestion is encountered.Detect and handle end-to-end transmission errors; alter transmission rate when too much congestion is encountered. Transport Route messages from their source to their destination; reroute traffic when heavy congestion is encountered.Route messages from their source to their destination; reroute traffic when heavy congestion is encountered. Network Detect and handle transmission errors between consecutive network devices; control access to the shared medium.Detect and handle transmission errors between consecutive network devices; control access to the shared medium. Data Link Transmit bits across physical medium; determine frequencies to use when transmitting; specify role of connector pins.Transmit bits across physical medium; determine frequencies to use when transmitting; specify role of connector pins. Physical

19 Chapter 15 Networks Page 179 Reference Model #2: Transmission Control Protocol/Internet Protocol (TCP/IP) Analogous to OSIs Application LayerAnalogous to OSIs Application Layer Application Analogous to OSIs Transport LayerAnalogous to OSIs Transport Layer TCP Analogous to OSIs Network LayerAnalogous to OSIs Network Layer IP Analogous to OSIs Physical and Data Link LayersAnalogous to OSIs Physical and Data Link Layers Lower Levels

20 Chapter 15 Networks Page 180 VersionHdrLen Service Type Flags Fragment Offset Total Length Identification Protocol Header Checksum Time To Live Source IP Address Destination IP Address Options & Padding (if any) The IP Header 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. Flags: Dont-Fragment flag and More-Fragments flag. Time To Live: Length of time (in seconds) the packet may stay in the Internet. Identification: All fragments of the same packet have the same ID number. VersionHdrLen Service Type Flags Fragment Offset Total Length Identification Total Length: The length of the entire packet in bytes (16-bit field means a 65,535-byte max). Fragment Offset: Offset from start of packet (in bytes) of current fragment. Protocol Header Checksum Time To Live Source IP Address Destination IP Address Options & Padding (if any) Header Checksum: Error-checking sum of all of the 16-bit values in the header. Destination IP Address: 32-bit IP address of the packets final destination. Protocol: Global ID # of the protocol used to create the packet (e.g., TCP). Source IP Address: 32-bit IP address of the packets original source. Options & Padding: Options include: No-operation-just-align; Military-security-application; Loose-source-routing; Record-route; Strict-source-routing; Record-internet-timestamps.

21 Chapter 15 Networks Page 181 File Transfer Protocol (FTP) Operating System controlprocesscontrolprocess Client System controlprocesscontrolprocess Server System TCP/IP Internet Operating System One active TCP connection before and after data transfer, just for control. Operating System datatransferdatatransfercontrolprocesscontrolprocess Client System controlprocesscontrolprocessdatatransferdatatransfer Server System TCP/IP Internet Operating System Two active TCP connections during data transfer, one for control and one for data.

22 packetpacket Chapter 15 Networks Page 182 Firewallspacketpacket packetpacketpacketpacketpacketpacket My Secure Network Outgoing packets for bad address/port combinations are rejected (e.g., no insider can http an external site). Incoming or outgoing packets are rejected on the basis of size or payload info. 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. Incoming packets for bad address/port combinations are rejected (e.g., no outsider can finger an internal site).

23 Chapter 16: The World Wide Web Chapter 16 The World Wide Web Page 183 Click on this piece of hypertext, and youre taken to... Type in a keyword and click the Go! pushbutton, and youre taken to... Click on this pushbutton, and youre taken to... The World Wide Web applies point-and- click hypermedia application software to facilitate accessing documents on the Internet via TCP-based protocols. And with additional downloaded software, elaborate Web sites that include more than text and simple images can be accessed.

24 Chapter 16 The World Wide Web Page 184 H yper T ext T ransport P rotocol (HTTP) Welcome to IEEExpl IEEE xpl Subscription Access Information usemap= Your institution subscribes to: • Search Xplore Database Your institution subscribes to: • IEEE All Society Periodicals Package (ASPP) Your online subscription includes access to the abstracts and full-text of IEEE journals, transactions, and magazines published since 1998: • IEEE journals, transactions, and magazines 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. Any questions? Contact IEEE Customer Service. Welcome to IEEExpl IEEE xpl Subscription Access Information usemap= Your institution subscribes to: • Search Xplore Database Your institution subscribes to: • IEEE All Society Periodicals Package (ASPP) Your online subscription includes access to the abstracts and full-text of IEEE journals, transactions, and magazines published since 1998: • IEEE journals, transactions, and magazines 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. Any questions? Contact IEEE Customer Service. 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 doesnt require specific formatting instructions, so two browsers may display a page differently.

25 Chapter 16 The World Wide Web Page 185 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. The vacancy is displayed on the job center kiosk......can be accessed by mobile devices......and is displayed on the Department of Tourism website.

26 Chapter 16 The World Wide Web Page 186 Uniform Resource Locators (URLs) A URL specifies three pieces of information: 1. Type of file transfer 1. Type of file transfer 2. Name of computer 2. Name of computer 3. Name of file 3. Name of file For example: http://www.cs.siue.edu/undergrad/BS/files/prerequisites.pdf http://www.cs.siue.edu/undergrad/BS/files/prerequisites.pdf 1. http:// - type of file transfer 1. http:// - type of file transfer 2. cs.siue.edu - name of the computer 2. cs.siue.edu - name of the computer 3. /undergrad/BS/files/prerequisites.pdf - location of the file on the computer 3. /undergrad/BS/files/prerequisites.pdf - location of the file on the computer Different types of file transfer: http:// - hypertext transfer protocol http:// - hypertext transfer protocol ftp:// - file transfer protocol ftp:// - file transfer protocol telnet:// - opens a telnet session telnet:// - opens a telnet session gopher:// - transfer file from a gopher server gopher:// - transfer file from a gopher server mailto:- open a mail session mailto:- open a mail session

27 Chapter 16 The World Wide Web Page 187 Network Interface HTTPClientHTTPClientFTPClientFTPClient BrowserController Client software running on the workstation BrowserController Client software running on the workstation JavaInterpreterJavaInterpreter HTMLInterpreterHTMLInterpreter Display Driver Issuing requests for external files Web Browsing Input from mouse & keyboard Communications with remote Web server Output to usersdisplay Interpretingdownloaded Web pages and files

28 Chapter 16 The World Wide Web Page 188 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.

29 Chapter 16 The World Wide Web Page 189 Comparing Search Engines 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 Share of Searches

30 Chapter 17: Limitations of Computing Chapter 17 Limitations of Computing Page 190 What problems cannot be solved on a computer? What problems cannot be solved on a computer in a reasonable amount of time? These arent 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.

31 Chapter 17 Limitations of Computing Page 191 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: 1)A tape of cells from which symbols can be read and into which symbols can be written, 2)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 3)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: a)Determine which symbol to place in the current cell, b)Determine whether to move the read/write head one cell to the left or right, and c)Determine the next state of the machine. Tape Read/Write Head Control Unit

32 Chapter 17 Limitations of Computing Page 192 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. STARTSTARTADDADDCARRYCARRY NO CARRY OVERFLOWOVERFLOW HALTHALTRETURNRETURN*/*/L1/0/L1/0/L 0/1/L0/1/L 0/0/L,1/1/L */1/L */*/R*/*/R */*/R */*/- 0/0/R,1/1/R *101* State:START *101* State:ADD *100* State:CARRY *110*State: *110*State: *110* State:RETURN *110* State:RETURN *110* State:RETURN *110* State:RETURN *110* State:HALT

33 Chapter 17 Limitations of Computing Page 193 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). 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? One classical example:

34 Chapter 17 Limitations of Computing Page 194 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; } void printB() { int i; int i; for (i = 1; i <= 100; i++) for (i = 1; i <= 100; i++) cout << 0 << endl; cout << 0 << endl;} void printC(int n) { int i; int i; for (i = 1; i <= n; i++) for (i = 1; i <= n; i++) cout << 0 << endl; cout << 0 << endl;} void printD(int n) { int i,j; int i,j; for (i = 1; i <= n; i++) for (i = 1; i <= n; i++) for (j = 1; j <= n; j++) for (j = 1; j <= n; j++) cout << 0 << endl; cout << 0 << endl;} 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: n 2 Time Complexity: O(n 2 ) The big-O notation provides information regarding the programs order of complexity. O(1) indicates that the execution time doesnt relate to the size of the number n. O(n) indicates that the execution time increases linearly as n increases. O(n 2 ) indicates that the execution time increases quadratically as n increases. The big-O notation provides information regarding the programs order of complexity. O(1) indicates that the execution time doesnt relate to the size of the number n. O(n) indicates that the execution time increases linearly as n increases. O(n 2 ) indicates that the execution time increases quadratically as n increases.

35 Chapter 17 Limitations of Computing Page 195 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 log 2 (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: a k n k +a k-1 n k-1 +…+a 2 n 2 +a 1 n+a 0 An algorithm is said to have exponential time complexity if the number of steps in its execution is bounded by some exponential function: k(2 n ) Essentially, this means that increasing the size of the problem (n) by one would double the execution time. log 2 (n) n n2n2n2n2 n3n3n3n3 2n2n2n2n 252512531 31010010001024 42040080001048576

36 Chapter 17 Limitations of Computing Page 196 Big-O An algorithms time complexity is dominated by its most significant term. For example, an algorithm that executes in time n 2 +10n is considered to be O(n 2 ) because, as n increases, the n 2 term ultimately dominates the n term. Additional examples: 5n + n 2 + 0.125n 3 is O(n 3 ) log 2 (n) + n 2 + 2 n is O(2 n ) 100n + max(n 2, 1000 - n 3 ) is O(n 2 ) n 3 - (n 3 - 80n 2 - 800n) is O(n 3 ) 1000000 + 0.000001log 2 (n) is O(log 2 (n))

37 Chapter 17 Limitations of Computing Page 197 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 problems 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 b 1, b 2, … b n, and a boolean function f (b 1, b 2, …, b n ), 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++) b i = choice(true, false); b i = choice(true, false); if (f(b 1, b 2,…, b n ) == true) satisfiable = true; satisfiable = true; else satisfiable = false; for (i = 1; i <= n; i++) b i = choice(true, false); b i = choice(true, false); if (f(b 1, b 2,…, b n ) == true) satisfiable = true; satisfiable = true; else satisfiable = false;

38 Chapter 17 Limitations of Computing Page 198 The Knapsack Problem The Knapsack Problem involves taking n valuable jewels J 1, J 2,…,J n, with respective weights w 1, w 2,…, w n, and prices p 1, p 2,…, p n, 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. (Its 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++) { b i = choice(true, false); b i = choice(true, false); if (b 1 == true) if (b 1 == true) { TotalWorth+= p i ; TotalWorth+= p i ; TotalWeight += w i ; TotalWeight += w i ; }} if (TotalWeight <= M) cout << Woo-hoo! << endl; cout << Woo-hoo! << endl;else cout << Doh! << endl; cout << Doh! << endl; A Nondeterministic Polynomial Solution: TotalWorth = 0; TotalWeight = 0; for (i = 1; i <= n; i++) { b i = choice(true, false); b i = choice(true, false); if (b 1 == true) if (b 1 == true) { TotalWorth+= p i ; TotalWorth+= p i ; TotalWeight += w i ; TotalWeight += w i ; }} if (TotalWeight <= M) cout << Woo-hoo! << endl; cout << Woo-hoo! << endl;else cout << Doh! << endl; cout << Doh! << endl;

39 Supplement: Computer Ethics Supplement Computer Ethics Page 199 How dependable is computer technology? In 1994, Intels 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 werent 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:Intels competitors condemned Intel, but all of the press Intel received, while negative, turned it into a household name.

40 Unsolicited Commercial E-Mail Supplement Computer Ethics Page 200 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. Various techniques have been developed for dealing with the spam that plagues peoples e-mail accounts. 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. 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.

41 Identity Theft Supplement Computer Ethics Page 201 Rank Victim State Victims per 100,000 Population Number of Victims 1Arizona147.89,113 2Nevada120.02,994 3California113.541,396 4Texas110.626,006 5Florida98.317,780 6Colorado92.54,395 7Georgia86.38,084 8 New York 85.216,452 9Washington83.45,336 10 New Mexico 82.91,621 11Maryland82.94,656 12Illinois78.610.080 13Oregon76.12,815 14 New Jersey 73.36,394 15Virginia67.25,137 16Michigan67.26,784 17Delaware66.7569 18Connecticut65.82,305 19Pennsylvania64.98,080 20 North Carolina 64.95,748 21Missouri64.23,753 22Massachusetts63.74,102 23Oklahoma63.02,254 24Indiana62.23,928 25Utah61.81,577Rank Victim State Victims per 100,000 Population Number of Victims 26Tennessee61.33,700 27Alabama60.32.774 28Ohio59.96,878 29Kansas58.81,626 30 Rhode Island 57.6615 31Alaska57.3384 32 South Carolina 55.72,408 33Minnesota55.62,872 34Arkansas54.71,537 35Louisiana52.62,256 36Mississippi51.31,494 37Nebraska49.1868 38Idaho49.0718 39Hawaii47.8615 40 New Hampshire 46.1606 41Montana45.9434 42Wisconsin45.62,536 43Wyoming42.3218 44Kentucky42.01,766 45Maine39.7525 46 West Virginia 39.3715 47Iowa34.91,041 48 South Dakota 30.2236 49 North Dakota 29.7189 50Vermont28.5178 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

42 Electronic Monitoring Supplement Computer Ethics Page 202 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.

43 E-WasteSupplement Computer Ethics Page 203 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 Televisions and computer monitors that contain cathode ray tubes LCD desktop monitors LCD desktop monitors Laptop computers with LCD displays Laptop computers with LCD displays LCD televisions LCD televisions Plasma televisions Plasma televisions Portable DVD players with LCD screens. Portable DVD players with LCD screens.


Download ppt "Chapter 15: Networks Chapter 15 Networks Page 162 Data communication networks are set up in two basic configurations. While this approach guarantees a."

Similar presentations


Ads by Google