Skip to main content

SharedDequeUrd

Struct SharedDequeUrd 

Source
pub struct SharedDequeUrd { /* private fields */ }
Expand description

MMF-backed UMWAIT Rendezvous Deque. Single owner, N pre-configured thieves.

Implementations§

Source§

impl SharedDequeUrd

Source

pub fn create<P: AsRef<Path>>(path: P, n_mailboxes: usize) -> Result<Self>

Create a fresh URD file with n_mailboxes mailboxes (one per intended thief). Minimum 1. The round-robin cursor reduces modulo n_mailboxes (no pow2 requirement so a single-thief bench can use n = 1).

Source

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open an existing URD file.

Source

pub fn n_mailboxes(&self) -> usize

Number of configured mailboxes.

Source

pub fn wait_strategy(&self) -> WaitStrategy

Wait strategy this URD instance picked (per CPUID).

Source

pub fn publish_strategy(&self) -> PublishStrategy

Publish strategy this URD instance picked (per CPUID).

Source

pub fn owner_pid(&self) -> u64

Owner pid at create time, or 0 after close_owner().

Source

pub fn close_owner(&self)

Owner shutdown: zero pid + advance epoch.

Source

pub fn publish_to( &self, target: usize, items: &[LineItem], ) -> Result<usize, PublishError>

Owner-side: publish items to mailbox target. Spins until the mailbox is EMPTY (the previous batch has been consumed), then publishes via the per-host PublishStrategy:

  • PublishStrategy::Movdir64b: builds a 64-byte source line and atomically writes the whole mailbox cache line via the MOVDIR64B instruction (one Write-Combining store, no RFO).
  • PublishStrategy::Scalar: writes items via cached stores, then Release-stores the state word to READY (two- step protocol).

Returns the number of items published.

Source

pub fn publish_round_robin( &self, items: &[LineItem], ) -> Result<(usize, usize), PublishError>

Owner-side: publish items to the next round-robin mailbox. Returns (target, n_published).

Source

pub fn drain_mailbox(&self, mailbox_idx: usize) -> Drain

Thief-side: drain own mailbox if it has READY items. mailbox_idx is the thief’s pre-assigned mailbox. Returns Drain::Empty when the state byte is EMPTY (no work published yet).

Source

pub fn wait_and_drain(&self, mailbox_idx: usize, deadline_tsc: u64) -> Drain

Thief-side: block (per the host’s WaitStrategy) until the mailbox transitions to READY, then drain it.

On WAITPKG-capable hardware the thief uses UMONITOR + UMWAIT to halt; otherwise it uses PAUSE-spin. The deadline is expressed as the absolute TSC value at which UMWAIT returns even if the line has not transitioned; u64::MAX means “no deadline” (wait indefinitely - protocol risk if the owner never publishes).

Source

pub fn flush_to_disk(&self) -> Result<()>

Force any dirty pages to disk.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.