Table of Contents

CSP

CSP (Communicating Sequential Processes) is a concurrency model where independent processes coordinate purely through message passing over channels, with no shared memory. Send and receive operations are synchronous (rendezvous): the sender and receiver synchronize at the point of communication.

Go's channels are the most widely used CSP implementation; unlike mailbox queues, channels are anonymous and tied to specific processes.

Example

This example shows CSP-style channel communication:

// compile: go run csp.go
// description: synchronous channel send/receive (rendezvous)
 
package main
import "fmt"
 
func main() {
    ch := make(chan int)
 
    go func() {
        ch <- 42  // send: blocks until receiver is ready
    }()
 
    result := <-ch  // receive: blocks until sender is ready
    fmt.Println("Received:", result)
}