[英]Reading and performing operations with Pipes
I am supposed to read a matrix file, perform operations to the matricies read and output the results of those operations to a different file. 我应该读取一个矩阵文件,对矩阵执行操作,然后将这些操作的结果输出到另一个文件中。
I am fairly new to pipes and I am able to do these oeprations with one process but we are required to run multiple processes. 我对管道还很陌生,我可以用一个进程来完成这些操作,但是我们需要运行多个进程。 I understand I need to read the file in the parent and pass the necessary numbers to the children who perform the operations, but what's the general way to go about this?
我知道我需要在父级中读取文件,并将必要的数字传递给执行操作的子级,但是一般的处理方式是什么?
I think what you're looking for is fork()
( http://linux.die.net/man/2/fork ) 我认为您正在寻找的是
fork()
( http://linux.die.net/man/2/fork )
The use of fork()
allows you to duplicate a process. 使用
fork()
可以复制一个进程。
Try to explain better why you need to do it with multiple processes for more details. 尝试更好地解释为什么需要通过多个过程来执行此操作以获取更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.