Hi Stephen, 2022-02-24 09:44 (UTC-0800), Stephen Hemminger: > There seems to be some confusion here: > pthread_mutex put thread to sleep if contended and on linux are built on > the futex system call. > pthread_rwlock are the reader/writer versions of these. > > The DPDK has primitives for multiple types of locks: spinlock, rwlock, > ticketlock, pflock, etc > these are build using atomic primitives (no syscall). > these are platform independent > these spin if contended > > Not sure about Windows, but it looks like slim rwlocks came from Windows NT > and are an implementation > of the same kind of spinning lock DPDK already has.
Both CRITICAL_SECTION and SRW lock spin shortly before going into kernel, but both do this eventually---SRW lock is not a purely user space primitive.