Subject: Re: gethostbyname_r() ?
To: Jan Danielsson <jan.m.danielsson@gmail.com>
From: Thomas E. Spanjaard <tgen@netphreax.net>
List: tech-net
Date: 07/17/2006 13:09:46
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigFFCC152A1BB891F6F764CD82
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.

Agreed.

>    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 http://en.wikipedia.org/wiki/Event_loop 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.

Cheers,
-- 
         Thomas E. Spanjaard
         tgen@netphreax.net

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (NetBSD)

iD8DBQFEu4we6xCMwBJ+1+sRAwBeAJ0e6nPrwg7EqKvTaULAD8Njgl4RZwCePbWu
MRnHYc0ytYA5xNzEiFflEcg=
=curT
-----END PGP SIGNATURE-----

--------------enigFFCC152A1BB891F6F764CD82--