How can you tell when a software algorithm can be parallelized ?!?

Parallelization is a pet project of mine and has been for many years…

Recently while interviewing at Paypal, who by the way does NOT hire talent and especially NOT talent who has a conscience… more on Paypal later…


Algorithms that seek to collect data can be more easily parallelized than the other kind.

This means Analytics Application are ripe for parallelization because Analytics is all about collecting aggregations from raw data.

How to…

All you need is a bit of experience with TCP/IP in the form of connecting a Process running on one computer to a Process running on another computer – repeat this as often as possible and you too can create a network of Processing Nodes each of which is connected to the rest – the real magic lies in how you achieve this goal in an efficient manner.

Next, you need to find a way to ask each Processing Node to perform part of the Aggregation Process using one chunk of data each.

Then find a way to get each Processing Node to make the request for its chunk of data at the same time, or as close to the same time as possible.

Then find a way to collect the results from each Processing Node in a parallel manner – again this is where you will find some magic.

HINT: TCP/IP is useful because it allows many requests to be made at the same time while allowing many results to be collected very quickly.

Before you know it you have the framework for parallelization but again there is ample room for doing some magic within the framework.

HINT: Python is easier because Stackless Python combined with multi-threading combined with TCP/IP combined with Parallel Python and Cython and Psycho… can’t get this much bang for the buck from Ruby but you can surely try if you must.

HINT: If you are me then you are more able to use your experience to make your typical non-aggregating algorithm into one that does perform some kind of aggregation… 😉

Paypal’s Interviewing Practices and the lack of ethics

Once upon a time I interviewed with a guy at Paypal who asked me to code a datetime object using an unspecified language who also did not stop to consider his goal had already been accomplished in just about every computer language he or I might wish to use… I mentioned this during the interview and he failed to respond with anything other than his lack of desire to continue… My question was driven by my desire to be ethical since I consider it unethical to write code where an existing solution has already been accomplished and I wanted to know “why” I was being asked to violate my own sense of ethics – not that I am opposed to violating my own sense of ethics so long as I can respond to the questions I might be asked to give later during the deposition in case the request results in legal action as most ethical breaches will eventually.  I have to wonder about professionals who have not spent any of their time thinking about what may or may not be ethical behavior.

Why “ethics” ?

Because I am a professional software engineer who, from time to time, write code by the hour and if I were to spend billable time (as would be the case for Paypal in this instance) working on code I knew had already been written I would feel as-though I was taking money under false pretenses and this would be a breach of ethics for me – not that this guy at Paypal would feel the same because he apparently had no ethical problems with asking me to work on code I would not otherwise have to build.  Maybe if those who ask contractors to work would also stand behind their requests someone like me would not need to develop a sense of ethics… think about it because I have.

Realistic Interviews !?!

 I think professional interviews should be 100% reflective of real life which means if I were actually asked by some manager to work on some kind of datetime object and I actually did so rather than using one that already exists I would hope I would be considered to be less than honest because aren’t I supposed to know what software objects already exist versus the ones that don’t ?!?
Consider the other side of this coin… what if I approached my manager at Paypal and asked him or her for permission to work on something and the something I asked to work-on already exists as some kind of open source thing I could have much more easily used ?!?   Would I have to not be completely dishonest if I were being paid by the hour to spend billable time working on something that already exists ?!?  I would think so but then I have a sense of ethics and a desire to not waste my professional time.
Interviews should be as realistic as possible in terms of professional expectations and professional ethics.
Nonetheless… I will remain as ethical as I can be even when it takes money out of my pocket because this is the right thing to do !!!
And those who lack ethics are generally punished by the legal system sooner or later…

Ruby 1.9.2 uses Real OS Threads !!!

Yeah – Rejoice Ruby-nauts !!!

Ruby 1.9.2 uses Real OS Threads !!!

Here’s the Code !!!


Here’s the Proof in Living HD Color !!!

Ruby 1.8.7 does NOT use Real OS Threads but Python does !!! Proof !!!

Proof that Ruby 1.8.7 does NOT use Real OS Threads !!!

How many times have I heard someone tell me Ruby 1.8.7 uses Real OS Threads and always has from the beginning ?!?

Far too many times…

You see, some people are so deep in denial they want Ruby to be what it is very clearly not and cannot be.  They proclaim Ruby can do everything it cannot do like use Real OS Threads by default without so much as taking the time to give it a real objective test.  Here is a real objective test.  I have no vested interest in either Ruby or Python, my only interest is in testing to see which is using Real OS Threads.

Ruby uses green threads which is to say Ruby simulates the use of Threads but it does NOT use Real OS Threads by default. There are some Ruby Gems out there that do allow Real OS Threads to be used but Ruby itself by default does NOT use Real OS Threads.  If Ruby did use Real OS Threads one would see the Real OS Threads when one views the process at runtime.

Python 2.5.x does use Real OS Threads because you can see the number of threads appear when viewing the process at runtime.

You cannot fool the OS.  When the OS knows there are Real OS Threads they show-up otherwise nothing but a single thread shows-up.

Run the tests. Write some code. Look at the OS Process.  See the Proof. It’s just that easy !  In the meantime, don’t try to talk smack to me unless you have actually seen the proof for yourself !!!

Look, if you want to prove me wrong then prove me wrong but do it with code I can run in my own Ruby right here with my own computer(s) or don’t bother to tell me how wrong I might be… On the other hand, if it helps me get a job and earn some money then I don’t mind letting certain select people tell me how wrong I am while I am taking their money – after I have cashed all the checks I will be right back here testing to see who’s right and who’s wrong.  So far Ruby keeps telling me how much it don’t use Real OS Threads…  and I am not the only person saying this even though people keep telling me just how wrong I am.

BTW, I am NOT the one who is wasting his money on Ruby… When it’s my money I don’t throw it away trying to make-believe Ruby is what Ruby cannot be.  I know exactly what Ruby is and how it works.

So here’s the Proof !

The Ruby Code:

The Python Code:

The OS:

  • iMac Core i7 running OS/X 10.7 Lion
  • Ruby 1.8.7
  • Python 2.5.2 Stackless 3.1b3 060516 (python-2.52:61022, Feb 27 2008, 16:52:03)
  • [GCC 4.0.1 (Apple Computer, Inc. build 5341)]

The Proof


Some people hear the work “multi-threaded” and they fail to look any deeper into the issue because they will concluse, “…I can use threads therefore it must be multi-threaded…”.  It is possible for Ruby 1.8.7 to be single-threaded from the OS Process perspective while being mutli-threaded from the perspective of Ruby within the larger context of a single OS Thread.  Everything that happens in Ruby 1.8.7 that does not specifically use real os threads will use simulated green threads that are not real os threads.

Yet another Ruby on Rails Programming Test *yawn*

So here we are again with yet another Ruby on Rails Programming Test !!!

Maybe someday people will just take as proof everything else I have publishing here but that day has apparently not yet arrived…

The Problem – Not exactly any kind of real business problem…

Rails Exercise:

We’d like you to create a simple Rails 3 application.
Create models that allow a user to follow another user.
The user model’s only attribute is “name”. You may scaffold the create action.
Create an interface that accepts post requests that allows users to
“follow” other users.
The user’s “index” action should list all of the users.
The user’s “show” action should show:
1) The user’s name
2) The users the user is currently following (with a button to remove
that following)
3) The users the user is not following (with a button to add that following)
4)  The users currently following this user
Do not create a login system for this exercise.

The Solution

Download it from this link; only 600 KB  !!!

HP Special Edition Livestrong L2000

Get it while it’s hot –>

You are bidding on a HP Special Edition Livestrong Laptop, model L2000.    This laptop is in great condition with no dings or dents and it boots up Windows 7 Ultimate or Ubuntu 11.10 Desktop.

Specs are as follows:

AMD Turion 64 Processor at 1.8 GHZ
14″ WXGA Screen
DVD/CD-RW Combo Drive
54g(TM) 802.11b/g WLAN
6 Cell Lithium Ion Battery
AC Adapter

Software Extras:
Windows 7 Ultimate
AVG 8.5 Anti-Virus
FireFox 4.x
Slingbox Player
PGP Desktop
Adobe Reader
Google Chrome
Process Tamer
Driver Detective
Dual Boot Windows 7 Ultimate x86 or Ubuntu Desktop 11.10
This machine is guaranteed NON-DOA.  This laptop is in great cosmetic condition.  See pics for details, all the standard decals are in place just as you would expect.   All ports are tested working.  All drivers are properly installed for Windows 7 Ultimate and Ubuntu 11.10 Desktop; fully compatible with Ubuntu Studio 11.10.

No Reserve and bidding starts at only $39.95.  Shipping is a flat rate fee of $19.95. via UPS.  I am not here to make money on shipping.   This machine is guaranteed NON-DOA.

%d bloggers like this: