Any change of rsync using threads instead of fork?

Wayne Davison wayned at samba.org
Thu Dec 8 23:30:01 GMT 2005


On Thu, Nov 24, 2005 at 03:22:23AM +0000, Jamie Lokier wrote:
> Is there any likelihood of changing the rsync code to use threads
> instead of processes?

I just thought about this a bit more, and it didn't seem as large a task
as I had originally assumed it would be.  I also remembered that I'm
going to need something like this (*) to effect my desired changes of
decreasing memory use and improving speed, so I've coded up a first-cut
version:

    http://opencoder.net/threaded-receiver.diff

This applies to the very latest CVS source (which is also available in a
just-updated "nightly" tar file).  The code does not attempt to discern
what kind of threading is available, so that will probably need to be
improved for systems that don't use pthreads.h.  If anyone tries this
out, please let me know how it goes and any problems you run into.

..wayne..

* Pertaining to upcoming improvements to rsync:  I want to be able to
dynamically change the file list as rsync runs (both to save memory and
to allow for a more incremental transfer protocol).  To do that, I need
the receiving side to have a single, shared file list.  In the long run
it might be better to change the receiver into a state-machine that is
triggered by the arrival of socket data, but in the near term it is much
easier to change it to use a separate thread of execution because this
means that I don't need to rework the procedural logic into some event-
triggered logic.  Most of the work of separating global variables that
need to differ between the receiver and the generator will carry over to
a state-machine version too, if we decide to switch over in the future.


More information about the rsync mailing list