Producer consumer issues and first come first served algorithms