# Question about passing data structures with SharedArray's

**URL:** <https://discourse.julialang.org/t/question-about-passing-data-structures-with-sharedarrays/8097>\
**Category:** New to Julia\
**Created:** [January 1, 2018, 9:36pm UTC](https://discourse.julialang.org/t/question-about-passing-data-structures-with-sharedarrays/8097 "2018-01-01T21:36:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [January 1, 2018, 9:36pm UTC](https://discourse.julialang.org/t/question-about-passing-data-structures-with-sharedarrays/8097/1 "2018-01-01T21:36:16Z")

</div>

I’m trying to learn how to use SharedArray properly.

Let’s say I have a Dict (or anything that holds SharedArray’s)

```julia
d = Dict(
    :a => SharedArray{Float64}(rand(1000)),
    :b => SharedArray{Float64}(rand(1000))
    )

```

I understand that the workers would not have a reference to `d` and therefore I could create functions that operates on `d` by passing it as in an argument e.g.

```julia
@everywhere sum_a(d) = sum(d[:a])

```

Now, when I call this function remotely, am I passing just the references not the entire structure given the argument contains SharedArray not regular arrays? I hope the answer is yes…

```julia
fetch(@spawnat 2 sum_a(d))

```

---

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [January 3, 2018, 7:49pm UTC](https://discourse.julialang.org/t/question-about-passing-data-structures-with-sharedarrays/8097/2 "2018-01-03T19:49:08Z")

</div>

Not exactly answering my own question but the [SharedDict](https://github.com/tanmaykm/SharedDicts.jl) package is available.

This link also have some information about how a SharedDict  
may be tricky to implement: [dictionary - Is there something like SharedDict in Julia? - Stack Overflow](https://stackoverflow.com/questions/36990409/is-there-something-like-shareddict-in-julia)
