<< Chapter < Page Chapter >> Page >
Trace
A trace is the sequence of operations (and their data) performed in a particular run of a concurrent program.Equivalently, it is the sequence of states during a run i.e. , the collection of variable and program counter values.
Atomic
An atomic operation is indivisible. A context switch to another process cannot happen during this operation.

Both the syntax and semantics of the concurrency primitives can vary among programming languages and concurrency libraries.We will use a particular language, Promela , which implements the most commonly-used features ofconcurrent programs. In Promela,assignment statements are defined to be atomic. We'll later contrast atomic with non-atomic assignment statements.

Problems with concurrency

Programmers are comfortable with debugging single-threaded code, where most questions involve ``doesthis sequence of instructions compute the correct answer?''Concurrency, however, introduces the added complications of communication and synchronization;a single task may be spread across several sequences of instructions running asynchronously,and multiple threads can interact in unintended ways. The following are five common categories of problems with concurrency.

Deadlock
(Informal) Deadlock is when two or more threads stop and wait for each other.
Livelock
(Informal) Livelock is when two or more threads continue to execute,but make no progress toward the ultimate goal.

Deadlock vs. livelock

As an analogy, consider two people walking in a hallway towards each other. The hallway is wide enough for twopeople to pass. Of interest is what happens when the two people meet.If on the same side of the hallway, a polite strategy is to step to the other side.A more belligerent strategy is to wait for the other person to move. Two belligerent people will suffer in deadlock, glaringface to face in front of each other. Two polite people could suffer from livelockif they repeatedly side-step simultaneously. (No conclusions on morality are to be inferred fromthe fact that one polite and one belligerent person don't have any problems.)

Two belligerent hallway-walkers can deadlock.
Fairness
(Informal) Fairness is the idea that each thread gets a turn to make progress.

There are more specific notions of fairness that describe when and how often threads are guaranteed to get a turn.For example, do we expect that each thread should be executed as often as any other, or is it acceptable if one runs a hundred stepsfor each step of any other thread? When considering fairness, one must also consider the system codeimplementing the threads. The implementation includes a scheduler that determines how to interleave the threads, and the schedulermight or might not provide any fairness guarantees.

Starvation
(Informal) Starvation is when some thread gets deferred forever.

Fairness and starvation

Assume we are modeling a store. Consumers buy products, reducing the shelf inventory. Meanwhile, employees restockthe shelves, increasing the shelf inventory. More simply, let thread C be a loop that repeatedly decrements a counter, and thread P be a loop that repeatedly increments that same counter.

Unless our scheduler (which may be nature) otherwise gives some guarantees,this system does not ensure that the two threads execute fairly.In particular, it is possible for one thread to starve the other.

Questions & Answers

what is phylogeny
Odigie Reply
evolutionary history and relationship of an organism or group of organisms
AI-Robot
ok
Deng
what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Model checking concurrent programs. OpenStax CNX. Oct 27, 2005 Download for free at http://cnx.org/content/col10294/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Model checking concurrent programs' conversation and receive update notifications?

Ask