PRS_NEW: Check it or not?
It seems that I have caught a race condition which can be triggered by renice(1), and we need to take PRS_NEW into account when we need to
access several attributes of a process object.
Robert has pointed out that we may want to just initialize the attribute
early to avoid the race condition. After reading some old 4.4BSD code it
seems that the process object is linked into allproc list before
everything is initialized.
PRS_NEW was introduced by the original KSE commit where p_stat was
replaced with p_state and has replaced SIDL. The latter was in 4.4BSD.
在线阅读本文并参与讨论 delphij's Chaos blog.delphij.net/posts/2007/01/prs-new-check-i/