here is my approach.

shared variables : in, out
shared memory : buf[N]

writer
while(1)
{
    while(in+1 % N ==out)
   { // waiting
    }
   buf[in+1]= input;
   in = in+1 % N
}


reader
while(1)
{
    while(out == in)
   { // waiting
     }
   output = buf[out]
   out = out+1 % N
}


On Tue, Feb 15, 2011 at 10:35 PM, Ashish Goel <[email protected]> wrote:

> as i see this would need synchronization...
> anyone tried it so far?
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
regards,
chinna.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to