delphij's Chaos

选择chaos这个词是因为~~实在很难找到一个更合适的词来形容这儿了……

18 Jan 2007

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.