Multithreading



Jens Wilke writes:
Is there any other way in Gtk2 than forking?

As someone who has done a *lot* of threading stuff, albeit not in GUI
type applications (a big XML based distributed database system), is
there any reason you're averse to forking and using processes? With
modern copy-on-write it's not like you're using any more real memory,
pipes are danged close to memcpy() speed, so there's no real
performance advantage to using threads.  Gtk2::Helper looks like it'll
make handling processes super easy, memory corruptions and similar
goofs are isolated to a process, if you *really* have to share memory
you can use mapped files or some other construct, and it's easier to
debug.

And hopefully it won't be a problem for you, but for our app it also
painted us into a corner on memory limits, if we'd partitioned with
processes we'd have had about 2 gig per process, as it was we had two
gigabytes for the app, which gave us some headaches.

When you get right down to it, threads exist because operating systems
once weren't up to the task of providing the right abstraction
level. True, they may work better than processes in Win32, but in
almost all other platforms they're really kinda irrelevant.

Dan




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