Wednesday, February 21, 2007

Why should I use Matrex if Excel 2007 supports multithreading?

One of the peculiar features of Matrex has always been the fact that functions are executed in different threads.
Now Excel 2007 supports a similar feature, so one could think that there are less reasons to use Matrex instead of Excel.
But that's wrong: the multithreading capabilities offered by the two products are different.



Multithreading has been added to Excel to use both the cores in the new double core processors (Intel Core Duo and AMD X2).


Matrex has introduced multithreading before these processors became popular and the purposes are the following:
  • Don't block the GUI during the function calculations
  • Get immediately the results of some calculation without to wait for the whole project (worksheet) to be recalculated.
  • Avoid that I/O dependent functions (formulas) block CPU intensive functions.
Sure, Matrex is also able to use both the cores of a double core processor, but that is only a side effect of its multithreading feature.



I don't have details on the implementation, but that is what I think happens:

When you recalculate a sheet the first time, all the dependencies among cells of the sheet (formulas) are examined and based on this the sheet is divided in 2 parts (or 4 if you have 4 cores) .
Each part is calculated by a thread.


Matrex uses a pool of threads. Each function is calculated by a thread of the pool.
In this way the whole Matrex internal engine is multithreaded.
Only the GUI runs as a single thread, with which the other threads need to synchronize when matrices, charts or presentations are displayed in the viewers.


Multithreading has been just added to Excel to use well the dual core processors, but it is not a main feature in Excel: a part of the fact that the calculation is divided in 2 or more threads, the system works as in the previous versions.

Matrex is instead built on threads. They are everywhere: functions, matrices, presentations, charts, timers and the GUI have to cope with them.

No comments: