Modulations / hackerman

A work-in-progress hacking game written in Node.JS (help)
1 stars 0 forks source link

Workers do not share memory with parent process or each other #28

Open Modulations opened 1 year ago

Modulations commented 1 year ago

Needs more testing, but Issue #27 may have revealed the server workers inability to alter any variables outside of their file, commandHandler.

This wasn't found before because most changes weren't made through workers, upon working on commands that instead of retrieving data, change it, this has become a possibility.

Modulations commented 1 year ago

Actually, this is a bigger problem than I thought. To my knowledge, node workers don't share memory with the parent process or each other. This is a problem when I'm storing data that I want workers to interact with there.

Solutions are using a SharedArrayBuffer, finding out a method of sharing memory (using Linux to run the server?) or switching languages. (C++?)

Demonstrated this behavior in @Modulations/serverclienttest (name is not accurate).