concurrency - Mailbox Processor on Distributed Systems -


I noticed the following comment in my copy of expert F # on page 379:

< P> Passing and processing messages

An interrupt often used between shared-memory concurrency and passing message concurrency The former is often more efficient on local machines and this chapter is later included in the "Use of shared-memory insertion" section . For example, the distributed systems do not have shared memory, and can also be used to avoid problems related to shared memory.

Experts among shared processes with any shared memory have all the examples of F # and shows how to use a mailbox processor on the Internet, this code changes:

  counter = mailbox processor. Start (Funniest Inbox -> Hide loop N = async {printfn "n =% d, waiting ..." with msgsg! Inbox.safe () msg ​​msg | -1 - & gt; Print "'Bitter End Sesame ...' Return () | N - & gt; Return! Loop (n + msg)} Loop 0) Counter Post (20) Counter Post (50) Counter Post (-1 ) // Mar Mailbox  

In other words, you have to handle your mailbox processor in the shared channel before you can post messages to your channel. There is no style concurrency as far as I know it, because you can only post messages to the mailbox processor in the same process (note: process, not thread).

Is it possible Is there a mailbox processor in a process to send messages in another mailbox processor process? If so, can you provide a sample?

I think you In a bit confused by the vocabulary, Erlang processes do not directly match the OS processes. A given OS process can have many Erlang processes (and usually occur), such as many processes in your process. If you want to communicate between multiple OS processes, you can check it out. Probably a mailbox processor-style wrapper can be built around these APIs.


Comments