[Spread-users] Question about thread-safety
Theo E. Schlossnagle
jesus at omniti.com
Thu Jun 19 12:56:12 EDT 2003
John Schultz wrote:
> On Wed, 18 Jun 2003, Theo E. Schlossnagle wrote:
>>You said that the opaque integer reference is used in libraries. I'd be
>>interested at looking at a completed product that uses such a method and
>>compare it against other libraries that use a standard context set up (like
>>OpenSSL, Sybase, MySQL, Postgres, etc.)
>
>
> I wouldn't use this method in every application/library. For example,
> there is no reason to hide an in-memory data structure (e.g. - a linked
> list) behind an opaque integer handle. However, because Spread performs
> system IO and has to protect its file descriptors carefully (the race
> condition that started all of this), the Spread user library is a good
> candidate for this treatment.
>
> I intend to eventually implement this in a new Spread user library. At
> that time we can compare the performance of the new library vs. the old
> and see if there is any noticeable overhead.
I think your method will have no noticeable overhead. That wasn't my concern
at all.
My concern was handling multithreaded _AND_ multiprocess applications equally
well. So, the implementation must keep in mind that there are subtleties with
fork() duplicating the internal table/hash you use for managing the contexts
of user sessions.
The implementation needs to have a graceful way of deallocating a session in a
child process that inherited it without wanting it.
Since we are about 20 minutes apart, maybe we should talk about this in
person. [I certainly hope] we can come up with a better solution together
than either of us alone.
--
Theo Schlossnagle
Principal Consultant
OmniTI Computer Consulting, Inc. -- http://www.omniti.com/
Phone: +1 410 872 4910 x201 Fax: +1 410 872 4911
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
More information about the Spread-users
mailing list