Skip to content

Why shall we need blocks? #6

Open
@TheodoreG

Description

@TheodoreG

Hey, I am reading the implementation of SPSC Var queue, I found that the minimum unit to store data is called block, each block is 64Bytes, which is consistent to the size of cacheline.
But for https://github.com/rigtorp/SPSCQueue, he did not use this design, he just make the data buffer region aligned with cacheline both in start and the end. But inside the buffer, data is next to each other.
This design may bring the problem of wasting space when data pushed has little size, like 4B or 8B, cause each of them would take the whole block.
Could you help to explain it? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions