Re: Work woth GUI from a thread that was made by pthread_create function

On 14 Feb 2002, Soeren Sandmann wrote:

> [dropping gtk-devel-list - that list is for development *of* gtk+ and
>  friends, not development *with* them]
> Pavel Machek <pavel ucw cz> writes:
> > > That's a bit strong to say use heavy processes, not threads.  The glib
> > > and gdk functions do make it easy to attach handlers to i/o events,
> >
> > Why? Process switch is not much slower than thread switch. Processes
> > are more portable, easier to debug, ....
> ..., don't limit stack size, don't impose locking thoughout all
> libraries such as libc, glib, ...
> The *only* advantage to threads over processes is that communication
> between them is simpler because they live in the same address
> space. This is also the reason they are difficult to debug.

But this could also be somewhat amended with mmap

The mmap() function causes the pages starting at addr and continuing  for
at most len bytes to be mapped from the object described by fd,
starting at byte offset offset.  If len is not a multiple of the pagesize,

> I don't believe that process switches are significantly slower than
> thread switches, but if it really is a bottleneck important enough

In a single processor environment thread-switches could even be mutch
slower than process switches.


Göran Hasse            email: gh raditex se     Tel: 08-6949270
Raditex AB   
Sickla Alle 7, 1tr                              Mob: 070-5530148

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]