Reputation: 127
I'm trying to make an operating system project, but I'm having some problems. In this this project, I have four child processes, which are the sender, encrypter, decrypter, and receiver processes, and a parent process.
The parent process should send a message to the sender process as a parameter, and the sender will send the message via pipe to encrypter, encrypter will send to decrypter, and also decrypter swill end the message to the receiver process.
How can the parent process send the message to the sender process without using a pipe?
Upvotes: 0
Views: 233
Reputation: 754090
As ayushi1794 correctly noted in the answer, the question is under-specified. Where does the initial (parent) process get the message should be passed to the sender?
Options include:
At one level, there is no need for the parent to pass anything to the sender
process; it has a complete copy of everything that's in the parent, at least when it is first forked. It is not clear whether the sender
is part of the main program, or whether it is a separate executable that will be executed. It is simpler if it is just a function in the main program (ditto for the encrypter, decrypter, and receiver).
While you're writing the code, remember to make sure you can debug it. Make sure the processes identify themselves, and print appropriate representations of the inputs and outputs (I know you think the input to the encrypter is the same as the output of the sender, but make sure you really are getting exactly what you thought you were getting — did you get a null terminator for the string, for example?). Remember that encrypted data is usually arbitrary binary character stream; it may well contain embedded zero bytes.
Upvotes: 0
Reputation: 101
The question sounds little ambiguous. Can you give details about these processes.
But from what I understand, why don't you simply fork the sender from the parent. The message which is there in the parent will automatically be copied in the sender child...
Upvotes: 1