Questions tagged [message-passing]

Message passing is a data transfer mechanism that is used in various forms in a number of programming languages

The basic form of data transfer in programming languages is the assignment statement. It is carried out by a (computing) agent that moves data from one part of the memory to another. The substantial difference between assignment and message passing is that message passing incorporates two active agents, a sender and a receiver. The sender has exclusive control over the source locations of the data to be transferred, while the receiver has exclusive control over the destination of the data.

Message passing can be classified by a number of criteria, the most important of which is

  • Mode of operation:

    • Synchronous (also called rendezvous or handshaking): Sender and receiver perform their transfer operations simultaneously. They may have to wait before transfer becomes possible.
    • Asynchronous: Sender is allowed to transfer data to a temporary location where it can be accessed by the receiver. Sender does not have to wait if temporary storage is available.
  • Addressing:

    • Direct: Sender and receiver refer to each other directly, by using unique IDs.
    • Indirect: There is an auxiliary object (channel) that connects the sender and the receiver, who only refer to the channel during message passing.
409 questions
130
votes
8 answers

Cancel an already executing task with Celery?

I have been reading the doc and searching but cannot seem to find a straight answer: Can you cancel an already executing task? (as in the task has started, takes a while, and half way through it needs to be cancelled) I found this from the doc at…
dcoffey3296
  • 2,504
  • 3
  • 24
  • 34
92
votes
2 answers

How does Actors work compared to threads?

Is there any good and short explanation of how Actors works compared to threads? Can't a thread be seen as an actor and send messages to other threads? I see some difference, but it's not that clear for me. Can I use Actors in any language by using…
Jonas
  • 121,568
  • 97
  • 310
  • 388
79
votes
6 answers

The actor model: Why is Erlang/OTP special? Could you use another language?

I've been looking into learning Erlang/OTP, and as a result, have been reading (okay, skimming) about the actor model. From what I understand, the actor model is simply a set of functions (run within lightweight threads called "processes" in…
Jonathan Winks
  • 1,091
  • 2
  • 9
  • 12
64
votes
8 answers

Communication between Activity and Service

I am trying to make my own MusicPlayer for android. Where i came to a problem is running some things in background. Main activity manages GUI and up to now all the songs are playing. I wanted to separate GUI and music playing classes. I want to put…
Dejan
  • 3,046
  • 3
  • 28
  • 43
64
votes
2 answers

TPL Dataflow, whats the functional difference between Post() and SendAsync()?

I am confused about the difference between sending items through Post() or SendAsync(). My understanding is that in all cases once an item reached the input buffer of a data block, control is returned to the calling context, correct? Then why would…
Matt
  • 7,004
  • 11
  • 71
  • 117
60
votes
3 answers

How to send and receive broadcast message

I am trying to pass data between two activities that are inside of tabs. I am trying to use sendBroadcast(). With breakpoints set I never reach onReceive(). Manifest:
Yack
  • 1,400
  • 1
  • 10
  • 13
58
votes
10 answers

What's the difference between the message passing and shared memory concurrency models?

Correct me if I'm wrong, but I'm surprised this hasn't been asked before on here ...
blank
  • 17,852
  • 20
  • 105
  • 159
39
votes
5 answers

What is the difference between message-passing and method-invocation?

Is there a difference between message-passing and method-invocation, or can they be considered equivalent? This is probably specific to the language; many languages don't support message-passing (though all the ones I can think of support methods)…
Scrollbar
  • 791
  • 2
  • 7
  • 6
37
votes
5 answers

Passing message from background.js to popup.js

I'm trying to implement my own chrome extension on which, on a certain event, create a browser notification and fills the popup with data calculated in background.js Here is my manifest.json file: { "name": "Dummy name", "description":…
28
votes
12 answers

Java: Is `while (true) { ... }` loop in a thread bad? What's the alternative?

Is while (true) { ... } loop in threads bad? What's the alternative? Update; what I'm trying to to... I have ~10,000 threads, each consuming messages from their private queues. I have one thread that's producing messages one by one and putting them…
Mr. Burgundy
  • 351
  • 1
  • 4
  • 5
27
votes
5 answers

Parallelism in Python

What are the options for achieving parallelism in Python? I want to perform a bunch of CPU bound calculations over some very large rasters, and would like to parallelise them. Coming from a C background, I am familiar with three approaches to…
fmark
  • 57,259
  • 27
  • 100
  • 107
24
votes
7 answers

What other programming languages have a Smalltalk-like message-passing syntax?

What languages are there with a message-passing syntax similar to Smalltalk's? Objective-C is the only one I'm familiar with. Specifically, I was wondering if any other language implementations exist which allow for syntax in a form like: [anObject…
donalbain
  • 1,158
  • 15
  • 31
22
votes
2 answers

what are the disadvantages of RPC with respect to message passing?

what are the disadvantages of RPC with respect to message passing?
Anonymous
  • 4,133
  • 10
  • 31
  • 38
22
votes
2 answers

TPL Dataflow, how to forward items to only one specific target block among many linked target blocks?

I am looking for a TPL data flow block solution which can hold more than a single item, which can link to multiple target blocks, but which has the ability to forward an item to only a specific target block that passes a filter/predicate. At no time…
Matt
  • 7,004
  • 11
  • 71
  • 117
19
votes
2 answers

Scatter Matrix Blocks of Different Sizes using MPI

(Suppose all the matrices are stored in row-major order.) An example that illustrate the problem is to distribute a 10x10 matrix over a 3x3 grid, so that the size of the sub-matrices in each node looks like |-----+-----+-----| | 3x3 | 3x3 | 3x4…
Roun
  • 1,449
  • 1
  • 18
  • 25
1
2 3
27 28