Co 538 Concurrency Design Practice Concurrency is many
- Slides: 58
(Co 538) Concurrency – Design & Practice Concurrency is many things happening at the same time: so is the real world – and computers, to be useful, have to model relevant bits of it; it’s needed to support multiple demands (e. g. internet services, games, robotics, graphics/GUIs, mobile phones, bio-systems experiments, big physics modelling , real-time control, operating systems, …), even when running on a single processor; it’s needed to exploit multicore and multiprocessor systems; it’s needed for distributed systems and supercomputing; it’s needed for hardware design, implementation and operation. pretty much everything really … 11/1/2020 Copyright P. H. Welch 1
(Co 538) Concurrency – Design & Practice Concurrency is many things happening at the same time: so is the real world – and computers, to be useful, have to model relevant bits of it; it’s needed to support multiple demands (e. g. internet services, games, robotics, graphics/GUIs, mobile phones, bio-systems experiments, big physics modelling , real-time control, operating systems, …), even when running on a single processor; it’s needed to exploit multicore and multiprocessor systems; it’s needed for distributed systems and supercomputing; it’s needed for hardware design, implementation and operation. pretty … core much Computer everything Science really … 11/1/2020 Copyright P. H. Welch 2
(Co 538) Concurrency – Design & r Practice o f e t i s Concurrency is many things happening atuithe same time: q & e n r so is the real world – and computers, to be: useful, have to model g i e e r s l relevant bits of it; p e u D d a. o ) it’s needed to support multiple demands (e. g. internet services, – s i g m yphones, ) nbio-systems games, robotics, graphics/GUIs, mobile i c 3 n r n p e experiments, big m physicsgmodelling , real-time control, operating e S r u ( processor; r on a 2 single t when a running systems, …)u , even t u A e S nc 63 ( o it’s needed to h exploit multicore and multiprocessor systems; 8 o t d. C C 3 5 , it’s needed for distributed systems and supercomputing; o ” e c tice C n it’s needed a for hardware design, implementation and operation. c v ra d P “A pretty … core much Computer everything Science really … 11/1/2020 Copyright P. H. Welch 3
(Co 538) Concurrency – Design & Practice Concurrency errors are responsible for over 85% of diagnosed Windows system crashes … [M. M. Swift et al. , ACM SOSP-2003] So it’s important ! 11/1/2020 Copyright P. H. Welch 4
(Co 538) Research Engagement a language for concurrency occam- JCSP a concurrency library for Java 11/1/2020 Copyright P. H. Welch 5
(Co 538) Research Engagement For the past 20 years, this department has been a leading centre of research into theory and (especially) the practice of concurrency. Programming technologies have been (are being) developed here: occam- (an industrial strength programming language based on the formal process algebras of CSP and the –calculus); JCSP (a 100% pure Java library providing an API that supports the same concurrency model as occam- ); C++CSP / HCSP (a 100% pure C++ / Haskell library providing an API that supports the same concurrency model as occam- ). This module will teach this model though the programming technologies (we won’t be doing the formal mathematics). There will be lots of programming in this module. 11/1/2020 Copyright P. H. Welch 6
(Co 538) Research Engagement For the past 20 years, this department has been a leading centre of research into theory and (especially) the practice of concurrency. Recent (EPSRC) funded projects: TUNA 2005 -2007 (Kent, York, Surrey) Pilot Study on Emergence and Complex Systems RMo. X 2007 -2010 (Kent) Fast light safe concurrent operating systems (£ 0. 3 M) Co. SMo. S 2007 -2012 (Kent, York) (+ Microsoft Research Cambridge, Celoxica Ltd. , Chris Alexander) Complex Systems Modelling and Simulation (£ 1. 3 M) 11/1/2020 Copyright P. H. Welch 7
(Co 538) Research Engagement For the past 20 years, this department has been a leading centre of research into theory and (especially) the practice of concurrency. The key new concepts: processes (water-tight components) synchronised communication (over channels) networks (processes connected by channels – arbitrary shapes) choice (waiting for and reacting to events) dynamics (run-time network construction and re-shaping) structure (networks within networks) mobility (agents) 11/1/2020 Copyright P. H. Welch 8
Space (2 D) and Mobile Agents The Matrix Mobile Agents 11/1/2020 Copyright P. H. Welch 9
Space (2 D) and Mobile Agents 11/1/2020 Copyright P. H. Welch 10
Space (2 D) and Mobile Agents 11/1/2020 Copyright P. H. Welch 11
Space (2 D) and Mobile Agents 11/1/2020 Copyright P. H. Welch 12
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell cell ∙∙∙ draw keywatch keyboard 11/1/2020 Copyright P. H. Welch 13
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell cell ∙∙∙ draw phase 1 keywatch display screen keyboard 11/1/2020 Copyright P. H. Welch 14
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell keywatch cell phase 0 cell display cell ∙∙∙ draw screen keyboard 11/1/2020 Copyright P. H. Welch 15
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell keywatch cell display phase 0 cell ∙∙∙ draw screen keyboard 11/1/2020 Copyright P. H. Welch 16
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell cell ∙∙∙ draw phase 1 keywatch display screen keyboard 11/1/2020 Copyright P. H. Welch 17
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell keywatch cell display phase 0 cell ∙∙∙ draw screen keyboard 11/1/2020 Copyright P. H. Welch 18
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell keywatch cell display cell phase 0 cell ∙∙∙ draw screen keyboard 11/1/2020 Copyright P. H. Welch 19
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell clot cell ∙∙∙ draw phase 1 keywatch display screen keyboard 11/1/2020 Copyright P. H. Welch 20
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell clot cell ∙∙∙ draw phase 1 keywatch display screen keyboard 11/1/2020 Copyright P. H. Welch 21
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell clot cell ∙∙∙ draw phase 1 keywatch display screen keyboard 11/1/2020 Copyright P. H. Welch 22
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell clot cell ∙∙∙ draw phase 1 keywatch display screen keyboard 11/1/2020 Copyright P. H. Welch 23
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell cell ∙∙∙ draw phase 1 keywatch display screen keyboard 11/1/2020 Copyright P. H. Welch 24
Blood Platelet Model (‘lazy’ CA) clot gen ∙∙∙ cell cell ∙∙∙ draw phase 1 keywatch display screen keyboard 11/1/2020 Copyright P. H. Welch 25
PROC numbers (CHAN INT out!) CHAN INT a, b, c: PAR delta (a? , out!, b!) succ (b? , c!) prefix (0, c? , a!) : 0 PROC pairs (CHAN INT in? , out!) CHAN INT a, b, c: PAR delta (in? , a!, c!) tail (a? , b!) plus (b? , c? , out!) : 11/1/2020 Copyright P. H. Welch b numbers + out a b 0 c integrate a in a succ c PROC integrate (CHAN INT in? , out!) CHAN INT a, b, c: PAR in delta (a? , out!, b!) prefix (0, b? , c!) plus (in? , c? , a!) : out tail c b + out pairs 26
PROC fibonacci (CHAN INT out!) CHAN INT a, b, c, d: PAR delta (a? , b!, out!) pairs (b? , c!) prefix (0, d? , a!) prefix (1, c? , d!) : 1 Copyright P. H. Welch 0 a pairs c PROC squares (CHAN INT out!) CHAN INT a, b: PAR numbers (a!) integrate (a? , b!) pairs (b? , out!) : 11/1/2020 d out b fibonacci squares numbers a integrate b pairs out 27
At this level, we have a network of 5 communicating processes. Note: use of channel array PROC demo (CHAN BYTE out!) [4]CHAN INT c: PAR numbers(c[0]!) squares(c[1]!) fibonacci (c[2]!) times (c[3]!) print. streams (c? , out!) : numbers c[0] squares fibonacci c[2] c[1] times c[3] print. streams demo out In fact, 28 processes are involved: 18 non-terminating ones and 10 low-level transients (repeatedly starting up and shutting down for parallel input and output). BUT we don’t need to know that to reason at this level … 11/1/2020 Copyright P. H. Welch 28
At this level, we have a network of 5 communicating processes. Note: use of channel array PROC demo (CHAN BYTE out!) [4]CHAN INT c: PAR numbers(c[0]!) squares(c[1]!) fibonacci (c[2]!) times (c[3]!) print. streams (c? , out!) : numbers c[0] squares fibonacci c[2] c[1] times c[3] print. streams demo out Fortunately, CSP semantics are compositional – which means that we only have to reason at each layer of the network in order to design, understand, code, and maintain it. 11/1/2020 Copyright P. H. Welch 29
Mandelbrot Set 11/1/2020 Copyright P. H. Welch 30
Mandelbrot Set 11/1/2020 Copyright P. H. Welch 31
Mandelbrot scrolling cancel farmer iterations target . . . control colours harvester >>> <<< display. List top left scale graphics mouse. Movement canvas key mouse 11/1/2020 Copyright P. H. Welch 32
component. Event ( Component. Event ) display. List ( Graphics. Command ) general drawing to. Graphics ( Graphics. Protocol ) from. Graphics ( Object ) house-keeping (e. g. size? ) focus. Event ( Focus. Event ) Active. Canvas key. Event ( Key. Event ) mouse. Event ( Mouse. Event ) mouse. Motion. Event ( Mouse. Event ) java. awt. events
Multi-Pong 11/1/2020 Copyright P. H. Welch 34
left right scorer Multi. Pong keycontrol . . . collision detect canvas control new game 11/1/2020 flasher mouse freeze Copyright P. H. Welch 35
Travelling Salesman Problem “jcsp: //tsp. myrtle. ukc. ac. uk” Master myrtle . . . Global minimum maintained in ring (made with one-place overwriting channel buffers) … easy!!! 11/1/2020 Copyright P. H. Welch 36
Mobile Processes (Agents) “ukc. agent. 007” in a b c UKC 11/1/2020 Copyright P. H. Welch 37
Mobility via Mobile Channels (Tarzan) . . . To swing down a chain of 1 M servers, exchanging one INT during each visit: 770 nsecs/visit (P 3), 280 nsecs/visit (P 4) To swing down a chain of 1 M servers, but doing no business: 450 nsecs/visit (P 3), 120 nsecs/visit (P 4) 11/1/2020 Copyright P. H. Welch 38
Nature is not serial. . . Components must compose … CSP, processes, patterns … It was twenty years ago today … Threads considered harmful … Modelling complex systems … Blood clotting, robots, parrots … 11/1/2020 Copyright P. H. Welch 39
Twenty Years Ago … “… improved understanding and architecture independence were the goals of the design by Inmos of the occam multiprocessing language and the Transputer. The goals were achieved by implementation of the abstract ideas of process algebra and with an efficiency that is today almost unimaginable and certainly unmatchable. ” C. A. R. Hoare, March 2004. 11/1/2020 Copyright P. H. Welch 40
2003 … We have been extending the classical (CSP) occam language with ideas of mobility and dynamic network reconfiguration which are taken from Milner’s -calculus (occam- ). We have found ways of implementing these extensions that still involve significantly less resource overhead than that imposed by the higher level – but less structured, informal and non -compositional – concurrency primitives of existing languages (such as Java) or libraries (such as POSIX threads). 11/1/2020 Copyright P. H. Welch 41
2003 … We have been extending the classical (CSP) occam language with ideas of mobility and dynamic network reconfiguration which are taken from Milner’s -calculus (occam- ). As a result, we can run applications with the order of millions of concurrent processes on modestly powered PCs. We have plans to extend the system, without sacrifice of too much efficiency and none of logic, to simple clusters of workstations, wider networks such as the Grid and small embedded devices. 11/1/2020 Copyright P. H. Welch 42
2003 … In the interests of proveability, we have been careful to preserve the distinction between the original static point-to-point synchronised communication of occam and the dynamic asynchronous multiplexed communication of calculus; in this, we have been prepared to sacrifice the elegant sparsity of the -calculus. We conjecture that the extra complexity and discipline introduced will make the task of developing, proving and maintaining concurrent and distributed programs easier. 11/1/2020 Copyright P. H. Welch 43
Nature is not serial. . . Components must compose … CSP, processes, patterns … It was twenty years ago today … Threads considered harmful … Modelling complex systems … Blood clotting, robots, parrots … 11/1/2020 Copyright P. H. Welch 44
Threads-n-Locks Considered Harmful n n Easy to learn – but very difficult to apply safely … Monitor methods (for example) are tightly interdependent – their semantics compose in exponentially complex ways. The whole skill lies in setting up and staying in control of these complex interactions … Threads have no structure … there are no threads within threads … Big problems when it comes to scaling up complexity … 11/1/2020 Copyright P. H. Welch 45
Threads-n-Locks Considered Harmful Most objects are dead – they have no life of their own. All methods have to be invoked by an external thread of control – they have to be caller oriented … … a curious property of object-oriented design? 11/1/2020 count state ready Copyright P. H. Welch 46
Threads-n-Locks Considered Harmful The object is at the mercy of any thread that sees it. Nothing can be done to prevent method invocation. . . … even if the object is not in a fit state to service it. The object is not in control of its life. 11/1/2020 count state ready Copyright P. H. Welch 47
Threads-n-Locks Considered Harmful Each single thread of control snakes around objects in the system, bringing them to life transiently as their methods are executed. Threads cut across object boundaries leaving spaghetti-like trails, paying no regard to the underlying structure 11/1/2020 Copyright P. H. Welch 48
Threads-n-Locks Considered Harmful Each object is at the mercy of any thread that sees it. Nothing can be done to prevent method invocation … even if the object is not in a fit state to service it. The object is not in control of its life Big problems occur when multiple threads hit the same object. 11/1/2020 Copyright P. H. Welch 49
Threads-n-Locks Considered Harmful Errors in claiming/releasing locks is one of the main reason our systems fail … Too much locking and we get deadlock … Too little locking and race hazards slowly corrupt … Sorting this out requires controlling all possible interleavings … which is exponential in the number of threads … 11/1/2020 Copyright P. H. Welch 50
Threads-n-Locks Considered Harmful Compare this design structure. . . 11/1/2020 Copyright P. H. Welch 51
left right scorer keycontrol . . . against this one Multi. Pong collision detect canvas control new game 11/1/2020 flasher mouse freeze Copyright P. H. Welch 52
(Co 538) Aims of this Module Present concurrency mechanisms that are easy to learn and easy to apply. Show to cope with other approaches to concurrency, which are easy to learn but hard to apply. Apply this knowledge to solve real-world problems. Improve programming skills generally – lots of programming! Bring you into contact with research and researchers. Enable some cool final year projects. Have fun and satisfaction in achieving something really important. + lots more information on the Co 538 website: www. cs. kent. ac. uk/co 538 11/1/2020 Copyright P. H. Welch 53
(Co 538) Teaching Methods Two lectures per week. Support seminars and practical classes (one or two per week) – exercises with (virtual) robots take place within these classes. Anonymous on-line questions-and-answers (an extensive library already exists and is catalogued and indexed). Slides available on-line (Powerpoint and PDF formats). Additional course notes (basic and related technical papers). Anonymous feedback questionnaire (with space for free-form crticism/praise) will be on-line towards the end of the course. Previous year’s Co 631* grade average: (07, 23) 70% (08, 42) 61% Previous year’s Co 632 grade average: (07, 23) 68% * Co 631 Co 538 11/1/2020 Copyright P. H. Welch 54
(Co 538) Teaching Methods Two lectures per week. Support seminars and practical classes (one or two per week) – exercises with (virtual) robots take place within these classes. Anonymous on-line questions-and-answers (an extensive library already exists and is catalogued and indexed). Show video Slides available on-line (Powerpoint and PDF formats). Additional course notes (basic and related technical papers). Anonymous feedback questionnaire (with space for free-form crticism/praise) will be on-line towards the end of the course. Previous year’s Co 631* grade average: (07, 23) 70% (08, 42) 61% Previous year’s Co 632 grade average: (07, 23) 68% * Co 631 Co 538 11/1/2020 Copyright P. H. Welch 55
(Co 632) Advanced Concurrency – Design & Practice Concurrency is many things happening at the same time. This module introduces dynamics – the construction, evolution and termination of systems (or sub-systems) on-the-fly. This is needed for systems that: scale with demand (e. g. web services, air-traffic control); evolve with demand (e. g. peer-to-peer networking); model growing organisms (e. g. nanite assemblies); configure, load and run supercomputer resources (e. g. Grid computing, our TUNA and Co. SMo. S clusters). 32 * ( 3. 0 GHz. Pentium IV, 1 GB RAM) + 48 -way Fast Ethernet Switch 11/1/2020 funded and in procurement … Copyright P. H. Welch 56
(Co 632) Advanced Concurrency – Design & r Practice o f e t i Concurrency is many things happening at the sameistime. u q & e n r This module introduces dynamics – the construction, evolution and g : i e e r s termination of systems (or sub-systems) on-the-fly. l p e u D d a. o ) – s i g This is needed for systems that: m y ) n i c 3 n r n p scale with demand m (e. g. webeservices, air-traffic control); e S g r u r 2( t a t u u evolve with demand networking); c S peer-to-peer A e (e. g. 3 ( n 6 o 8 o h model 3 growing organisms (e. g. nanite assemblies); t C C 5 d , o ” e configure, load and run supercomputer resources e c C c n our i t (e. g. Grid computing, TUNA and Co. SMo. S clusters). a c v ra d A P “ 32 * ( 3. 0 GHz. Pentium IV, 1 GB RAM) + 48 -way Fast Ethernet Switch 11/1/2020 funded and in procurement … Copyright P. H. Welch 57
(Co 632) Advanced Concurrency – Design & Practice ) r is for The TUNA cluster e w o modelling self-assembling and p he evolving tnanite assemblies * (4 ), in particular safety (nanobots r te mechanisms allowing their s u l cdeployment in human medicine. S o One study concerns artificial M S o blood platelets for emergency C response to major injuries. This to n o is research council funded, but o s will be available to students ng i d taking this module. ra g p U 32 * ( 3. 0 GHz. Pentium IV, 1 GB RAM) + 48 -way Fast Ethernet Switch 11/1/2020 Copyright P. H. Welch 58
- Https://xkcd.com/538/
- Qué significa el caballo amarillo
- Round 68 538 to the nearest ten
- Many sellers and many buyers
- Er diagram many to many
- Unary many to many
- Erm erd
- Unary many to many
- Contoh erd many to many
- Unary many to many
- Many-to-many communication
- Sqlbi many to many
- Ternary relationship database
- Many sellers and many buyers
- Practice assessor feedback examples
- Triangle points of concurrency
- Circumcenter practice problems
- Concurrency in web applications
- Perpendicular bisector concurrency conjecture
- Concurrency control and recovery
- Unreal engine multithreading
- Unix concurrency mechanisms
- Concurrency control adalah
- Pitfalls of lock based protocol
- Concurrency control in distributed databases
- Concurrency control in distributed transactions
- Ada concurrency
- Ccs milner
- Safety and liveness in concurrency
- Nested state diagram
- Concurrency
- Transactions and concurrency control in distributed systems
- Subprogram level concurrency
- Point of concurrency of medians
- 5-3 bisectors in triangles answer key
- Concurrency semaphore
- Concurrency visualizer
- Binary lock in dbms example
- Statement level concurrency
- Concurrency stamp
- Non concurrency endorsement
- Concurrency issues in java
- Youjip
- Concurrency
- Concurrency monitor
- Chapter 4 operating system
- Statement level concurrency
- Statement level concurrency
- Statement level concurrency
- Cohen move on up "torrent"
- Microsoft flow concurrency control
- Concurrency exercises
- Timestamp based concurrency control
- The bass and treble staffs connected by a brace
- Actor model concurrency
- What is concurrent transaction
- Junit test concurrency
- On optimistic methods for concurrency control
- Concurrency