Re: Fwd: Re: cpg latency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21.05.2012 15:34, Voznesensky Vladimir wrote:
So, every message write to the ring buffer consist of the steps:
  1. If buffer_size - (write_pointer - read_pointer) % buffer_size < message_size + 1,
    • set errno=EAGAIN and return;
  2. If write_pointer + message_size > buf_pointer + buf_size
    • write a special message to mark buffer overlimit,
    • set write_pointer = buf_pointer,
    • do the 1st step again and goto 3.
  3. Write the message starting from the write pointer;
  4. Write 1 to the eventfd;
  5. <write pointer> += <message size>.
Every read consists of the steps:
  1. Poll the file descriptors including the eventfd in the main loop, so the eventfd becomes readable;
  2. Read the value from the eventfd.
  3. Read the message from the buffer;
  4. If the message is special,
    • set read_pointer= buffer_pointer,
    • do the 3d step again;
  5. Process the message;
  6. read_pointer += message_size;
  7. If the read pointer is not equal to the write pointer,
    • goto 3.
Am I correct here? Is my pseudocode optimal?
Opps, reading the eventfd should be done after the last step.

-- VV
_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss

[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux