Subject: Re: gethostbyname_r() ?
To: Jan Danielsson <>
From: Thomas E. Spanjaard <>
List: tech-net
Date: 07/17/2006 13:09:46
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jan Danielsson wrote:
> Thomas E. Spanjaard wrote:
>> Jan Danielsson wrote:
>>>So rather than threading on these platforms, we
>>>made Tor fork new processes. This means you need way more memory to run
>>>a Tor server, especially an exit server. If you want to run a Tor
>>>server, we recommend you upgrade to a better OS."
>>If Tor soups up that many threads cq. processes, it sounds like a very
>>wrong design decision, they should use an event loop instead. So the
>>'upgrade to a better OS' is completely out of line.
>    That comment is out of line regardless, imho. OS advocacy should not
> be in a TOR wiki. But maybe that's just me.


>    Anyway, it turns out they are building an DNS resolver into the
> application which will be used instead of the operating system function.
>    I'm curious though, what is meant by an "event loop" in this context?
> Link to relevant documentation?

The first paragraph of is 
helpful. Instead of having the separate threads, the handlers for events 
are called from an event loop, optionally preempted as well (or have one 
separate worker thread/process). Things like DNS lookups can be called 
from a wrapper which is reentrant by using a context structure (like in 
reentrant coroutines), which puts way less load on a system than a 
bucket of threads or processes.

         Thomas E. Spanjaard

Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Version: GnuPG v1.4.2 (NetBSD)