concurrent message processing using transactional memory in the actor model wtm 2013 pascal felber,...
TRANSCRIPT
![Page 1: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/1.jpg)
Concurrent Message Processing using Transactional
Memory in the Actor ModelWTM 2013
Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe
![Page 2: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/2.jpg)
Yaroslav Hayduk 2
The Actor Model
• Hewitt & Baker - „Laws for Communicating Parallel Processes“
• Motivated by the prospect of highly parallel computing machines with many microprocessors + own local memory
![Page 3: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/3.jpg)
Yaroslav Hayduk 3
The Actor Model – basic principles
• everything is an actor (VS an object)• asynchronous message passing• has access to its local state only • strong encapsulation• inherently concurrent
![Page 4: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/4.jpg)
Yaroslav Hayduk 4
OOP and Actors: Communication
Object A Object B
Actor A Object B
ObjectB.publicField=10ObjectB.publicMethod()
ActorA [SendMessageTo] ActorB
VS
asynchronous message passing
direct access
![Page 5: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/5.jpg)
5
Essential Actor properties
• Processes one message at a time– Yey! No race conditions or other hazards
• No (access to) shared state • Can send messages to other actors only• Switch its behavior
Yaroslav Hayduk
![Page 6: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/6.jpg)
6
Behind the (Actor) scenes
Yaroslav Hayduk
Mailbox…Contains 2 Insert 3
2 5 6 8 9
Local Actor state
In progress:Contains 8
C
A
B
A “List” Actor
Remove 9
![Page 7: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/7.jpg)
Yaroslav Hayduk 7
Main issues
1.The processing of one message at a time
![Page 8: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/8.jpg)
Yaroslav Hayduk 8
Notable Related Work
• Scholliers et al. – Parallel Actor Monitors– does not use STM for processing messages
concurrently• Shams et al. – Habanero Scala– async-finish programming model– processes parts of one message (and not many
messages) concurrently
![Page 9: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/9.jpg)
Yaroslav Hayduk 9
Idea:
Process multiple messages concurrently
• Problem: the list can be easily corrupted• Solution: Wrap each message processing in an
STM transaction. When conflicts happen, (roll back and) repeat the message processing
![Page 10: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/10.jpg)
Yaroslav Hayduk 10
Concurrent message processing
Actor Mailbox…Contains 2 Insert 3
2 5 6 8 9
Local Actor state
A “List” Actor
Messages In progress
Contains 6
Insert 12
… Insert 12
Each message is processed in a transaction
![Page 11: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/11.jpg)
11
Coordinated Transactions
Yaroslav Hayduk
A
A List Range (1..25) Actor
Global list sum
A List Range (100..125) Actor
……….
![Page 12: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/12.jpg)
Yaroslav Hayduk 12
Local Actor Sum: Zoom-in
2 5 6 8 9
Local Actor state
A List Range Actor
Messages In progress
1. Calculate local sum2. Forward new partial sum3. Block (for consistency)
New partial sumPrev partial sum
![Page 13: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/13.jpg)
Yaroslav Hayduk 13
Main issues
2.Extensive blocking of actors involved in a
coordinated transaction
![Page 14: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/14.jpg)
Yaroslav Hayduk 14
Idea:
Remove blocking; process other messages speculatively
• Pre-commit the local coordinated transaction• Process other messages in a transaction
speculatively
![Page 15: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/15.jpg)
Yaroslav Hayduk 15
Non-blocking coordinated transactions
2 5 6 8 9
Local Actor state
A List Range Actor
Messages In progress
Saved: Partially committed local coordinated transaction
Actor Mailbox…Contains 2 List sum
Speculatively process:Insert 3
![Page 16: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/16.jpg)
Yaroslav Hayduk 16
Evaluation
50 100 250 500 750 10000
10000
20000
30000
40000
50000
60000
List Actors = 8, Writes = 98%, Sum = 1%
Regular Concurrent Coordinated
Request Actors
Mill
is
![Page 17: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/17.jpg)
Yaroslav Hayduk 17
Evaluation
50 100 250 500 750 10000
10000
20000
30000
40000
50000
60000
70000
List Actors = 16, Writes = 98%, Sum = 1%
Regular Concurrent Coordinated
Request Actors
Mill
is
![Page 18: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/18.jpg)
Yaroslav Hayduk 18
Summary
• By using speculation, we can achieve a higher message throughput in the Actor Model
• By using STM we guarantee that the Actor’s state is never corrupted
![Page 19: Concurrent Message Processing using Transactional Memory in the Actor Model WTM 2013 Pascal Felber, Derin Harmanci, Yaroslav Hayduk and Anita Sobe first.last@unine.ch](https://reader036.vdocuments.us/reader036/viewer/2022083009/5697c0271a28abf838cd6219/html5/thumbnails/19.jpg)
Thank you Questions?