Just because the code is shared, doesn't mean that the data memory
is shared as well.

Just a WAG on my part, but I would assume that TOSSIM runs each
mote instance on a different stack and sets each instance's "global"
memory area to different locations as well. In writing that last
phrase it occurred to me that there must be some memory foo happening
at compile time to make that happen...

That said, I've had to jump through annoying hoops in order to share
global state across multiple TOS modules due to NESC name mangling.
I recently thought I might be able to do a real global variable in
a C library and link the TOS program to it, but that's water under
the bridge now.

And there's nothing wrong with T1 that a few good kicks doesn't fix.
Usually....

MS



Eric Decker wrote:
> Nothing I've said is changed because of TOSSIM.  TOSSIM simulates many 
> different nodes and they are different nodes.
> 
> So the control cells are still not shared.
> 
> 
> On Fri, Jun 18, 2010 at 7:09 PM, Pedro Nunes <pmrnu...@gmail.com 
> <mailto:pmrnu...@gmail.com>> wrote:
> 
>     Hello, Eric.
> 
>     First of all, sorry for the misunderstanding -- I forgot to mention
>     I was working with TOSSIM.
> 
>     I've been trying to find the piece of code responsible for
>     instantiating the several motes used within a simulation. I was
>     convinced that although we had N motes running on the simulator,
>     they would all share the same modules and configurations and
>     therefore the same data fields (which would be messy, I know). On
>     the other hand, I knew from the start that that wasn't the correct
>     behavior of WSN's and it was hard for me to believe that the
>     simulator would really work that way.
> 
>     So my question is: how does TOSSIM handle the instantiation of N
>     motes? And where does it do it?
> 
>     Kind regards,
>     Pedro Nunes
> 
>     On Sat, Jun 19, 2010 at 2:59 AM, Eric Decker <cire...@gmail.com
>     <mailto:cire...@gmail.com>> wrote:
> 
> 
> 
>         On Fri, Jun 18, 2010 at 4:37 AM, Pedro Nunes <pmrnu...@gmail.com
>         <mailto:pmrnu...@gmail.com>> wrote:
> 
>             Hi all.
> 
>             I have a non-generic module with an uint8_t array inside.
>             That module has a command like this:
> 
>             command SomeModule.setValue(int something) {
>                 array[sim_node()] = something;
>             }
> 
>             I was expecting that this array would be "global" for all
>             motes and they would share it
> 
> 
>         I don't understand why you think "array" would be global within
>         a mote let alone across motes.
> 
>         There is no nesc construct for declaring an object that is
>         global across multiple entities.  nesc is a language extension
>         built on top of C that forces compartmentalization for systems
>         design.  It is only symantically relevant to a module.  There
>         are no constructs in nesc for sharing global objects across
>         motes or for that matter across modules.  The whole intent of
>         nesc is to provide a structure that forces very well defined
>         interfaces between components of a system.
>          
> 
>             (although this is not what WSN's are supposed to do) -- but
>             as far as I know about nesC, this was the expected behavior.
> 
> 
>         not sure why you are concluding that.
>          
> 
>         module globals are unique to a module.  A module global is
>         something like:
> 
>         module exampleP {}
>         implementation {
>             uint32_t blah;
> 
> 
>             ...
> 
>             command SomeModule.setValue(uint32_t something) {
>                 blah = something;
>             }
>         }
> 
>         blah is global only to the module exampleP.  It is not global to
>         the mote nor across the network.
> 
> 
>         Hopefully that clears things up.
> 
>         eric 
> 
> 
> 
>             Instead, I got each mote having its own array without
>             sharing its content with any other mote.
> 
>             Could anyone please enlight me with a logical explanation on
>             why is this happening?
> 
>             Regards,
>             Pedro Nunes
> 
>             _______________________________________________
>             Tinyos-help mailing list
>             Tinyos-help@millennium.berkeley.edu
>             <mailto:Tinyos-help@millennium.berkeley.edu>
>             
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> 
> 
> 
> 
>         -- 
>         Eric B. Decker
>         Senior (over 50 :-) Researcher
> 
> 
> 
> 
> 
> 
> -- 
> Eric B. Decker
> Senior (over 50 :-) Researcher
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to