This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Multi thread programs
- From: "Scott Robert Ladd" <scott at coyotegulch dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Sat, 4 May 2002 09:02:36 -0400
- Subject: RE: Multi thread programs
Luiz Rafael Culik Guimaraes wrote:
> What options should i pass to gcc to create an multithread programs?
Hello,
Are you looking for a "multithreaded" switch like Microsoft's -MT, which
specifies special libraries at link time? If so, this is not necessary with
gcc, since all Unix libraries should (in theory) be written as "thread
safe". Microsoft requires such a switch because it ships two different sets
of libraries, one of which is *not* thread safe. Using MT does not make a
Visual C++ program multi-threaded; it simply *allows* multiple threads to be
created, if you so desire.
GNU gcc does *not* support automatic parallelization of your code, ala
Intel's -parallel flag.
GNU gcc does *not* support OpenMP, a set of pragmas that implement a
standard cross-platform (on the source code level) multiprocessing.
GNU gcc can work with MPI (Message Passing Interface), a cross-platform
library for developing multi-process programs.
If you want a multi-threaded program using gcc, you need to design and
implement the processes or threads yourself, manually, using fork(), exec(),
and related facilities. Platforms vary in what "thread" means; for example,
under Linux, a thread is really a full-fledged process, while under Windows
a "thread" is a lightweight branch in the execution of a single process.
By now, I've either over-answered you question or bored you to death. If you
need more information, please e-mail me.
..Scott
Scott Robert Ladd
Coyote Gulch Productions, http://www.coyotegulch.com
No ads -- just very free (and somewhat unusual) code.
Algorithms, evolutionary algorithms, and fun stuff.