Closed usrme closed 1 year ago
Here's how to roughly see how everything looks like:
pidof wishlistlite
watch -n 1 'pstree -p <PID from command above> -s'
<PID from command above>
can also be replaced with $(pidof wishlistlite)
directly-s
option is to show parent processesI've removed some of the parent processes for brevity, but here are some static views:
systemd(1)───...───wishlistlite(85716)─┬─{wishlistlite}(85717)
├─{wishlistlite}(85718)
├─{wishlistlite}(85719)
├─{wishlistlite}(85720)
├─{wishlistlite}(85721)
├─{wishlistlite}(85722)
├─{wishlistlite}(85723)
├─{wishlistlite}(85724)
└─{wishlistlite}(85725)
systemd(1)───...───wishlistlite(85716)─┬─ssh(85853)───ssh(85854)
├─{wishlistlite}(85717)
├─{wishlistlite}(85718)
├─{wishlistlite}(85719)
├─{wishlistlite}(85720)
├─{wishlistlite}(85721)
├─{wishlistlite}(85722)
├─{wishlistlite}(85723)
├─{wishlistlite}(85724)
├─{wishlistlite}(85725)
├─{wishlistlite}(85855)
├─{wishlistlite}(85856)
├─{wishlistlite}(85857)
└─{wishlistlite}(85858)
systemd(1)───...───ssh(85716)───ssh(85853)
Note how the original process ID of Wishlist Lite (85716) is now that of the SSH process'. This is happening because of the call to syscall.Exec
here, which in turn invokes the 'execve(2) system call', which:
causes the program that is currently being run by the calling process to be replaced with a new program, with newly initialized stack, heap, and (initialized and uninitialized) data segments.
I'm thinking that I'll just add this to the README and be done with it as I don't think there's a big point in trying to postpone this in the hopes of finding a nice automatic visualization.
With the somewhat convoluted logic of starting the main program (i.e. Wishlist Lite), which starts a goroutine for the parent SSH connection and once that's done the main program is replaced with a child SSH connection to the control socket from the parent SSH connection, I'm wondering whether this seeming flow can somehow be visualized by observing system resources.