Since they're sharing memory I will call them thre...
# javascript
t
Since they're sharing memory I will call them threads :)
e
No, they are not sharing.
The data is copied rather than shared.
Quote from: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
t
But what about
The worker context is represented by a DedicatedWorkerGlobalScope object in the case of dedicated workers (standard workers that are utilized by a single script; shared workers use SharedWorkerGlobalScope). A dedicated worker is only accessible from the script that first spawned it, whereas shared workers can be accessed from multiple scripts.
I'm confused now
e
"Shared workers” has nothing to do with data/memory sharing. In this sense, all processes in OS are “shared”, because they can communicate.
They key distinctions between threads and processes is that processes have private memory (data), while threads share memory (data) between them. In this sense, WebWorkers are processes.
t
I understand, thank you :)
b
Shared memory and atomics are part of 2017 https://github.com/tc39/ecmascript_sharedmem
👍 2