On fre, 2008-08-22 at 23:16 +0800, Adrian Chadd wrote: > I've been staring at the comm code in Squid-2 to get an idea of how to > implement properly async copy-free network IO. Its tricky to say the > least.
I have said it many times over the years in different words: Any data should be stored in refcounted buffers, with no explicit owner defining the lifetime, and at most a single owner who may allocate space in unused areas of the buffer. The buffer stays for as long as there is references to data in that buffer. When the last reference dies the buffer is freed. Approaches where I/O data buffers is embedded in other objects will seriously restrict and complicate implementation, and also opens for many cancellation corner cases which is very hard to debug. It's very obvious on the write side, but just as real issue and very very harmful on the read side as well. Network I/O is just one facet of this, I/O between modules is just about the same problem especially when you consider multi-threading stuff. Regards Henrik
signature.asc
Description: This is a digitally signed message part
