Re: sharing memory with non-children



Logan Shaw <lshaw-usenet@xxxxxxxxxxxxx> writes:

>> How many and how big do you have to go?
>
> Well, basically the specific reason is that I'm toying with writing a
> program that will stream large amounts of data from one process to
> another. In principle, I could just use a pipe, but for performance
> reasons, shared memory seems better. I've already written a test
> program that uses shared memory and semaphores to make a pseudo-pipe
> between a parent and its child, but I'd like to be able to do it
> between arbitrary processes, or at least to know whether it's possible.

If you STREAM the data from one process to the another, you don't
necessarily need a big buffer. The size of the shared memory circular
buffer you'll use will impose a synchronization between the two
processes, the smaller the more synchrones they'll be, but it is
entirely independant of the size of the data to be STREAMED.


> Anyway, the thing is that I would like the user to be able to say how
> large a buffer they need: some of this data might come from disk and
> stream over the network (or vice versa), so larger buffers are better,

Even large buffers can be filled.


> and for performance reasons, I'd rather avoid copying the data more
> than necessary, which means a large shared buffer is even better.
> And the number of buffers needed would just depend on what the user
> is trying to accomplish.
>
> Also, in general, I hate putting arbitrary limits on things if there
> is no good reason to do so. It just makes your software suck. :-)
>
> - Logan

--
__Pascal Bourguignon__ http://www.informatimago.com/

"Specifications are for the weak and timid!"
.



Relevant Pages

  • Re: I/O buffering
    ... StreamReader also buffers data? ... so they buffer as well. ... Neither StreamReader nor StreamWriter inherit from FileStream. ... What StreamReader and StreamWriter _do_ use is any Stream instance. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Assembly conversion to Pocket Pc format
    ... But in my case it is throwing exception before executing that statement what ... That is before reading buffer size it is throwing ... Stream respStream = resp.GetResponseStream; ... upload and download files in compact framework. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: I/O buffering
    ... classes (those with word Buffer in their name)? ... Stream class. ... One would not normally use BufferedStream with a FileStream, ... explicitly dispose your custom Stream class, when you were sure you were   ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: WMS source changing issue
    ... we use 5 second buffer in WMP. ... The question is - why the server is stopping broadcasting for a while (it ... clearly seen in network statistic in Task Manager) when switching to file ... We're streaming one 5Mbps live stream and one 5Mbps CBR file periodically so ...
    (microsoft.public.windowsmedia.server)
  • Re: scanf() quesion?
    ... characters are intended to ... When a stream is fully buffered, ... when a buffer is filled. ... If standard output refers to an interactive device, ...
    (comp.lang.c)