Concurency Models
Concurency Models
By Ms Ndinelago Nashandi
Concurrency
• Mobile apps need to do some of their processing on servers (“in the cloud”).
• Graphical user interfaces almost always require background work that does
not interrupt the user. For example, Eclipse compiles your Java code while
you’re still editing it.
• There are three common models for concurrent
Two Models for programming: shared memory ,message
Concurrent passing and Actor Models.
• A and B might be two threads in the same Java program (we’ll explain
what a thread is below), sharing the same Java objects.
Message passing
• A and B might be a web browser and a web server – A opens a connection to B, asks for a
web page, and B sends the web page data back to A.
• A and B might be two programs running on the same computer whose input and output
have been connected by a pipe, like ls | grep typed into a command prompt.
Actor Model
• The actor model has its theoretical roots in concurrency modelling [Hew73] and message
passing concepts [Hoa78]. . It defines some general set of guidelines how system
components should interact in concurrent computational environment.
• Actors interact with each other through messages only. It can only interacts
with Actors whose address it has (same like our phonebook)
• Actors which it has created (hence already know the address of child actors)
• Using Actor model one can create Self Healing System or Fault tolerant systems. The
First Actor created we can call it as master, it creates multiple other actors which are like
supervisor to the master. If a actor dies or not responsive, it’s supervisor can primary
take below calls to make it self healing system.
• Restart
• Redirect the message to another Actor
Actor Model Cont…
• Uncommitted dependency issues occur when the second transaction selects a row which is
updated by another transaction (dirty read)
• Non-Repeatable Read occurs when a second transaction is trying to access the same row
several times and reads different data each time.
• Incorrect Summary issue occurs when one transaction takes summary over the value of all
the instances of a repeated data-item, and second transaction update few instances of that
specific data-item. In that situation, the resulting summary does not reflect a correct result.
Multiversion 2 phase locking:
Each successful write results in the creation of a new
version of the data item written. Timestamps are
used to label the versions. When a read(X) operation
is issued, select an appropriate version of X based on
the timestamp of the transaction.