Home > OS >  LINUX processes write lock is jammed the blocking state, use gstac command and then continue to norm
LINUX processes write lock is jammed the blocking state, use gstac command and then continue to norm

Time:09-19

Multiple processes, Shared memory + read-write lock control, the process of 20, have individual process blocking jammed state, and then use gstack command to view the process or the GDB attach hang process with a block not continue to go down again, knock gstack command displays the blocked on pthread_rwlock_wrlock function, then process to run back to normal, otherwise has been blocking state

CodePudding user response:

Pthread_rwlock Shared memory is used to implement process between the lock? , I only know that in the Shared memory used pthread_mutex_t + condition variables can realize mutual exclusion, also need to set pthread_mutexattr_setrobust_np, also have to deal with the process after locking the influence of abnormal exit are (not),

Like you have the owner didn't see pthread_rwlock exception handling mechanism of quitting,
Suggested use: cache file + flock to achieve interprocess read-write lock
Or use sys_v semphore implementation
  • Related