In a map, each data item appearing onto the output stream is splitted into its basic components, each one of the components is processed using a function f and finally the computed components are re-assembled into a data structure iso-morphic to the original one. In the simplest case (the one currently implemented in ocamlp3l, a new vector is computed by the map built out of the elements of the new vector computed by applying f to the elements of the original vector.

Functionally map f has type

'a vector stream -> 'b vector stream
provided that the function f has type

'a -> 'b.

Given the input stream :xn:...:x1:x0: the map map(f,n) computes the output stream :(Array.map f xn):...:(Array.map f x1):(Array.map f x0): by using n worker processes

In terms of (parallel) processes, a vector data item appearing onto the input stream of a map is splitted in components and each component is submitted to the one of the worker processes computing f. Each worker process applies the same function to the data items received and delivers the result onto the output stream. The resulting process network looks like the following:

The emitter process takes care of (sub)task-to-worker scheduling, while the collector process takes care of rebuilding the vector with the output data items and of delivering the new vector onto the output data stream. Have a look at the map behaviour, in terms of data items processed.


Back to the skeleton set page.