Applications of Finite State Machines

Similar documents
Lecture 5: Flow Control. CSE 123: Computer Networks Alex C. Snoeren

Transport Protocols & TCP TCP

EEC-682/782 Computer Networks I

Transport Layer Protocols TCP

Transport Protocols and TCP: Review

Formal Definition of Computation. Formal Definition of Computation p.1/28

User Datagram Protocol

TCP : Fundamentals of Computer Networks Bill Nace

CS 5520/ECE 5590NA: Network Architecture I Spring Lecture 13: UDP and TCP

CS 716: Introduction to communication networks th class; 7 th Oct Instructor: Sridhar Iyer IIT Bombay

User Datagram Protocol (UDP):

CSC 4900 Computer Networks: TCP

Information Network 1 TCP 1/2

CS457 Transport Protocols. CS 457 Fall 2014

05 Transmission Control Protocol (TCP)

CS-461 Internetworking. Dr. Mohamed Aboutabl

EEC-484/584 Computer Networks. Lecture 16. Wenbing Zhao

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP 23.1

06/02/ Local & Metropolitan Area Networks 0. INTRODUCTION. 1. History and Future of TCP/IP ACOE322

3.5.6 TCP Connection Management

QUIZ: Longest Matching Prefix

23-3 TCP. Topics discussed in this section: TCP Services TCP Features Segment A TCP Connection Flow Control Error Control 23.22

Question. Reliable Transport: The Prequel. Don t parse my words too carefully. Don t be intimidated. Decisions and Their Principles.

CS4700/CS5700 Fundamentals of Computer Networks

CSE 461 The Transport Layer

CSE 461 Connections. David Wetherall

ECE 435 Network Engineering Lecture 9

Outline Computer Networking. Functionality Split. Transport Protocols

Mobile Transport Layer Lesson 10 Timeout Freezing, Selective Retransmission, Transaction Oriented TCP and Explicit Notification Methods

Problem 7. Problem 8. Problem 9

ECE697AA Lecture 3. Today s lecture

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

CSE/EE 461 Lecture 13 Connections and Fragmentation. TCP Connection Management

The Transport Layer: TCP & Reliable Data Transfer

Computer Networking. Reliable Transport. Reliable Transport. Principles of reliable data transfer. Reliable data transfer. Elements of Procedure

TCP/IP Transport Layer Protocols, TCP and UDP

Reliable Transport I: Concepts and TCP Protocol

Chapter 2 - Part 1. The TCP/IP Protocol: The Language of the Internet

Internet and Intranet Protocols and Applications

Lecture 3: The Transport Layer: UDP and TCP

Stream Control Transmission Protocol

Transport Layer Marcos Vieira

EE 610 Part 2: Encapsulation and network utilities

TCP and Congestion Control (Day 1) Yoshifumi Nishida Sony Computer Science Labs, Inc. Today's Lecture

CCNA R&S: Introduction to Networks. Chapter 7: The Transport Layer

Kent State University

THE HONG KONG POLYTECHNIC UNIVERSITY. Department of Computing. This is an open-book examination.

ICS 451: Today's plan. Sliding Window Reliable Transmission Acknowledgements Windows and Bandwidth-Delay Product Retransmission Timers Connections

Last lecture we talked about how Intrusion Detection works. Today we will talk about the attacks. Intrusion Detection. Shell code

Lecture 12: Transport Layer TCP again

Information Network 1 TCP 1/2. Youki Kadobayashi NAIST

TSIN02 - Internetworking

14-740: Fundamentals of Computer and Telecommunication Networks

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

CCNA Exploration Network Fundamentals. Chapter 04 OSI Transport Layer

Transport Layer (TCP/UDP)

Logic Model Checking

Fundamentals of Computer Networks ECE 478/578. Transport Layer. End- to- End Protocols 4/16/13. Spring Application. Application.

CSEP 561 Connections. David Wetherall

Fast Retransmit. Problem: coarsegrain. timeouts lead to idle periods Fast retransmit: use duplicate ACKs to trigger retransmission

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Page 1. Goals for Today" Discussion" Example: Reliable File Transfer" CS162 Operating Systems and Systems Programming Lecture 11

Part VI. Appendixes. Appendix A OSI Model and Internet Protocols Appendix B About the CD

OSI Transport Layer. Network Fundamentals Chapter 4. Version Cisco Systems, Inc. All rights reserved. Cisco Public 1

Introduction to Machine Learning

a. (4pts) What general information is contained in a LSR-PDU update that A might send?

TCP over Wireless PROF. MICHAEL TSAI 2016/6/3

Internetworking Protocols and Software (COMP416)

Theory of Computations Spring 2016 Practice Final Exam Solutions

COMP/ELEC 429/556 Introduction to Computer Networks

Reliable Transport I: Concepts and TCP Protocol

Outline. CS5984 Mobile Computing

Networking Technologies and Applications

TCP/IP Protocol Suite 1

4.0.1 CHAPTER INTRODUCTION

Lecture 13: Transportation layer

CS321: Computer Networks Congestion Control in TCP

CSCI-1680 Transport Layer I Rodrigo Fonseca

Connections. Topics. Focus. Presentation Session. Application. Data Link. Transport. Physical. Network

Unit 2.

Theory of Programming Languages COMP360

Lenuta Alboaie Computer Networks

Lecture 2 Finite Automata

CSCI-1680 Transport Layer I Rodrigo Fonseca

Lixia Zhang M. I. T. Laboratory for Computer Science December 1985

Internetworking Models The OSI Reference Model

Simulation of TCP Layer

Answers to Sample Questions on Transport Layer

Announcements. No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

RSC Part III: Transport Layer 3. TCP

CSE 634/590 Data mining Extra Credit: Classification by Association rules: Example Problem. Muhammad Asiful Islam, SBID:

CMPE 80N: Introduction to Networking and the Internet

ECE 435 Network Engineering Lecture 9

Page 1. Goals for Today" Placing Network Functionality" Basic Observation" CS162 Operating Systems and Systems Programming Lecture 15

Internetworking With TCP/IP

CS419: Computer Networks. Lecture 10, Part 2: Apr 11, 2005 Transport: TCP mechanics (RFCs: 793, 1122, 1323, 2018, 2581)

Basic Reliable Transport Protocols

Basic Protocols and Error Control Mechanisms

CSEP 561 Connections. David Wetherall

TCP. CSU CS557, Spring 2018 Instructor: Lorenzo De Carli (Slides by Christos Papadopoulos, remixed by Lorenzo De Carli)

Transcription:

15-453 Formal Languages, Automata, and Computation Applications of Finite State Machines Mihai Budiu Lecture 3 January 24, 2000 Formal languages and automata are probably the biggest success story of theoretical computer science: such a big success story that all computer systems in use today apply this theory in several ways. Lectures 3 and 4 will be dedicated to the description of real world applications of the Finite Automata. We will see applications in the following areas: formal specification FA describe how a system should be built in an unambiguous way, classification and machine-learning FA represent knowledge inside a computer, boolean function representation used by virtually all CAD tools for manipulation of digital circuits, model checking the main tool used to verify that hardware and software designs are correct. All these topics could have a whole course of their own, so our treatment will necessarily be informal. 1 System and Protocol Specification The first example we will consider is one of the fundamental components of the Internet: the TCP (transmission control protocol). A protocol specifies a set of rules that can be used by both parties to communicate. There are tens of implementations of TCP, but they implement the same protocol. Thus, a protocol is not a program. 1.1 TCP s Functions TCP is a protocol that must ensure reliable, in-order transmission of between two end-points. It uses the services of the IP (internet protocol) protocol, which can somes transmit packets from one end to the other. IP may however loose, duplicate or reorder packets. 1

Virtually all network protocols which deal with this issue use the same scheme: positive acknowledgements and retransmissions, asinfigure1. out X lost resent acknowledgment Figure 1: The positive acknowledgments are expected by the sender to certify that the has reached the destination. To prevent against interpreting old ACKs in the network as being ACKs for the current packet (the scenario in Figure 2), TCP needs to number both the and the ACK packets, to be able to indicate the correspondence. old ack X lost Figure 2: The and ACK packets must be numbered, to ensure that the right ACK matches that it is intended for. 1.2 Connection Set-Up The numbering cannot always start at 0, because we would run the risk of confusing duplicate packets from earlier connections with packets from the current connection. Each connection must start with a random sequence number. A protocol setup phase is necessary, where the two end-points that communicate agree on a common sequence numbering. Actually the two end-points agree on two sequences, one for each direction, because the TCP transmits both ways (i.e. it is a full-duplex protocol). They use packets labeled SYN (from synchronization) to achieve that. The simple-minded approach in Figure 3 is not enough. (See if you can figure out why.) syn x Figure 3: A flawed attempt to initiate the connection. 2

The scenario in Figure 4 would make the two hosts unable to communicate, because the receiver expects packets with a sequence number it will never see. OLD syn x REAL syn z syn z is ignored Figure 4: A failure case for the two-way handshake protocol. The actual rule to establish (and also, in a modified form, to tear-down) connections is called three-way handshake, and is displayed in Figure 5. The connection is considered established only after the three messages are received by their destinations. syn,x ack y Figure 5: The actual three-way handshake connection set-up protocol used by TCP/IP. Based on this kind of description, can you write one implementation of TCP? What would you do if, after you receive a SYN, you receive also an ACK? What happens if both parties send SYNs to each other, which cross paths in the network? What if you receive several SYNs in a row? What if...? There are many such questions to answer, and many possible scenarios for re-ordered, duplicated and lost packets. How do we describe succinctly the operation of TCP? 1.3 A Formal Specification of TCP There has been too little material presented in the class so far, so the answer should be clear: using finite state machines (see attached copies of the protocol state-machine, from Douglas Comer s book, Internetworking with TCP/IP, volume I, Principles, Protocols and Architecture, Prentice Hall 1995, pages 219 220). These FA are a little different from what has been presented, because they are not used to recognize languages. Here are some of their features: They have, like DFAs, a finite number of states and transitions. Each transition is triggered not by reading a character but by an external event, like the receipt of a packet of or a out. Each transition also causes the automaton to output something, usually a packet. The transitions are labeled with both the input and the output, separated by slash. 3

There s no notion of an accepting state; such an automaton computes forever. If there s no transition from a state for a specific event (e.g. there s no arrow out of the LISTEN state labelled with the received packed FIN), it means that the automaton remains in the same state upon receipt of the event. This kind of specification is not simply a pedagogical device, it is actually part of the standard which describes how TCP behaves. The Internet standards are called Request For Comments (RFC for short). TCP is described in RFC 793, and some corrections to the state-machine are made in RFC 1122. You can download these documents for instance from http://www.cis.ohio-state.edu/htbin/rfc/rfc793.html and http://www.cis.ohio-state.edu/htbin/rfc/rfc1122.html. This automaton is a very concise and clear description of the functionality of the TCP protocol, which a programmer can use un-ambiguously to write a program, or which could even be used by an automated system to generate the skeletal code. We leave the explanation of the detailed states to a networking class: now you have the tools to fully understand it. 2 Machine Learning and Data Classification First let us answer a question: are there finite languages (i.e. which only contain a finite number of words) which are also regular? Well, if there are finitely many words, we can definitely recognize them with finitely many states. So all finite languages are regular. Try to argue that a DFA which accepts a finite language cannot contain loops (cycles) in the state graph. We can see the task of decision taking in the presence of a finite amount of (e.g. answers to a finite number of questions) as a language acceptance problem; the following paragraphs will illustrate how. 2.1 Decision Trees A decision tree is a kind of finite automaton in which the states ask questions, and make transitions based on the answers. Decision trees are a very important tool of the Artificial Intelligence (see for instance the book Machine Learning, by Tom Mitchell, published by McGraw-Hill in 1997, which has a whole chapter devoted to decision trees). Figure 6 gives an example of a decision tree which helps us decide if we should play tennis on a given day according to weather. Again, this is not exactly the DFA we were taught about, but it has the main features: The states are labeled with questions. The arcs are labeled with answers. The final (accepting) states have no successors, and are labeled with the final decision. 4

Outlook sunny rain overcast Humidity No Wind high normal strong weak No Yes No Yes Figure 6: A decision tree for whether to play tennis. There are lots of interesting questions about decision trees, like, how to build one given just some raw, possibly from an expert, how to build a smallest tree, how to handle errors and omissions in the, etc. We will leave these topics for a course specialized in Artificial Intelligence. Decision trees have been successfully used to build expert systems for medical diagnosis, credit risk assessment for loan applicants, evaluating positions in the end-game of chess, etc. Once a tree is built, you can use it to classify. The reverse problem, of learning automatically trees from the, is one of the subjects of machine learning. 2.2 Conclusion What is interesting to us is the power of representation that FA have: very often they can successfully classify a huge amount of in a very compact way: DFA can represent in a compact way information about large languages (the classical DFA taught in lecture 2 can represent even infinite languages, in a finite way!). 3 To Be Continued In the next lecture we will see a very closely related relative of the decision trees, the Binary Decision Diagrams (BDDs), which are used to represent boolean functions of several variables f(x 1,x 2,...,x n ), (or, in the perspective we have now, to classify vectors of size n of boolean values: the vector (v 1,v 2,...,v n ) is classified according to the value of the function f when applied to that vector: if f(v 1,v 2,...,v n ) true or false? BDDs are are an ingredient found in most CAD tools for analyzing digital circuits, the main ingredient of computer systems. We have also seen that we can represent systems and protocols as FAs; we will see a tool which can analyze such FA, to prove or disprove some of their properties: this is the area of model checking. 5