epoch(9) background information?

Matthew Macy mmacy at freebsd.org
Wed Aug 22 07:09:52 UTC 2018


>

> > Yes. Very. It is generally not permitted to hold a mutex across
> > epoch_wait() that's why there's the special flag EPOCH_LOCKED. If you
> > have a very limited number of threads, you might want to have each
> > thread have its own record registered with the epoch. Then you
> > wouldn't need the CPU pinning. The pinning is just away of providing a
> > limited number of records to an unbounded number of threads.
>
> Thanks for the prompt answer.
>
> Do I need a record per thread and per epoch? Could I use only one (maybe
> dependent on the nest level?) record per thread?
>
>


A record can only be registered with one epoch. And yes you can have just
one single global epoch. However, then the epoch_wait_preempt time  or time
until the gc task is run is determined be the longest epoch section
globally.

It may help to look at the ck_epoch man pages and the implementation in ck
https://www.mankier.com/3/ck_epoch_register

https://github.com/concurrencykit/ck/blob/master/src/ck_epoch.c

https://github.com/concurrencykit/ck/blob/master/include/ck_epoch.h

> --
>
>


More information about the freebsd-hackers mailing list