Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is process interleaving? (in the realm of Concurrency)

I'm not quite sure as to what this term means. I saw it during a course where we are learning about concurrency. I've seen a lot of definitions for data interleaving, but I could find anything about process interleaving.

When looking at the term my instincts tell me it is the use of threads to run more than one process simultaneously, is that correct?

like image 598
mdw7326 Avatar asked Apr 13 '14 20:04

mdw7326


People also ask

What is the process of interleaving?

Interleaving is a process where students mix, or interleave, multiple subjects or topics while they study in order to improve their learning. Blocked practice, on the other hand, involves studying one topic very thoroughly before moving to another topic.

What is interleaved processing in DBMS?

Interleaving is a process or methodology to make a system more efficient, fast and reliable by arranging data in a noncontiguous manner.

What is interleaving in parallel programming?

In computing, interleaving of data refers to the interspersing of fields or channels of different meaning sequentially in memory, in processor registers, or in file formats.

What is process concurrency?

Concurrency is the execution of the multiple instruction sequences at the same time. It happens in the operating system when there are several process threads running in parallel. The running process threads always communicate with each other through shared memory or message passing.


1 Answers

If you imagine a process as a (possibly infinite) sequence/trace of statements (e.g. obtained by loop unfolding), then the set of possible interleavings of several processes consists of all possible sequences of statements of any of those process.

Consider for example the processes

int i;

proctype A() {
  i = 1;
}

proctype B() {
  i = 2;
}

Then the possible interleavings are i = 1; i = 2 and i = 2; i = 1, i.e. the possible final values for i are 1 and 2. This can be of course more complex, for instance in the presence of guarded statements: Then the next possible statements in an interleaving sequence are not necessarily those at the position of the next program counter, but only those that are allowed by the guard; consider for example the proctype

proctype B() {
  if
    :: i == 0 -> i = 2
    :: else   -> skip
  fi
}

Then the possible interleavings (given A() as before) are i = 1; skip and i = 2; i = 1, so there is only one possible final value for i.

Indeed the notion of interleavings is crucial for Spin's view of concurrency. In a trace semantics, the set of possible traces of concurrent processes is the set of possible interleavings of the traces of the individual processes.

like image 50
dsteinhoefel Avatar answered Oct 11 '22 19:10

dsteinhoefel