• R/O
  • SSH

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révisionef900cf664bc3954d54541e0a8204444ca1ae7a2 (tree)
l'heure2022-09-20 05:02:08
AuteurAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Message de Log

More (last part) of Messaging Aspects; now focus on calculus & actors

Change Summary

Modification

diff -r 2980c5b53cc5 -r ef900cf664bc CCastle/2.Analyse/8.ConcurrentComputingConcepts.rst
--- a/CCastle/2.Analyse/8.ConcurrentComputingConcepts.rst Tue Sep 13 17:52:44 2022 +0200
+++ b/CCastle/2.Analyse/8.ConcurrentComputingConcepts.rst Mon Sep 19 22:02:08 2022 +0200
@@ -15,10 +15,10 @@
1515 speed up [useCase: :need:`U_ManyCore`]. I also showed that threads_ do not scale well for CPU-bound (embedded)
1616 systems. Last, I introduced some (more) concurrency abstractions. Some are great, but they often do not fit
1717 nicely in existing languages.
18-
18+ |BR|
1919 Still, as Castle is a new language, we have the opportunity to select such a concept and incorporate it into the
2020 language.
21- |BR|
21+
2222 In this blog, we explore a bit of theory. I will focus on semantics and the possibilities to implement them
2323 efficiently. The exact syntax will come later.
2424
@@ -202,21 +202,42 @@
202202 ---------------
203203
204204 Both the writer and the reader can be *blocking* (or not); which is a facet of the function-call. A blocking reader it
205-will always return when a message is available -- and will pauze until then.
206-|BR|
207-Also, the write-call can be blocked: it will pauze until the message can be sent -- e.g. the reader is available
208-(rendezvous) or a message buffer is free.
205+will always return when a message is available -- and will pauze until then. Equally, the write-call can block: pauze
206+until the message can be sent -- e.g. the reader is available (rendezvous) or a message buffer is free.
209207
210208 When the call is non-blocking, the call will return without waiting and yield a flag whether it was successful or not.
211209 Then, the developer will commonly “cycle” to poll for a profitable call; and let the task do some other/background work
212210 as well.
213211
212+Futures (or promises)
213+~~~~~~~~~~~~~~~~~~~~~
214214
215-Uni/Bi-Directional, Broadcast
216------------------------------
215+A modern variant of non-blocking makes uses of “Futures_”. The call will always return this opaque data-structure
216+immediately. It may be a blank -- but the procedure can continue. Eventually, that data will be filled in “by the
217+background”. It also contains a flag (like ``done``), so the programmer can check (using an if) [#future-CS]_ whether
218+the data is processes.
217219
218-Messages --or the channel [#channelDir]_ that transports them-- can be *unidirectional*: from sender to receiver only;
219-*bidirectional*: both sides can send and receive; or *broadcasted*: one message is sent to many receivers [#anycast]_.
220+
221+Uni/Bi-Directional, Many/Broad-cast
222+-----------------------------------
223+
224+Message can be sent to one receiver, to many, or even to everybody. Usually this is modeled as an characteristic of the
225+channel. And at the same time, that channel can be used to send message in oneway, or in two-ways.
226+
227+It depends on the context on the exact intent. By example in (TCP/IP) networking, `Broadcasting
228+<https://en.wikipedia.org/wiki/Broadcasting_(networking)>`_ (and al variants that are not point-to-point) focus on
229+reducing the amount of data on the network itself. In distributed computing `Broadcasting
230+<https://en.wikipedia.org/wiki/Broadcast_(parallel_pattern)>`_ is a parallel Design pattern. Whereas the `Broadcast flag
231+<https://en.wikipedia.org/wiki/Broadcast_flag>`_ in TV steaming is a complete other idea: is it allowed to save
232+(record) a TV broadcast...
233+
234+We use those teams on the functional aim. We consider the above mentioned RCP connection as **Unidirectional** -- even
235+the channel can carry the answer. When both endpoints can take the initiative to sent messages, we call it
236+**Bidirectional**.
237+|BR|
238+With only 2 endpoints, we call the connection **Point-to-Point** (*p2p*). When more endpoints are concerned, it’s
239+**Broadcast** when a message is send to all other (on that channel), and **Manycast** when the user (the programmer) can
240+(somehow) select a subset.
220241
221242
222243 Reliability & Order
@@ -229,7 +250,7 @@
229250 “reliability layer”.
230251 |BR|
231252 Such a layer makes writing the application easier but introduces overhead too. And therefore not always the right
232-solution.
253+solution.
233254
234255 In Castle, we have “active components”: many cores are running parallel, all doing a part of the overall (concurrent)
235256 program. This resembles a networking application -- even while there is no real network -- where at least three nodes
@@ -333,9 +354,10 @@
333354 that the number of communications will grow with the number of cores too. As described in the :ref:`sidebar
334355 <Threads-in-CPython>` in :ref:`BusyCores`, solving this can give more overhead then the speed we are aiming for.
335356
336-.. [#channelDir]
337- Strictly speaking, one should not use “channel” here. Non the less, the “direction of a medium”, that is not a
338- (connected) channel sounds void. Although we do not exclude it, we use a pragmatic way of writing.
357+.. [#future-CS]
358+ Remember: to be able to “fill in” that Future-object “by the background” some other thread or so is needed. And so, a
359+ Critical-Section_ is needed. For the SW-developer the interface is simple: read a flag (e.g. ``.done()``. But using
360+ that to often can result is in a slow system.
339361
340362 .. [#anycast]
341363 Broadcasting_ is primarily know from “network messages”; where is has many variants -- mostly related to the
@@ -362,3 +384,4 @@
362384 .. _Broadcasting: https://en.wikipedia.org/wiki/Broadcasting_(networking)
363385 .. _Reliability: https://en.wikipedia.org/wiki/Reliability_(computer_networking)
364386 .. _Process-Calculus: https://en.wikipedia.org/wiki/Process_calculus
387+.. _Futures: https://en.wikipedia.org/wiki/Futures_and_promises