# Are process calculi (pi calculus, CSP) “shared memory”?

In Andrews' foundations of multithreaded parallel and distributed programming, "shared memory/variable" and "message passing" seem to be opposite programming models, and CSP is message passing:

Part 2 Distributed Programming

The synchronization constructs we have examined so far are based on reading and writing shared variables. Consequently, they are most commonly used in concurrent programs that execute on hardware in which processors share memory.

Distributed-memory architectures are now common. ...

Chapter 7 examines message passing, in which communication channels provide a one-way path from a sending to a receiving process. Channels are FIFO queues of pending messages. They are accessed by means of two primitives: send and receive. To initiate a communication, a process sends a message to a channel; another process acquires the message by receiving from the channel. Sending a message can be asynchronous (nonblocking) or synchronous (blocking); receiving a message is invariably blocking, as that makes programming easier and more efficient. In Chapter 7, we first define asynchronous message passing primitives and then present a number of examples that show how to use them. We also describe the duality between monitors and message passing: They are equivalent and each can directly be converted to the other. Section 7.5 explains synchronous message passing. The last four sections give case studies of the CSP programming notation, the Linda primitives, the MPI library, and the Java network package.

Varela's programming distributed computing systems a foundational approach use "shared memory" and "distributed memory" to describe opposite concurrency models, but strangely, pi calculus is called shared memory, because a channel is shared between multiple processes.

7.1.2 Shared or Distributed Memory

Memory or state in concurrency units—such as processes, actors, or join calculus atoms—can be shared, where multiple concurrency units have the capability to read it and update it, or distributed where only one concurrency unit owns it and can read it, update it, or communicate its content to other units. The π calculus has a shared memory model, where multiple processes can read from a shared channel or write to a shared channel.

and it even goes on to give "Figure 7.1 A pictorial representation of shared memory in the π calculus."

As far as I know pi calculus and CSP both use channels that are shared between multiple processes. Wikipedia (https://en.wikipedia.org/wiki/Communicating_sequential_processes) says

CSP is a member of the family of mathematical theories of concurrency known as process algebras, or process calculi, based on message passing via channels

(1). Does "message passing" programming model of Andrews and "distributed memory" concurrency models of Varela mean differently?

(2). Does "shared variables/memory" programming model of Andrews and "shared memory" concurrency models of Varela mean differently?

Does Varela's "shared memory" as in pi calculus not mean the same sense as "shared memory" by threads of the same process, or by processes as in OS concepts and as in Andrew's book?

(3). Is any model which uses a channel for communication between two or more processes, (e.g. any concurrency model in process calcluli?), both

• a "shared memory" but not "distributed memory" concurrency model in Varela's sense, and
• a "message passing" but not "shared variable/memory" programming model in Andrews' sense?

Thanks.

p.s. related questions:

https://cstheory.stackexchange.com/questions/47931/what-difference-are-between-the-topics-and-perspectives-of-these-two-distribute

https://cstheory.stackexchange.com/questions/47907/do-connection-and-message-coexist-in-csp-pi-calculus

• I suggest to improve your question, since your question is a bit difficult to answer without access to both books. Terminology is not stable, and different communities use the same terms in different ways, and different terms to refer to the same things. $\pi$-calculus is the paradigmatic message-passing calculus. Shared memory can be seen as a special case of message passing with memory cells being processes that exchange read/write messages. This view was first elaborated on by C. Hewitt in his 1976 Viewing Control Structures as Patterns of Passing Messages. – Martin Berger Dec 17 '20 at 20:43