![]() ![]() Updating (by calling snprintf function) some global variable, from user context (IOCTL implementation), should be protected by mutex.Adding or deleting the element of the shared linked list, from user context (IOCTL implementation) only, may be protected by spinlock.If the number of "readers" is significantly higher than number of "writers", consider using read/write primitives (more details is here ).If the critical section is fast enough (that is, it's better for waiting thread to be in busy wait loop than execute voluntary context switch) and it can't switch off the current task (put it to sleep) and the number of simultaneously contending threads is small enough, then use spinlock, otherwise use mutex. ![]() we need to know how fast the critical session, can it switch the current task and how many simultaneously contending threads could be.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |