Hermes  0.9.5-beta
Hierarchical Distributed I/O Buffering System
hermes::BufferPool Struct Reference

#include <buffer_pool.h>

Collaboration diagram for hermes::BufferPool:

Public Attributes

ptrdiff_t headers_offset
 
ptrdiff_t devices_offset
 
ptrdiff_t targets_offset
 
ptrdiff_t free_list_offsets [kMaxDevices]
 
ptrdiff_t slab_unit_sizes_offsets [kMaxDevices]
 
ptrdiff_t slab_buffer_sizes_offsets [kMaxDevices]
 
ptrdiff_t buffers_available_offsets [kMaxDevices]
 
TicketMutex ticket_mutex
 
std::atomic< i64capacity_adjustments [kMaxDevices]
 
i32 block_sizes [kMaxDevices]
 
i32 num_slabs [kMaxDevices]
 
u32 num_headers [kMaxDevices]
 
i32 num_devices
 
i32 num_targets
 
u32 total_headers
 
f32 min_device_bw_mbps
 
f32 max_device_bw_mbps
 

Detailed Description

Contains information about the layout of the buffers, BufferHeaders, and Devices in shared memory.

Some terminology: block - A contiguous range of buffer space of the smallest unit for a given Device. The size for each Device is specified by Config::block_sizes[device_id]. RAM is typically 4K, for example. buffer - Made up of 1 or more blocks: 1-block buffer, 4-block buffer, etc. slab - The collection of all buffers of a particular size. e.g., the 4-block slab is made up of all the 4-block buffers.

When Hermes initializes, the BufferPool is created and initialized in a shared memory segment, which is then closed when Hermes shuts down. A pointer to the BufferPool can be retrieved with the function GetBufferPoolFromContext. All pointer values are stored as offsets from the beginning of shared memory. The layout of the BufferPool is determined by the Config struct that is passed to InitBufferPool. Multiple BufferPools can be instantiated, but each must have a different buffer_pool_shmem_name, which is a member of Config. Each BufferPool will then exist in its own shared memory segment.

Member Data Documentation

◆ headers_offset

ptrdiff_t hermes::BufferPool::headers_offset

The offset from the base of shared memory where the BufferHeader array begins.

◆ devices_offset

ptrdiff_t hermes::BufferPool::devices_offset

The offset from the base of shared memory where the Device array begins.

◆ targets_offset

ptrdiff_t hermes::BufferPool::targets_offset

The offset from the targets

◆ free_list_offsets

ptrdiff_t hermes::BufferPool::free_list_offsets[kMaxDevices]

The offset from the base of shared memory where each Device's free list is stored. Converting the offset to a pointer results in a pointer to an array of N BufferIDs where N is the number of slabs in that Device.

◆ slab_unit_sizes_offsets

ptrdiff_t hermes::BufferPool::slab_unit_sizes_offsets[kMaxDevices]

The offset from the base of shared memory where each Device's list of slab unit sizes is stored. Each offset can be converted to a pointer to an array of N ints where N is the number of slabs in that Device. Each slab has its own unit size x, where x is the number of blocks that make up a buffer.

◆ slab_buffer_sizes_offsets

ptrdiff_t hermes::BufferPool::slab_buffer_sizes_offsets[kMaxDevices]

The offset from the base of shared memory where each Device's list of slab buffer sizes is stored. Each offset can be converted to a pointer to an array of N ints where N is the number of slabs in that Device. A slab's buffer size (in bytes) is the slab's unit size multiplied by the Device's block size.

◆ buffers_available_offsets

ptrdiff_t hermes::BufferPool::buffers_available_offsets[kMaxDevices]

The offset from the base of shared memory where each Device's list of available buffers per slab is stored. Each offset can be converted to a pointer to an arry of N (num_slabs[device_id]) std::atomic<u32>.

◆ ticket_mutex

TicketMutex hermes::BufferPool::ticket_mutex

A ticket lock to syncrhonize access to free lists

Todo:
(chogan): optimization - One mutex per free list.

◆ capacity_adjustments

std::atomic<i64> hermes::BufferPool::capacity_adjustments[kMaxDevices]

capacity adjustment for each device

◆ block_sizes

i32 hermes::BufferPool::block_sizes[kMaxDevices]

The block size for each Device.

◆ num_slabs

i32 hermes::BufferPool::num_slabs[kMaxDevices]

The number of slabs for each Device.

◆ num_headers

u32 hermes::BufferPool::num_headers[kMaxDevices]

The number of BufferHeaders for each Device.

◆ num_devices

i32 hermes::BufferPool::num_devices

The total number of Devices.

◆ num_targets

i32 hermes::BufferPool::num_targets

total number of targets

◆ total_headers

u32 hermes::BufferPool::total_headers

The total number of BufferHeaders in the header array.

◆ min_device_bw_mbps

f32 hermes::BufferPool::min_device_bw_mbps

minimum device bandwidth in Megabits per second

◆ max_device_bw_mbps

f32 hermes::BufferPool::max_device_bw_mbps

maximum device bandwidth in Megabits per second


The documentation for this struct was generated from the following file: