2,249
edits
Changes
no edit summary
This task (in its 2nd description) reminds the task of solving the context-sensitive grammar.
== Examples ==
=== Process tree, sessions and groups ===
In case of three IDs only we can define a task as a non-terminal looking like <code>{PGS[Ki]}</code> where <code>P</code> is task PID, <code>G</code> is task PGID, <code>S</code> is task Session ID and <code>[Ki]</code> is the list of children.
Initial tree would look like
<pre>
{111}
</pre>
and the rules would look like below.
<pre>
FORK: {T(..)(.*)} -> {T\1N\2}|{N\1} // T forks N
EXIT: {I(..)(.*)}(.*){X(..)(.*)} -> {I\1\2\5}\3 // X exits and all its kids are reparented to I (init)
SETSID: {S(.)(.*)} -> {SS\1} // S becomes a new session leader
SETPGID(0): {P(.)(.)(.*)} -> {P\1P\3} // P becomes a new group leader
SETPGID(G): {G(.)G(.*)}(.*){P(.)(.)(.*)} -> {G\1G\2}\3{P\4G\6} // P joins session of alive G
</pre>
[[Category: Plans]]
[[Category: Thinkers]]