Download presentation
Presentation is loading. Please wait.
1
C LAUS B RABRAND © C ONCURRENCY (Q3,’07) F EB 05, 2007 C ONCURRENCY Claus Brabrand brabrand@daimi.au.dk [ http://www.daimi.au.dk/~brabrand/ ]
2
C LAUS B RABRAND © C ONCURRENCY (Q3,’07) F EB 05, 2007 W ELCOME !
3
C LAUS B RABRAND [ 3 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Agenda (Course Presentation) Course Presentation: Weekly schedule Aims & goals Exam & assessment Roles: students & teachers Motivation: ” Why bother learning about Concurrency!?!” Materials (book & notes) Week 1: ”Processes and Threads” Concepts Models (FSP) Practice (Java) Models (FSP) (Java) Practice
4
C LAUS B RABRAND [ 4 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Weekly Schedule Lectures: Mondays 11:15-14:00 (sometimes a bit less) Theoretical Exercise Classes (aka. “TØ”): Tuesdays 08:15-10:00 [ shannon.164 ] Practical Programming Labs (aka. “Lab”): Thursdays 10:15-12:00 [ zuse.127 ] Studying: Exercises, Reading, and Thinking(!) Compulsory homework: Hand-ins (Sunday deadlines), Mini-project 3 hrs/week 2 hrs/week ? hrs/week Expected total: 15 hrs/week
5
C LAUS B RABRAND [ 5 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Course Aims & Goals Your Aims & Goals: at huske udenad… at identificere brug af concurrency i (Java) programmer; at beskrive concurrency mekanismer i programmeringssprog (Java); at forklare fundamentale problemer, teknikker og løsninger indenfor concurrency; at forklare sammenhængen mellem modeller og programmer generelt; at relatere konkrete modeller og programmer; at sammenligne konkrete modeller; at ræsonnere om egenskaber af konkrete modeller og programmer; at implementere konkrete modeller i programmeringssprog (Java); at anvende ovenstående med henblik på at skabe konkrete modeller af systemer.
6
C LAUS B RABRAND [ 6 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Exam Eksamenerne er konstrueret til at evaluere din dybdeforståelse af concurrency i overensstemmelse med dine mål (se ovenfor). Jo bedre du kan ovenstående mål, jo bedre vil du klare dig til eksamen; du vil således kunne bruge målene overfor dig selv som en checkliste for din egen forståelse. Som en direkte konsekvens heraf vil der ikke være hverken "type"- eller "huske"-opgaver (som ikke nødvendigvis forudsætter dybdeforståelse). Eksamen: 13-skala karakter på baggrund af: (gruppe) mini-projektet samt (individuel) multiple-choice prøve...som begge vil være centreret omkring ovenstående mål NB: For at blive indstillet til eksamen, skal alle afleveringsopgaver være afleveret - og godkendt.
7
C LAUS B RABRAND [ 7 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Concurrency: Aims & Goals Exam Motivation Roles Program Project Exam Materials Classes Webboard Homepage [ http://www.daimi.au.dk/~brabrand/concurrency/ ]http://www.daimi.au.dk/~brabrand/concurrency/
8
C LAUS B RABRAND © C ONCURRENCY (Q3,’07) F EB 05, 2007 Y OUR R OLE Active Learning (!)
9
C LAUS B RABRAND [ 9 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Consider the following “alphabet” (60 secs): Exercise: Now write my office phone#: 89425771 ? Exercise 1 1. 2. 3. 4. 5. 6. 7. 8. 9. 0.
10
C LAUS B RABRAND [ 10 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Exercise 1 (cont’d) Suppose I now showed you…: Exercise: Now write my office phone#: 89425771 ? 123 456 789
11
C LAUS B RABRAND [ 11 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Exercise 1 (cont’d) So what is the point? Random information is really hard to remember We learn (efficiently) by associating (building) new unknown information / with (on) old known information Knowledge is constructed as a result of: Learner’s activity (!) In short: “You need to study”: i.e. read, make exercises, and think(!)
12
C LAUS B RABRAND © C ONCURRENCY (Q3,’07) F EB 05, 2007 C OLLABORATION Teaching / Learning Collaboration
13
C LAUS B RABRAND [ 13 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Roles (Teaching/Learning Collaboration) During learning period (i.e., before the exam): Teaching/Learning collaboration: You = “Learner” Learning responsibility Me = “Teacher” (and Teaching Assistant) (To the best of my ability) aid you in learning During the exam period: You = “Performer” Demonstrate what you have learned Me = “Evaluator” (Neutrally) assess your level of understanding
14
C LAUS B RABRAND © C ONCURRENCY (Q3,’07) F EB 05, 2007 M OTIVATION “Why bother learning about Concurrency?!?”
15
C LAUS B RABRAND [ 15 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 What is a Concurrent Program? A sequential program has a single thread of control A concurrent program has multiple threads of control: Perform multiple computations in parallel Control multiple external activities which occur at the same time
16
C LAUS B RABRAND [ 16 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Why Concurrent Programming? More appropriate program structure Concurrency reflected in program Performance gain from multiprocessing HW Parallelism Increased application throughput An I/O call need only block one thread Increased application responsiveness High-priority thread for user requests
17
C LAUS B RABRAND [ 17 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Concurrency vs. Sequentiality Sequential programming: Inherently deterministic Describe computation as a “reduction” of expressions to values Termination often desirable Resulting value is of primary interest and focus Concurrent programming: Inherently non-deterministic Describe execution as “process evolution” Describe possible executions (aka. execution traces) Describe possible interactions during execution Describe interaction with an environment Non-termination often desirable (e.g. Op.Sys., Control sys, Cell-phone, …) Resulting “value” is not (necessarily) interesting
18
C LAUS B RABRAND [ 18 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Concurrency is much Harder Harder than sequential programming: Huge number of possible executions Inherently non-deterministic Parallelism conceptually harder Consequences: Programs are harder to write(!) Programs are harder to debug(!) Errors are not always reproducible(!) New kinds of errors possible(!): Deadlock, starvation, priority inversion, interference, …
19
C LAUS B RABRAND [ 19 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Example Concurrency Problems Therac-25 Radiation Therapy ’85-’87 Massive overdoses (6 deaths / amputations)! Mars Pathfinder July ’97 Periodic resets Win95/98 w/ 3 rd -Party Device Drivers late ’90es Dysfunction (“blue screen of death”)!...on mars!
20
C LAUS B RABRAND [ 20 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Concurrency Problems (cont’d) Mobile Phones ’00-… Freeze and odd behaviors (really annoying)! Cruise Control System Model ’86 [Grady Booch] Accellerated after car ignition (car crashes)!
21
C LAUS B RABRAND [ 21 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 …and what about? Air Plane Control System Dysfunction (plane crash)! Nuclear Powerplant Control System Core melt-down (“China-syndrome”)! …
22
C LAUS B RABRAND [ 22 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Problem: System Development? In the presence of all these errors: deadlock, starvation, priority inversion, interference, anti-cooperation, un-intended execution traces, un-fairness, … How to…: 1. …design a system that “works” ? 2. …verify that the system is “safe” ? 3. …verify that the system “meets its specification” ? …and: What does “works”, “safe”, and “to meet a specification” mean ?!?
23
C LAUS B RABRAND [ 23 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Solution: Modeling “Models come to the rescue”: Create models (~ architecture, bridge construction, …) Formal modeling (e.g., “FSP”) permits: (Offline) Reasoning understanding (Runtime) Testing confidence (C-time) Property Verification safety (C-time) Specification Verification correctness Note: “Errors are much cheaper to commit in models than in implementations” “Never send a human to do a machine’s job” -- A.Smith (’99) auto- mate
24
C LAUS B RABRAND [ 24 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Methodology: Model-based Design Design abstract model Decompose model Reason/Test/Verify model individual parts and whole Recompose insights make model safe Impl. concrete program concretize REAL PROBLEM SAFE MODEL SAFE PROGRAM abstract ? ? ? ? MODEL test reason verify
25
C LAUS B RABRAND [ 25 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Program world Model world Concrete Abstract P M abstraction concretization Program vs. Model World (Java)(FSP) What discerns a really good programmer from one that is not so good is the capability of moving (consciously or unconsciously) between the concrete world of programs and the abstract world of semantic models (via abstraction and concretization). Specifically, such a programmer is capable of (consciously or unconsciously): - 1) abstracting programs into models - 2) reasoning about the models - 3) concretizing the insights back into the world of programs
26
C LAUS B RABRAND [ 26 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Program world Model world Concrete Abstract P M 1. P ?3. M ? 4. validate 5. M ! 7. P ! 2. abstract 6. concretize Program / Model Verification (Java)(FSP)
27
C LAUS B RABRAND [ 27 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Program world Model world Concrete Abstract ~ P P’ M M’ 1. P ~ P’ ? 2. abstract 3. M ~ M’ ? 4. relate 5. M ~ M’ ! 6. concretize 7. P ~ P’ ! Program / Model Relationship (Java)(FSP)
28
C LAUS B RABRAND [ 28 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Glasses of Abstraction… It’s Amazing… Abstract away computational details: see only concurrency aspects at appropriate level of abstraction! Only $12,95 “See only the relevant!” “ The Glasses of Abstraction ” COMPLEX PROGRAM MODEL abstraction
29
C LAUS B RABRAND [ 29 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Modeling: Level of Abstraction Consider a client/server system: Extremely abstract (high level of abstraction): Appropriate (level of abstraction) for … : Extremely concrete (low level of abstraction): System = (event -> System). NAND_Gate =... Transistor =... Accumulator =...... Client =... Server = (request->compute->reply->Server). Client = (calc->request->wait->reply->Client). Database =... higher level of abstraction
30
C LAUS B RABRAND [ 30 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Notes on Skill Acquisition Your skill acquisition will progress according to the following stages of learning: 4. Unconscious competence 3. Conscious competence 2. Conscious incompetence 1. Unconscious incompetence Course aim (and measurement): Level 3 Later in life, you probably mostly need level 4 …but you need to get there via level 3
31
C LAUS B RABRAND [ 31 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Modeling Language (e.g. “FSP”) Compositional: || Break things into (several) smaller things Algebraic: , Intuitive ideal and eases automated verification Syntactic: Provide basis for programming languages P || QPQ big P || Q Q || P P || (Q || R) USER = def (acquire -> use -> release -> USER). (P || Q) || R
32
C LAUS B RABRAND [ 32 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Parallel- vs. Concurrent Programming Strategy: Optimal strategy for a particular goal Use available resources efficiently Safety: Conceptually independent players Control interaction and “rules” The Football Match Analogy: “An analogy that one can make is with football*; - the coach of the team is a parallel programmer while - the referee is a concurrent programmer” -- [P.Panangaden, ’96] The Referee (~ the concurrent programmer): -- Make sure what is happening is a soccer match The Trainer (~ the parallel programmer): -- Make sure my agents are performing “optimally” */ interpret appropriately on either side of the Atlantic
33
C LAUS B RABRAND [ 33 ] © C ONCURRENCY (Q3,’07) F EB 05, 2007 Course Aims & Goals Your Aims & Goals: at huske udenad… at identificere brug af concurrency i (Java) programmer; at beskrive concurrency mekanismer i programmeringssprog (Java); at forklare fundamentale problemer, teknikker og løsninger indenfor concurrency; at forklare sammenhængen mellem modeller og programmer generelt; at relatere konkrete modeller og programmer; at sammenligne konkrete modeller; at ræsonnere om egenskaber af konkrete modeller og programmer; at implementere konkrete modeller i programmeringssprog (Java); at anvende ovenstående med henblik på at skabe konkrete modeller af systemer. T
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.