Archive for November, 2009

Chrome OS Targets the Masses

Friday, November 20th, 2009

For those not in the know Google has announced an operating system developed in house called Chrome OS. I watched the hour long live launch over the web with interest because Google has its hands all over the web. You can see for yourself by signing into Google Dashboard and perusing all the minutiae of information that you may or may not know you share with them. You can even peruse your old Google queries if you drink the kool aid sign up for it.

So what is Chrome OS and why do you care? To start, Chrome OS is not Chrome. Chrome is a web browser developed by Google which is fast. Really fast. It is my browser of choice despite the fact that it had flaky mainstream support for awhile. You should try it. Chrome OS is an operating system like Windows 7 or Apple OS X. Except that it is so much more (or less?) than those things. You can think of Chrome OS like a browser on steroids. The idea is that we all spend most of our time on the web anyways – so what’s the point of having to manage a computer, install virus software, make backups (you do do that right?) , install updates, or crying when you spill juice on your laptop and wonder if you just washed away three years of memories.

Chrome OS introduces a “stateless” system. Everything you do is on the internet. There is no more local computer. All your information is stored in the cloud and somebody else’s problem for managing. Say you go to Aunt Sally’s but you left your computer at home. No problem. Log into Chrome OS and the computer looks exactly like your computer at home with everything just the way you like it. Do some work, leave and go home and everything is waiting for you there. Great concept, but are the masses ready for this? Are you ready to give up all your desktop games, Outlook, Paint and migrate to web only applications?

I guess that depends on how frustrated the masses currently are with maintaining a full featured OS at home. My personal feeling is – very unsatisfied. Even I, computer geek extraordinaire is frustrated by the number of trivial and annoying things I must do to maintain a working computer. Chrome OS solves lots of these problems. No more having to worry about antivirus software because the core of the OS is locked down. Just yesterday I spent two hours trying to migrate my wife’s Outlook settings after I upgraded her to Windows 7. Goodness, how do regular people put up with this crap?

On top of saving all this time and frustration, what if I told you Chrome OS boots in seven seconds? And I am not talking seven seconds like you are used to. Where you have a desktop and you click and click and nothing happens. You wait two more minutes and then all of a sudden twelve windows open. Gee thanks. I mean seven seconds until you have a fully functional computer with a browser already opened and you are checking your mail. Now we’re cooking with fire!

Google seems to think that the emergence of low cost, low power netbooks and ubiquitous internet will drive sales of this new device, but I am prophesying that this is going to be much bigger than Google or even Microsoft/Apple think it will be. Dual boot systems on small, inexpensive solid state disks (think 16gb) will make this technologically accessible to mainstream users on existing hardware.

For those nerding out there you can download the open source Chrome OS here and start drinking the kool aid.

Multithreading Revisited

Thursday, November 19th, 2009

So I was reading an article by John Siracusa on arstechnica.com about  Snow Leopard recently and he had a great segment about Apple’s new Grand Central Dispatch technology. The idea of GCD is to allow developer’s to easily multithread code without having to do all the work that I had to go through. Before I get into that though let’s cover the basis of what GCD is. First of all GCD is a low level means of handling threads automatically. When developing for a multiprocesser system developers don’t have much knowledge of what the current system state is. Sure I have four cores, but how many are available? Once you let GCD know you want something threaded it can farm out the work for you. No checking for number of processor cores or if hyperthreading is available. Sweet.

Grand Central Dispatch also allows you to multithread in just a few lines of code. John does a great job of explaining it so hit the link above and read up if you want more in depth information on the technology. The short version is that blocks + GCD = multithreading bliss.

So all of this got me thinking about my previous article on multithreading a workload and how I could improve it. One thing that would make sense would be to use a stack instead of splitting my list up into equal parts. A stack is like a pile of paper. You can pull things off the top of the stack and expose the page underneath. So if I passed the same stack to each thread then the threads would peel off the work bit by bit until the stack was gone.

  • Once the stack is empty then the threads will terminate themselves.
  • I could add work to the stack as it is being processed (of course being careful that the threads don’t terminate before I am done collecting work)
  • I don’t have to worry about one subset of work finishing faster than another.

So let’s run a little pseudo code for this framework:

private void Multithread()
{
  Stack<int> stack = new Stack<int>(100); //stack of 100 something
  for (int i = 0; i < 100; i++) { stack.Push(i); } //fill the stack
  Thread[] threads = new Thread[System.Environment.ProcessorCount];

  //Create the threads and pass the same stack to each one
  for (int i = 0; i < threads.Length; i++)
  {
       threads[i] = new Thread(delegate() {
                      DoSomething(stack);
                    });
       threads[i].Start();
  }
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">   //wait for execution to finish
  foreach (Thread thread in threads) { thread.Join(); }</pre>
}

And our worker function which will terminate once the stack has emptied

private void DoSomething(Stack<int> stack)
{
 while (stack.Count > 0)
 {
    int j = stack.Pop();
    Debug.Print(j.ToString());
 }
 return;
}

Marathon Training Begins

Tuesday, November 17th, 2009

Dan Corbera of Urbanathlon fame, Joel Desjardins and myself have all set a goal to tackle the Hyannis full marathon come February 28th, 2010. I am following the Runner’s World sixteen week training program and I am off to an ignominious start.  I visited the track on Tuesday for my first day of training. The training schedule called upon me to run two miles at race pace, 1 mile at 105% of race pace and finish up with two miles at race pace again. It had been three weeks since my last run which was the Urbanathlon, but I felt good and hoped things would go well.

(more…)