Учитывая ваши определения, я бы выбрал файлы, включая именованные каналы, в общей файловой системе. Протокол 9p, в частности, был разработан для этого, где программы будут экспортировать виртуальные файловые системы и реагировать на события.
Не уверен, почему вы исключили именованные каналы из исходного списка.
Когда Родитель процесса умирает, можно сказать, что процесс «не имеет родителя». Когда это происходит, PPID
устанавливается равным 1, PID init
.
Каждый процесс возвращает значение $STATUS
при выходе. Родитель может что-то сделать с этим значением, но он ДОЛЖЕН освободить
память, в которой хранится $STATUS
, и освободить данные процесса в ядре.
Процессы всегда имеют родительский процесс. Однако процесс, который становится новым родителем, когда существующий процесс умирает, не обязательно имеет PID 1. Вот как это делает Linux:
/*
* When we die, we re-parent all our children, and try to:
* 1. give them to another thread in our thread group, if such a member exists
* 2. give it to the first ancestor process which prctl'd itself as a
* child_subreaper for its children (like a service manager)
* 3. give it to the init process (PID 1) in our pid namespace
*/
static struct task_struct *find_new_reaper(struct task_struct *father,
struct task_struct *child_reaper)
{
struct task_struct *thread, *reaper;
thread = find_alive_thread(father);
if (thread)
return thread;
if (father->signal->has_child_subreaper) {
unsigned int ns_level = task_pid(father)->level;
/*
* Find the first ->is_child_subreaper ancestor in our pid_ns.
* We can't check reaper != child_reaper to ensure we do not
* cross the namespaces, the exiting parent could be injected
* by setns() + fork().
* We check pid->level, this is slightly more efficient than
* task_active_pid_ns(reaper) != task_active_pid_ns(father).
*/
for (reaper = father->real_parent;
task_pid(reaper)->level == ns_level;
reaper = reaper->real_parent) {
if (reaper == &init_task)
break;
if (!reaper->signal->is_child_subreaper)
continue;
thread = find_alive_thread(reaper);
if (thread)
return thread;
}
}
return child_reaper;
}