컴퓨터의기초 7 th Lecture 김현철 (2009 년여름학기 ) 컴퓨터공학부서울대학교 Copyrights 2008 Eom, Hyeonsang All Rights Reserved
순서 Networking and the Internet Algorithms Q&A
Networking and the Internet Network Fundamentals The Internet The World Wide Web Internet Protocols Security
Network Classifications Scope Local area network (LAN) Metropolitan area (MAN) Wide area network (WAN) Ownership Closed versus open Topology (configuration) Ring Bus Star
Network topologies
Network topologies (cont d)
Protocols Token ring Popular in ring networks Possession of token provides right to introduce new message CSMA/CD (Carrier Sense Multiple Access with Collision Detection) Used in Ethernet Silent bus provides right to introduce new message
Communication over a ring network
Communication over a bus network
Connecting Networks Repeater: Extends a network Bridge: Connects two compatible networks Switch: Connect several compatible networks Router: Connects two incompatible networks resulting in a network of networks called an internet
Building a large bus network from smaller ones
A router connecting a bus network to a star network
Inter-process Communication Client-server One server, many clients Server must execute continuously Client initiates communication Peer-to-peer (P2P) Two processes communicating as equals Peer processes can be short-lived
The client/server model compared to the peer-to-peer model
Distributed Systems Systems with parts that run on different computers Infrastructure can be provided by standardized toolkits Example: Enterprise Java Beans from Sun Microsystems Example:.NET framework from Microsoft
The Internet The Internet: An internet that spans the world Original goal was to develop a means of connecting networks that would not be disrupted by local disasters Today it has shifted from an academic research project to a commercial undertaking
Internet Architecture Domain: A portion of the Internet that network or internet controlled by a single authority Connected to the rest of the Internet (the cloud) by a router called a gateway Internet Corporation for Assigned Names & Numbers (ICANN): Oversees the registration of domain
A typical approach to connecting to the Internet
Strategies for connecting to the Internet Internet Service Provider (ISP): Provides connectivity to the Internet Popular means of connecting: Traditional telephone (dial up connection) Cable connections DSL (Digital Subscriber Line) Wireless
Internet Addressing: IP Addresses IP address: 32 bit identifier for a machine (currently being expanded to a 128 bit system) Network identifier: Assigned by ICANN Host address: Assigned by domain administrator Dotted decimal notation: Common notation for displaying IP addresses Example: 192.207.177.133
Internet Addressing: Host Names Mnemonic address made up of two parts: Domain name Assigned by a registrar Example: aw.com Top level domain: Classification of domain owner By usage Example:.com = commercial By country Example:.au = Australia Subdomains and individual host names Assigned by domain owner Example: r2d2.compsci.nowhereu.edu Translation between mnemonic addresses and IP addresses handled by name servers
Traditional Internet Applications Electronic Mail (email) Domain mail server collects incoming mail and transmits outing mail Mail server delivers collected incoming mail to clients via POP3 or IMAP File Transfer Protocol (FTP) Telnet and SSH (Secure Shell)
World Wide Web Hypertext and HTTP Browser gets documents from Web server Documents identified by URLs
A typical URL
Hypertext Document Format Entire document is printable characters Contains tags to communicate with browser Appearance <h1> to start a level one heading <p> to start a new paragraph Links to other documents and content <a href =... > Insert images <img src =... >
A simple Web page
A simple Web page (cont d)
An enhanced simple Web page
An enhanced simple Web page (cont d)
Internet Software Layers Application: Constructs message with address Transport: Chops message into packets Network: Handles routing through the Internet Link: Handles actual transmission of packets
Package-shipping example
The Internet software layers
Following a message through the Internet
TCP/IP Protocol Suite Transport Layer TCP UDP Network Layer IP (IPv4 and IPv6)
Choosing between TCP and UDP
Security Attacks Malware (viruses, worms, Trojan horses, spyware, phishing software) Denial of service Spam Protection Firewalls Spam filters Proxy Servers Antivirus software
Algorithms The Concept of an Algorithm Algorithm Representation Algorithm Discovery Iterative Structures Recursive Structures Efficiency and Correctness
Definition of Algorithm An algorithm is an ordered set of unambiguous, executable steps that defines a terminating process.
Algorithm Representation Requires well-defined primitives A collection of primitives constitutes a programming language
Folding a bird from a square piece of paper
Origami primitives
Pseudocode Primitives Assignment name expression Conditional selection if condition then action Repeated execution activity Procedure (generic names) while condition do procedure name
The procedure Greetings in pseudocode
Polya s Problem Solving Steps 1. Understand the problem 2. Devise a plan for solving the problem 3. Carry out the plan 4. Evaluate the solution for accuracy and its potential as a tool for solving other problems
Getting a Foot in the Door Try working the problem backwards Solve an easier related problem Relax some of the problem constraints Solve pieces of the problem first (bottom up methodology) Stepwise refinement: Divide the problem into smaller problems (top-down methodology)
Ages of Children Problem Person A is charged with the task of determining the ages of B s three children. B tells A that the product of the children s ages is 36. A replies that another clue is required. B tells A the sum of the children s ages. A replies that another clue is needed. B tells A that the oldest child plays the piano. A tells B the ages of the three children. How old are the three children?
How to Solve the Problem
Iterative Structures Pretest loop: while (condition) do (loop body) Posttest loop: repeat (loop body) until(condition)
The sequential search algorithm in pseudocode
Components of repetitive control
The while loop structure
The repeat loop structure
Sorting the list Fred, Alex, Diana, Byron, and Carol alphabetically
The insertion sort algorithm expressed in pseudocode
Recursion The execution of a procedure leads to another execution of the procedure Multiple activations of the procedure are formed, all but one of which are waiting for other activations to complete
Applying our strategy to search a list for the entry John
A first draft of the binary search technique
The binary search algorithm in pseudocode
A Copy of the Search Procedure Being Executed TargetValue = Bill
Another Copy of the Search Procedure Being Executed TargetValue = David
Another Copy of the Search Procedure Being Executed TargetValue = David
Algorithm Efficiency Measured as number of instructions executed Big theta notation: Used to represent efficiency classes Example: Insertion sort is in Θ(n 2 ) Best, worst, and average case analysis
Applying the insertion sort in a worst-case situation
Graph of the worst-case analysis of the insertion sort algorithm
Graph of the worst-case analysis of the binary search algorithm