Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. 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.

  2. Mozilla Research is working on its PJS project, which aims to find higher level ways to gain time from parallel processing without the hassle of the programmer dealing with threads.  The problem is that it is hard to find general enough models to deal with all program types, so JavaScript engine implementors are afraid to make such a huge change.  But developers won’t begin using this new way without seeing it works.

  3. 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.

Extensions:
  1. I completed task 1 of part 1. Similar to how I parallelized quick sort in Ruby, I used p.spawn to parallelize the process:
    Image Added

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:

Image Added

The child process then modifies the pixel and sends it back to the parent:

Image Added

Then it prints the result to an output png.

Image Added

to:

Image Added