Subject Re: [firebird-support] Re: Classic vs SS
Author Ann W. Harrison
Mark Rotteveel wrote:
> The problem is AFAIK that the code of Firebird is not fully SMP
> capable

That's true.
> (probably missing synchronisation and other thread safety features etc).

The threading in SuperServer was designed to avoid query starvation on
a single processor. Each query has a thread and each thread runs for
some period of time (quantum) and then yields the processor to another
waiting thread. This keeps a long complex select from hogging the
server until it completes. That's pretty reasonable technology for
the time it was created ... circa 1993. And it does keep shared objects
from being modified concurrently by different threads.

> In general threads in multi-threaded programs can, if scheduled on
> different CPUs, have different views on shared objects (eg cache).


> This can happen if threads of one program run on different CPUs.
> These threads can share objects, but those objects could be in the
> local CPU cache or even in the registers of the CPU. Without
> synchronisation it is not guaranteed that threads on different
> CPUs have the same view/version of those objects. That could
> result in all kinds of 'fun' errors, data inconsistency, crashes etc.

Yes, that's a problem, but no, that's not what happens when you run
SS on a multi-processor system. The threads continue to run in series,
one after another, so there's only one active thread at any time. Moving
that thread (and everything associated with it) between processors just
makes the overall performance worse.

Best regards,