Questions about GSoC project: Speed up the Test Suite

James Aylett james-xapian at tartarus.org
Sat Mar 12 15:50:31 GMT 2016


On Sat, Mar 12, 2016 at 08:14:44PM +0800, 罗增波 wrote:

> My name is Luo Zengbo, a student from Zhejiang University, China.
> As I mentioned in IRC before(my IRC nick name is poe_).

Hi, Luo Zengbo! Welcome to Xapian.

> As we know, multi-threads uses less resource and is easier to
> communication than multi-processes, so I choose multi-threads.

It is, however, harder to program for in some ways. (It's also not
true in all operating systems that threads are significantly less
resource hungry than processes.) Not saying that it's the wrong
choice, just that when you come to justify that choice in your project
proposal you shouldn't just assume that everyone agrees it's the right
way to go.

> My questions is that which multi-thread library is more suitable for
> Xapian? C++11's <thread> or <pthread.h>? On the one hand, pthead is
> POSIX threads library which will work well in Unix-like system. But
> in Windows, we need to install the third-party library such as
> pthread-w32. On the other hand, C++11's thread is standard library
> so we need install a third-party library, but maybe not supported by
> the earlier GCC compiler.

If you rely on an external library, you could detect it in configure
and then disable multi-threading for the test suite. Similarly, if you
need <thread> you can detect whether that will work or not, and
disable if necessary.

Ideally we'd take a route which will work without too much pain on
Windows. However right now I don't know anyone who's built Xapian
successfully on Windows using the standard toolchain (autotools &c);
and the old way of doing things is no longer maintained. So it's
entirely possible that master doesn't even build on Windows at the
moment anyway, in which case it's a little more moot. (But taking an
approach which would make Windows support feasible in future would be
preferable.) Apparently Visual Studio 2015 claims support for all the
C++11 core language features in the concurrency group.

In terms of GCC versions (for instance), we currently require GCC 4.7,
under the general policy:

> We aim to support compilation with any C++ compiler which conforms
> to ISO C++11, or a reasonable approximation to it.

Note that Debian stable ships with GCC 4.9; Ubuntu 14.04 LTS shipped
with GCC 4.8. If you know what version of GCC is needed to provide
suitable C++11 <thread> support, then you can figure out whether
that's feasible for common platforms. (CentOS 7 and RHEL7 apparently
ship with GCC 4.8.)

I don't know what the clang equivalent version is (but a quick look at
their site suggests C++11 should be entirely supported from 3.3
onward; 3.4 shipped in Ubuntu 14.04 LTS).

It's not clear from the pthreads-win32 homepage, but I assume it
implements pthreads in terms of Windows' own threading system?

J

-- 
  James Aylett, occasional trouble-maker
  xapian.org



More information about the Xapian-devel mailing list