* Broadcasting message to OTHER NODES @ 2014-10-10 16:23 Stribor40 2014-10-10 17:43 ` Niklas Holsti 0 siblings, 1 reply; 7+ messages in thread From: Stribor40 @ 2014-10-10 16:23 UTC (permalink / raw) I have 6 nodes and each of those nodes have 2 partners. So for example... task myNode is entry TurnOff; entry LetMeKnow; end myNode; I am trying to wrap my head around something like this ....so one of those nodes can send signal to those 2 partners to turn off the lights and let me know about it which is fine...The problem is that now those 2 partners also have 2 partners that need to be let known to turn the lights off and let me know about it. Can someone please point me or suggest how to go about this please. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Broadcasting message to OTHER NODES 2014-10-10 16:23 Broadcasting message to OTHER NODES Stribor40 @ 2014-10-10 17:43 ` Niklas Holsti 2014-10-10 17:51 ` Stribor40 0 siblings, 1 reply; 7+ messages in thread From: Niklas Holsti @ 2014-10-10 17:43 UTC (permalink / raw) On 14-10-10 19:23 , Stribor40 wrote: > I have 6 nodes and each of those nodes have 2 partners. So for example... > > task myNode is > entry TurnOff; > entry LetMeKnow; > end myNode; > > I am trying to wrap my head around something like this ....so one of those nodes can send signal to those 2 partners to turn off the lights > and let me know about it which is fine...The problem is that now those 2 partners also have 2 partners that need to be let known to turn the lights > off and let me know about it. > Can someone please point me or suggest how to go about this please. Please describe your goals more fully. What is the overall application or program that you would like to create? What are these "nodes"? Why do they send signals to each other? What should be the over-all effect of these signals? Where does the first signal originate? -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ . ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Broadcasting message to OTHER NODES 2014-10-10 17:43 ` Niklas Holsti @ 2014-10-10 17:51 ` Stribor40 2014-10-10 18:15 ` Niklas Holsti 0 siblings, 1 reply; 7+ messages in thread From: Stribor40 @ 2014-10-10 17:51 UTC (permalink / raw) On Friday, 10 October 2014 13:42:58 UTC-4, Niklas Holsti wrote: > On 14-10-10 19:23 , Stribor40 wrote: > > > I have 6 nodes and each of those nodes have 2 partners. So for example... > > > > > > task myNode is > > > entry TurnOff; > > > entry LetMeKnow; > > > end myNode; > > > > > > I am trying to wrap my head around something like this ....so one of those nodes can send signal to those 2 partners to turn off the lights > > > and let me know about it which is fine...The problem is that now those 2 partners also have 2 partners that need to be let known to turn the lights > > > off and let me know about it. > > > Can someone please point me or suggest how to go about this please. > > > > Please describe your goals more fully. What is the overall application > > or program that you would like to create? What are these "nodes"? Why do > > they send signals to each other? What should be the over-all effect of > > these signals? Where does the first signal originate? > > > > -- > > Niklas Holsti > > Tidorum Ltd > > niklas holsti tidorum fi > > . @ . first signal would go from main(which is i guess 7th task). So basically main tasks will call task1 and tell it to turn light off and then if wait at let me know entry. Now task1 will tell left and right partner to turn lights off and also wait at let me know entry. I am trying implement cascading effect like idea or propagating original turn me on signal that started on main (who is currently waiting at let me know entry) all the way to last node. When I say node i meant that each node is a task itself ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Broadcasting message to OTHER NODES 2014-10-10 17:51 ` Stribor40 @ 2014-10-10 18:15 ` Niklas Holsti 2014-10-10 18:33 ` Niklas Holsti 2014-10-10 18:42 ` Stribor40 0 siblings, 2 replies; 7+ messages in thread From: Niklas Holsti @ 2014-10-10 18:15 UTC (permalink / raw) On 14-10-10 20:51 , Stribor40 wrote: > On Friday, 10 October 2014 13:42:58 UTC-4, Niklas Holsti wrote: >> On 14-10-10 19:23 , Stribor40 wrote: >> >>> I have 6 nodes and each of those nodes have 2 partners. So for >>> example... >> >>> task myNode is >>> entry TurnOff; >>> entry LetMeKnow; >>> end myNode; >> >>> I am trying to wrap my head around something like this ....so one >>> of those nodes can send signal to those 2 partners to turn off >>> the lights and let me know about it which is fine...The problem >>> is that now those 2 partners also have 2 partners that need to be >>> let known to turn the lights off and let me know about it. >> >>> Can someone please point me or suggest how to go about this >>> please. >> >> Please describe your goals more fully. What is the overall >> application or program that you would like to create? What are >> these "nodes"? Why do they send signals to each other? What should >> be the over-all effect of these signals? Where does the first >> signal originate? > > first signal would go from main(which is i guess 7th task). So > basically main tasks will call task1 and tell it to turn light off > and then if wait at let me know entry. If the main task (the "environment" task, in Ada terminology) immediately waits on LetMeKNow, after calling TurnOff, why not have the main task wait in TurnOff until the "turn off" action is completed? (Of course this would present all real concurrency between the tasks, but then I don't understand why this program needs concurrency at all.) > Now task1 will tell left and > right partner to turn lights off and also wait at let me know entry. > I am trying implement cascading effect like idea or propagating > original turn me on signal that started on main (who is currently > waiting at let me know entry) all the way to last node. When I say > node i meant that each node is a task itself That's a little bit clearer, but the reason for using tasks is still obscure. Also unclear is what your problem is -- what kind of help do you need? As I understand it, you have a graph of nodes -- whether it is directed or undirected is not clear -- and you want to propagate an action or signal ("turn off") that starts from one point, should reach all nodes in the graph through the "left partner" and "right parner" links between nodes, and the originator of the signal should be informed when all nodes have received the signal. You don't show how a node knows its partners. Are the nodes numbered in some way? Or are they used through access variables? For some elements of a solution, you should read about depth-first traversal of graphs -- http://en.wikipedia.org/wiki/Depth-first_search. If the nodes were records instead of tasks, the problem would be simple to solve by a recursive "traverse" procedure using depth-first search. If the signal "turn off" can arise more than once, you may have to add some kind of signal identifier -- for example, the sequential number of the signal -- to keep track of which signals a node has received, and which it hasn't. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ . ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Broadcasting message to OTHER NODES 2014-10-10 18:15 ` Niklas Holsti @ 2014-10-10 18:33 ` Niklas Holsti 2014-10-10 18:42 ` Stribor40 1 sibling, 0 replies; 7+ messages in thread From: Niklas Holsti @ 2014-10-10 18:33 UTC (permalink / raw) Oops... On 14-10-10 21:15 , Niklas Holsti wrote: > (Of course this would present all real concurrency between the tasks, > but then I don't understand why this program needs concurrency at all.) Typo: should be "...PREVENT all real concurrency..." -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ . ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Broadcasting message to OTHER NODES 2014-10-10 18:15 ` Niklas Holsti 2014-10-10 18:33 ` Niklas Holsti @ 2014-10-10 18:42 ` Stribor40 2014-10-10 19:33 ` Shark8 1 sibling, 1 reply; 7+ messages in thread From: Stribor40 @ 2014-10-10 18:42 UTC (permalink / raw) Well i would mark each node/task as 1,2,3,4,5,6. I am not sure how i would mark each partner but assuming that i mark each partner somehow so each node/task knows about its 2 partners.I would like to keep a track off each time turnoff was sent and knowledge was received. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Broadcasting message to OTHER NODES 2014-10-10 18:42 ` Stribor40 @ 2014-10-10 19:33 ` Shark8 0 siblings, 0 replies; 7+ messages in thread From: Shark8 @ 2014-10-10 19:33 UTC (permalink / raw) On 10/10/2014 12:42 PM, Stribor40 wrote: > Well i would mark each node/task as 1,2,3,4,5,6. > I am not sure how i would mark each partner but assuming that > i mark each partner somehow so each node/task knows about its > 2 partners.I would like to keep a track off each time turnoff > was sent and knowledge was received. The /how/ is probably the second-most important problem, the primary problem being the creation of the tasks... which is, of course, dependent on the first problem: how they know about each other. I was thinking something like the following: Package Nodes is type Node_Interface is task interface; -- Entry specs here. (Note they must be written in procedure form.) type Node_Access is access Node_Interface; type Node_List is array(Positive range <>) of not null Node_Access; Function Null_List return not null access Node_List is ( New Node_List'(2..1 => <>) ); Function Make_Network(Size : Natural) return Node_List; task type Node( Neighbors : not null access Node_List ) is new Node_Interface with end Node; End Nodes; -------------- with Ada.Text_IO; Package body Nodes is task body Node is begin null; Ada.Text_IO.Put_Line( "Done." ); end Node; Function Make_Network(Size : Natural) return Node_List is begin return Result : Node_List( 1..Size ) do for Index in Result'Range loop declare subtype Head is Natural range Result'First..Natural'Pred(Index); subtype Tail is Natural range Natural'Succ(Index)..Result'Last; Item : Node_Access renames Result(Index); Fore : Node_List renames Result(Head); Aft : Node_List renames Result(Tail); begin Result(Index):= new Node'( New Node_List'(Fore & Aft) ); end; end loop; end return; end Make_Network; End Nodes; ---------------- The problem with the above is that the compiler tells me: "nodes.adb:26:32: initialization not allowed for limited types" So, I'm not sure exactly how you'd go about creating an in-place network (w/ no dynamic node addition/deletion)... although it seems perfectly reasonable to me to do so. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-10 19:33 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-10-10 16:23 Broadcasting message to OTHER NODES Stribor40 2014-10-10 17:43 ` Niklas Holsti 2014-10-10 17:51 ` Stribor40 2014-10-10 18:15 ` Niklas Holsti 2014-10-10 18:33 ` Niklas Holsti 2014-10-10 18:42 ` Stribor40 2014-10-10 19:33 ` Shark8
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox