They will execute in parallel if they are capable of doing so. The tee
command will feed input to both commands as it gets it. This will make them "ready to run" if they were blocked on input, and then the OS wills schedule them on whatever cores it has available. This is not multithreading because that takes place within a process. This is multiprocess operation.
последовательность процессов конвейера / тройника linux
434
vivienlwt
Я думаю, что для команды Linux, конвейер: $ command1 | command2 | command3
будет выполняться с последовательностью команда1 -> команда2 -> команда3.
Но как насчет использования тройника: $ command1 | tee >(command2) >(command3)
Так как это command2
и command3
имеет тот же вход, мой вопрос, будет command2
и будет command3
выполняться параллельно (многопоточность?) Или в последовательности 2-> 3?
Благодарю.
2 ответа на вопрос
2
David Schwartz
0
Emery Lapinski
Try running this command (Ctrl-C it after a bit):
(od -x /dev/urandom | tee >(sed 's/^/1 /') >(sed 's/^/2 /')) > /tmp/output
/tmp/output will be interleaved and overwritten as each process gets a chance to run.
Also when you say "will execute with sequence" that's incorrect. I think DOS used to simulate pipelines with temporary files, but not Unix.
(I've never seen the >() syntax before. Learn something new everyday!)
Похожие вопросы
-
9
В чем разница между командами "su -s" и "sudo -s"?
-
4
Требуется хороший бесплатный образ Ubuntu Server VMWare
-
4
Каковы различия между основными дистрибутивами Linux? Я замечу?
-
-
2
Ограничить использование процессора для Flash в Firefox?
-
2
Как мне заставить мой микрофон работать под Debian GNOME?
-
2
Конки установки - образцы / идеи?
-
3
Каковы различия между оконными менеджерами Linux?
-
2
ThunderBird / Синхронизация освещения с SE k770i
-
4
Файловая система Linux
-
6
Полноэкранная медленная вспышка в KDE 4