|
-
January 19th, 2011, 02:04 AM
#1
FIFO help
Hi,
I am writing the code using C++. I understand that using FIFO we can write the data into the special type of file and another process can read the data from that file.
Assume that i have created the FIFO and doing the below action.
1) Writing the data (opened in the non block mode) and the process is closed.
2) Writing the data (opened in the non block mode) and the process is closed.
3) Writing the data (opened in the non block mode) and the process is doing some other work.
I am opening the another process (when process on step3 is alive) and open the FIFO in the read mode and trying read the data. What are the data i will be receiving while reading the FIFO (i mean whether the data written on the step1, step2 and step3 else only the step3 data will be available).
When i test this scenario i found that only the step3 data is available with read option. But my requirement is, there are multiple threads in the single process that will write the data into the FIFO.
And the another process (child process) needs to read the written data and process those data. The child process will not be running always, and so when ever i am running the child process i need to read the FIFO data from the beginning else from next line where stop reading in the last time. How to do that.
If there any other possibilities to that other than FIFO, i request you to suggest the same.
Thanks in advance.
Thanks and Regards,
Sathish
-
January 19th, 2011, 02:30 AM
#2
Re: FIFO help
 Originally Posted by sathishbabu07
If there any other possibilities to that other than FIFO, i request you to suggest the same.
A FIFO data structure is fine. It's the standard way for producer-consumer communication.
But you need to make sure that you use a proper FIFO implementation for your needs. In your case it must work in a multithreaded environment since it looks like you're having multiple concurrent producers.
FIFO is just a general term for "first in - first out". You need to be more specific about what kind of FIFO you're using to get better advice. I also suggest you reformulate this,
"i need to read the FIFO data from the beginning else from next line where stop reading in the last time"
It's hard to understand what you mean. Do you want to use the FIFO in a non-standard way?
Last edited by nuzzle; January 19th, 2011 at 02:49 AM.
-
January 19th, 2011, 05:35 AM
#3
Re: FIFO help
Hi,
Thanks for your quick reply.
I have the parent application and it has multiple thread. All the thread is using the same FIFO to write the data.
I have the separate child application this needs to get the information from the parent application (what ever is being writing into FIFO).
The parent application will be running always and writing the information into FIFO. But the child application will run when it needs data from parent and after reading some amount of data, the child will remain closed.
After some time the child will run again and that time i need to read the data from FIFO like as below
1) Where i quit the previous data reading
2) From the beginning of the FIFO
Please help me to make this happen either using FIFO else suggest some other scenario.
Thanks and Regards,
sathish
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|