linux – 为什么rsync会为我生成多个进程?

前端之家收集整理的这篇文章主要介绍了linux – 为什么rsync会为我生成多个进程?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用以下cron语句从一个文件夹备份到同一台机器中的另一个文件夹:
19 21 * * * root  rsync -ac --delete /source/folder /dest/folder

当我使用pstree时,我看到cron分叉了三个进程

├─cron───cron───rsync───rsync───rsync

和ps

9972 ?        Ds     1:00 rsync -ac --delete /source/folder /dest/folder
 9973 ?        S      0:29 rsync -ac --delete /source/folder /dest/folder
 9974 ?        S      0:09 rsync -ac --delete /source/folder /dest/folder

为什么有三个流程?我可以只限一个吗?

解决方法

http://rsync.samba.org/how-rsync-works.html

Rsync is heavily pipelined. This means that it is a set of processes that communicate in a (largely) unidirectional way. Once the file list has been shared the pipeline behaves like this:
generator → sender → receiver

The output of the generator is input for the sender and the output of the sender is input for the receiver. Each process runs independently and is delayed only when the pipelines stall or when waiting for disk I/O or cpu resources.

您正在运行本地rsync(源和目标是本地文件系统),因此所有三个进程都将在那里运行.你无能为力,这是设计的.

原文链接:https://www.f2er.com/linux/402125.html

猜你在找的Linux相关文章