Skip site navigation (1) Skip section navigation (2)

Re: Using Threads?

From: Dan Lyke <danlyke(at)flutterby(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using Threads?
Date: 2000-12-04 22:30:31
Message-ID: 14892.6919.336659.41711@wynand.flutterby.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Adam Haberlach writes:
> Typically (on a well-written OS, at least), the spawning of a thread
> is much cheaper then the creation of a new process (via fork()).

This would be well worth testing on some representative sample
systems.

Within the past year and a half at one of my gigs some coworkers did
tests on various platforms (Irix, Solaris, a few variations of Linux
and *BSDs) and concluded that in fact the threads implementations were
often *slower* than using processes for moving and distributing the
sorts of data that they were playing with.

With copy-on-write and interprocess pipes that are roughly equivalent
to memcpy() speeds it was determined for that application that the
best way to split up tasks was fork()ing and dup().

As always, your mileage will vary, but the one thing that consistently
amazes me on the Un*x like operating systems is that usually the
programmatically simplest way to implement something has been
optimized all to heck.

A lesson that comes hard to those of us who grew up on MS systems.

Dan

In response to

Responses

pgsql-hackers by date

Next:From: Jan WieckDate: 2000-12-04 23:01:46
Subject: Re: 8192 BLCKSZ ?]
Previous:From: Tom LaneDate: 2000-12-04 21:51:52
Subject: Re: Wrong FOR UPDATE lock type

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group