Nashborn - which would be a fully multi-threaded data model that can run multiple Java threads in a single program. But the programmer needs to be extra careful that there are no race conditions in the underlying Java threads. The author of the paper I was reading thinks this is too big of a step.
The last and in my opinion most realistic is the Shared Buffer Array, which allows allows the workers to have access to shared memory but with the additional ability to lock data when it is being used. This is not full threading, but it is closer and it has a much easier implementation.
- I completed task 1 of part 1. Similar to how I parallelized quick sort in Ruby, I used p.spawn to parallelize the process:
When a Parallel object is made, it takes in an argument. The functions that are called in the quicksort function need to be required - partition and comparte. Then when the spawn function is called, it takes quicksort as an argument and calls the function. Then it logs the arguments once it is done. This works for two recursive steps then reaches an error that a message argument is not given to the function and so it cannot finish. The documentation for parallel.js is not great, so I could not figure out how to fix this problem.
2. The second extension that I completed was to experiment with the child_process package to parallelize the process of modifying an image. The parent process reads in a png image, loops over the pixels in the image and for each pixel, sends a message with its information to the child process:
The child process then modifies the pixel and sends it back to the parent:
Then it prints the result to an output png.