300 likes | 452 Views
知的インタフェース特論. Main Topics for 1998. Concurrent Computation Models Formal Abstract Models Concurrent Programming Methodology. Keywords. Concurrency, Communication, Formal Semantics Verification, Distributed Computation, CSP. Textbook and Preferred Reading. Textbook.
E N D
知的インタフェース特論 Main Topics for 1998 • Concurrent Computation Models • Formal Abstract Models • Concurrent Programming Methodology Keywords Concurrency, Communication, Formal Semantics Verification, Distributed Computation, CSP 知的インタフェース特論
Textbook and Preferred Reading • Textbook Communicating Sequential Processes C.A.R. Hoare ISBN 0-13-153271-5 Necessary copies will be distributed at each lecture • Preferred Reading Communication and Concurrency, Milner (ISBN 0-13-115007-3) The Theory and Practice of Concurrency, Roscoe (ISBN 0-13-674409-5) Other materials will be shown on the web page. 知的インタフェース特論
Communication Links • The Web Pages Of Lectures: Http://www.agusa.nuie.nagoyau.ac.jp/person/yuen/csp.html Of CSP: Http://www.comlab.ox.ac.uk/oucl/ • The Mailing List Lecture-interface@agusa.nuie.nagoya-u.ac.jp To attend, write a message with subject “APPEND” to lecture-interface-control@agusa.nuie.nagoya-u.ac.jp 知的インタフェース特論
A Concurrent Computation Model communication Program2 Program1 Different from the sequential computation models (such as the classical automaton) in that: • Distributed controls (Synchronous or Asynchronous) • Intermediate observation by communication • Reactive behavior 知的インタフェース特論
Difficulties in Concurrency • Non-determinism • Synchronization • Open Semantics Caused by the distributed controls Relative constraints by communication mechanism Cannot be captured as simple functions 知的インタフェース特論
So, what’s the matter? Observation Programs in a network make a concurrent computation • Non-determinism Lack of stability • Synchronization Environment Dependency • Reactivity History Sensitiveness Hard to find a bug Hard to prove the correctness 知的インタフェース特論
P1 P2 delay P1 P2 Example (Wired Logic Circuit) BUT 知的インタフェース特論
Cf:=0; lf:=1; Send frame cf and ack lf; cf:=cf; (*) Loop begin got ack 0 ==> lf:=0; send frame cf and ack lf; cf:=cf & timeout ==> resend frame cf and ack lf; got ack 1 ==> lf:=1; send frame cf and ack lf; cf:=cf & timeout ==> resend frame cf and ack lf; Loop end Channel Channel Example (Sliding Windows Protocol) One bit protocol Station A Station B A station can send the next data without at most one acknowledge. 知的インタフェース特論
A0 0 1 B0 0 0 A1 1 0 B1 1 1 A2 An n 0 1 a Example cnt’d (SW Protocol) Station A Station B Events A sends frame 0, acks frame 1 B receives frame 0 B sends frame 0, acks frame 0 A receives frame 0 A sends frame 1, acks frame 0 B receives frame 1 B sends frame 1, acks frame 1 A receives frame 1 A sends frame 0, acks frame 1 Typical (intended) trace for the protocol Last frame # received correctly Current frame # 知的インタフェース特論
A0 0 1 B0 0 0 A0 0 1 B0 0 0 A1 1 0 Example cnt’d (SW Protocol) Station A Station B Events A sends frame 0, acks frame 1 B receives frame 0 B sends frame 0, acks frame 0 Frame get lost A resends frame 0, acks frame 1 B receives frame 0 B sends frame 0, acks frame 0 A receives frame 0 A sends frame 1, acks frame 0 A trace with time-out 知的インタフェース特論
A0 0 1 B0 B0 B1 1 0 0 1 0 1 A0 0 0 B1 1 0 A1 A1 1 1 1 0 Example cnt’d (SW Protocol) Station A Station B Events A and B sends frame 0, acks frame 1 A and B receives frame 0 with ack 1 A and B resend frame 0, ack frame 0 A and B receive frame 0 with ack 0 A and B send frame 1, acks frame 0 A and B receive frame 1 with ack 0 A and B send frame 1, acks frame 1 A and B receive frame 1 with ack 1 Duplicated trace 知的インタフェース特論
Then, how to tackle them? Verification of Programs • Test • Proof of correctness A Program is believed to be correct if it passes tests. Practical, but not complete A Program is correct if it is proved to be correct. Often not practical, but complete 知的インタフェース特論
In this Lecture…, We mainly focus on proofs of correctness since: • Concurrent Programs are difficult to be dealt with. • Reliability is often critical. • Formal Semantics can be the fundamental design principle. 知的インタフェース特論
Objectives For concurrent (network) programming: • High reliability • Maintenance with less effort • Appropriate flexibility 知的インタフェース特論
Techniques to be used = Abstract Formal Method • Too much details • A number of assumptions • Too complex semantics Formal Description (Computer) Program Too concrete very often Especially for concurrent (network) programs 知的インタフェース特論
A simple example from UNIX #include <stdio.h> #include <sys/types.h> #include <unistd.h> main(int argc,char **argv) { if (fork()==0) { printf(“This is a child process : %d\n”,getpid()); printf(“My parent is : %d\n”,getppid()); } else { printf(“This is the parent proess : %d\n”,getpid()); printf(“My parent is : %d\n”,getppid()); } } 知的インタフェース特論
Another Simple Example in Unix 知的インタフェース特論
A simple Example in JAVA 知的インタフェース特論
A simple Example in JAVA (cnt’d) Altair-yuen>>51 java ProcessEmu This is a parent thread : Thread-4 My parent thread is main This is a child thread : Thread-5 My parent thread is Thread-4 知的インタフェース特論
Why so difficult? Inappropriate Abstractness in Description • Operating System • Language Syntax System Call mechanism Various Data Structures Specification Objectives Semantic Coarseness Control mechanism 知的インタフェース特論
Prospects • Abstract Description • Automated Reasoning Mathematical Notation Semantic Clarity Abstractness Handling Specific Calculus Axiomatic Characterization Proof system 知的インタフェース特論
Spectrum • Global Synchronousness • Communication Mechanism • Network dynamism Assume the global tick or not. Synchronous or Asynchronous. Dynamic or Static Networks. 知的インタフェース特論
Computation Model communication Program1 Program2 • Control over programs • Communication Model Yes : Synchronous No: Asynchronous Synchronous / Asynchronous Implementation 知的インタフェース特論
Communicating Sequential Processes Hoare, C.A.R. (1978, 1985) • Asynchronous over program • Synchronous communication • Sequential control for each program • Static Configuration Http://www.comlab.ox.ac.uk/oucl/people/tony.hoare.html 知的インタフェース特論
What to be discussed for CSP Theoretical Aspect • Abstract Operational Model • Algebraic Characterization • Various Semantics Software-Model Aspect • Modeling • Tools • Verification Techniques 知的インタフェース特論
Communicating Process Model • Agents • Ports • Links One-to-one communication 知的インタフェース特論
, , ) ( S, S 1 The Operational Model LTS= Labeled Transition system Nondeterminism S 1 Nondeterminism 知的インタフェース特論
A Typical Example Is it the case that P=Q? 知的インタフェース特論
The Answer is… • Yes • No Since complete traces are identical Deadlock distinguishes them 知的インタフェース特論
A More subtle Example 知的インタフェース特論