ringbuffer的特别之处

tech2024-10-23  26

ringbuffer到底是什么? 嗯,正如名字所说的一样,它是一个环(首尾相接的环),你可以把它用做在不同上下文(线程)间传递数据的buffer。

我们实现的ring buffer和大家常用的队列之间的区别是,我们不删除buffer中的数据,也就是说这些数据一直存放在buffer中,直到新的数据覆盖他们。这就是和维基百科版本相比,我们不需要尾指针的原因。ringbuffer本身并不控制是否需要重叠(决定是否重叠是生产者-消费者行为模式的一部分–如果你等不急我写blog来说明它们,那么可以自行检出Disruptor项目)。

U2FsdGVkX1+doZDLgrm8f7DLXt9OIImilP7nzuNzNc4OtCKddB5SqA+5j/bilZk3 BpkWJyUtwi9A086FAsJfIVhR+vjPub2ZTKFNSa9H9bnaKcXhOrV4Sr4DKfXCpwF9 yUUlft/0tXGgTzdbZVC6Ptpn8jEFQ6O6DbwuM3nJGOV4kmgKMZKnwBHy9sw8WJTr pIPqWmiIZn3V6OW2xdqBf29y2U/8BgzHqu+o72Q60VHiHwFk6ar/FeXX1EK8pPb3 tAMJCGd0ko0oUuD1DwNZclSZoJCsBogl2WGkiaJQKQf8I6hxJ5myUS7YPwo0gdf0 zsq1r/QwKh/blb/kSgxYee27tjNIY7x8R7Ek6RP3NzVFPwcc3T6u+oz7JIGm9/+q kXG29mWtV00h3vwXUp4axUxZZ2mxmiNwflvn5TJe0Ol5ccl/SgsCOJ4XrC5AeoY/ UkAeE1z+1F/xkcPuJ177Q9praXJ8seCrAwF3rhgCcOgS7FSnuHZbhaIAYh0ph3X3 crT7BIcmmlwK7VpNBk78qKGsKff/W2yvQpGnXukRCy7PAKrt9Ehdlz1lBjV6Cmsp TNRrndoYgOgukCwzP7UYx9zdXJsGVWe1bsyknFU32CkftSnFvY2cDZmm4pv+31QO 7858DS0ovNOGXAbGFhqqV//q83lczciX26UcLMtPazQrizQsV/ARIV+HVCV1wZ/H suXD0Y+tAMcA1Z1doSvX6YG6ZmylUqeBoWKc+QRhz47FVwXWileNE/rAoOrGvTRQ Ha9CgyN+Mvgb3F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