Page 1 of 1

Pipeline

Posted: Sat Apr 06, 2013 12:01 pm
by tappatekie
Just a quick post to check something.

Is this a pipeline? I have a class called Pipe and checking if this is what it actually is and not something else :)
(Every function call returns the the instance its held in)

Code: Select all

Pipe p = new Pipe()
     .DoSomethingWithState()
     .DoSomethingElseWithState();
object result = p.GetState();

Re: Pipeline

Posted: Sat Apr 06, 2013 3:21 pm
by qpHalcy0n
It does not appear so in this case.

A pipelined architecture refers to one with several distinct stages that are linked by some memory bus or transport mechanism. Also you have the concept of a producer/consumer there where stage B consumes what stage A produced and on down the line.

Re: Pipeline

Posted: Sat Apr 06, 2013 4:02 pm
by tappatekie
qpHalcy0n wrote:It does not appear so in this case.

A pipelined architecture refers to one with several distinct stages that are linked by some memory bus or transport mechanism. Also you have the concept of a producer/consumer there where stage B consumes what stage A produced and on down the line.
Thanks for the reply, there is a transport mechanism by using GetState() and SetState() each function can access and have the current state thus transporting data from one method to the other.

An example of code im using is for a stream

Code: Select all

StreamPipe pipe = new StreamPipe("file");
pipe
        .CreateBuffer(pipe.Length)
        .Read();
byte[] data = (byte[])pipe.GetState();

Re: Pipeline

Posted: Sun Apr 07, 2013 12:40 am
by qpHalcy0n
Myehhhh -_- ...no, still not seeing it that way.

Looks more like a stream, really if you're just reading files and doing other little things to them. There would be several stages that each do different things. With that you usually have a stream of data that gets progressively modified by the different stages. In the classical sense, look at pipelined microarchitecture. Fetch, decode, execute, write. 4-stage pipeline. Stream of data comes in (instructions/operands) and they are progressively analyzed and modified until they come out the other side. Like building a car in a factory with a single conveyer belt. Raw materials go in...each stage modifies....car comes out.

Querying data isn't really a "pipeline".

Re: Pipeline

Posted: Sun Apr 07, 2013 12:45 am
by tappatekie
qpHalcy0n wrote:Myehhhh -_- ...no, still not seeing it that way.

Looks more like a stream, really if you're just reading files and doing other little things to them. There would be several stages that each do different things. With that you usually have a stream of data that gets progressively modified by the different stages. In the classical sense, look at pipelined microarchitecture. Fetch, decode, execute, write. 4-stage pipeline. Stream of data comes in (instructions/operands) and they are progressively analyzed and modified until they come out the other side. Like building a car in a factory with a single conveyer belt. Raw materials go in...each stage modifies....car comes out.

Querying data isn't really a "pipeline".
Thanks for the advice :)
My usage of that class isn't just for streams, but it will be used for more complicated stuff later on (like rendering pipelines and script analysis)

Re: Pipeline

Posted: Sun Apr 07, 2013 12:47 am
by qpHalcy0n
Well, rendering IS a pipeline because you have a stream of data coming in and it is progressively modified by multiple units until you get some different output. However, simply having two units that both produce and consume isn't a pipeline at all. I'm not giving advice really...this is just....what that is.

Re: Pipeline

Posted: Sun Apr 07, 2013 9:51 am
by bbguimaraes
The best example of a pipeline I can think of are unix pipes, where you have a list of programs separated by pipes:
cat myfile | grep sometext | tr ":" " " | cut -d " " -f 1
The first command reads file "myfile" and feeds its content to the second, which filters only the lines with the text "sometext". The third reads these filtered lines and replaces all ":" with spaces and the fourth splits these lines by spaces and prints only the first field. What characterizes the pipeline is that each operation acts (only) on the results of the previous, and you feed this "black box" with some input (the content of the file) and it outputs processed information. I hope this makes things a little bit more clear.

Re: Pipeline

Posted: Sun Apr 07, 2013 2:36 pm
by dandymcgee
bbguimaraes wrote:The best example of a pipeline I can think of are unix pipes, where you have a list of programs separated by pipes:
cat myfile | grep sometext | tr ":" " " | cut -d " " -f 1
That's actually a really useful example. Though I've known what the pipe character is and does for a long time, I've never compared it something like a graphics pipeline.