clone - CLONE_THREAD and CLONE_SIGHAND without CLONE_VM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I want to solve the following situation in a better way than
it is currently solved. I have come into a conclusion that
the proper solution might actually involve kernel patch.
I would like to discuss it here.

Situation:
I spawn several processes. I want this group of processes
to terminate when any one of them terminates (dies,
or just exits).

A few of these processes are third party binaries.
That programmatically only leaves me with the signal API.
Which is the current solution is about.

The imperfections:
Sending a signal can fail. A process can be killed with -9.
In both cases, I will most probably fail to achieve my
objective of killing the entire process group.

Therefore the clone system call has gained my attention.
Something like creating a new execution context
in the same group, but with private virtual memory space.
The intention of "the same group" is that when the leader
dies, then everybody else in the group does. Or when
the group is killed with -9, then entire group dies.

My usecase for this could be shortly described as
a distributed hierarchical component system. Where
a component instance can be composed from subcomponents.
This subcomponent instance can be a process. When such
subcomponent instance dies, than also the entire component
instance (which means the other subcomponent instances also die).

And the idea of a kernel patch would be to create threads
in a thread group but each thread having a private virtual memory space.
It don't take it for a bright idea but it might as well do the job for me.

In terms of flags - be able to specify CLONE_THREAD but without CLONE_VM.
CLONE_THREAD also requires specifying CLONE_SIGHAND (this one is wanted),
and CLONE_SIGHAND requires CLONE_VM (which is not wanted).

What's your opinion?

BlackHole

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux