[PD] process id again for building a watchdog

Roman Haefeli reduzent at gmail.com
Tue Oct 26 01:04:28 CEST 2010


Sorry for falling into the old "Linux is good / Windows is bad"
argument, but my experiences with computers in exhibitions running
Windows 7 were almost always bad. Not that it wouldn't run stable, but I
found it very hard to create a setup suitable for an exhibition
situation which has completely different needs than the standard
corporation "everything is controlled by the domain" office situation
which Windows 7 basically is made for. Especially when it comes
pre-installed one hardly has the chance to take all hurdles beforehand
to ensure flawless *non-interactive* exhibition service. Things are
getting really difficult, if suddenly some warnings pop up while the
machine is hidden behind the wall and keyboard / mouse access are hard
to achieve. Things even get worse, if after running some days without
troubles suddenly some update is due although the box is not connected
to the net and there is no other way to make the regular pop-ups
disappear than either find some Internet in the exhibition space or go
the hard way and take the machine out from behind the wall and bring it
to some place with Internet.

OK, you might find it a bad idea anyway to put the box behind the wall
but you get my point. In my experience Macs/OS X are very easy to handle
and are quickly set up for exhibition. Things like autostart in the
morning and auto-shutdown in the evening are configured within seconds.
And what turned out most important: Once you have it up and running and
tested in the lab, you can be quite sure that it'll reliably run the
same way for the next weeks in the wild. Compared to Windows 7 a naked
OS X is pleasingly non-interactive. The same goes for Linux, plus it
comes with a high degree of flexibility. Personally, I prefer the latter
for exhibitions, but that is also my political bias. 

I am in doubt if writing the watchdog in C is the best approach in your
situation. Personally, I found Pd(-vanilla) to run very stable. Things
are getting trickier if some externals are involved. Why not writing the
watchdog in Pd and if you don't trust Pd that much, run two instances of
it that watch each other?


On Tue, 2010-10-26 at 00:01 +0200, brandt at subnet.at wrote:
> hi all
> does anybody know how i can get the process id in win7 of every  
> instance of three pd´s to use them for a watchdog, which is checking,  
> if the instances are still alive and if not kill the one not  
> responding and open it again.
> i would like to check for an "ever" running installation, which is  
> done in pd, if all of the instances are working and not to restart the  
> computer every 24 hour, which i feel, is not very elegant.
> so, my idea is to have an objekt which is checking at the startup of  
> the instance its PID, storing it and sends it back to the watchdog on  
> demand, via netsend.
> the watchdog itself should, as i feel been written in c or anything  
> else but not pd.
> i would like to code the watchdog, but my knowledge in coding is as  
> low as low..... :-) since i´m "just" a patcher. even the process of  
> compiling in windose is something like a country of questions and  
> miracles, but anyhow, i´ve once was trained in programming c.... but  
> pd was far too cool to practice that. i´ve made all my  dreams come  
> true within pure data.....thank you by the way.
> maybe the snippet below is a start...
> ________________________________________________________________________________
> Program to print its Process ID, Parent Process ID and Group ID
> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <sys/types.h>
> int main()
> {
>          pid_t pid, ppid;
> 	gid_t gid;
> 	/* get the process id */
> 	if ((pid = getpid()) < 0) {
> 	  perror("
> unable to get pid");
> 	} else {
> 	  printf("
> The process id is %d", pid);
> 	}
> 	/* get the parent process id */
> 	if ((ppid = getppid()) < 0) {
> 	  perror("
> unable to get the ppid");
> 	} else {
> 	  printf("
> The parent process id is %d", ppid);
> 	}
> 	/* get the group process id */
> 	if ((gid = getgid()) < 0) {
> 	  perror("
> unable to get the group id
> ");
> 	} else {
> 	  printf("
> The group id is %d
> ", gid);
> 	}
> 	return(0);
> }
> ______________________________________________________________________________
> any help preciated
> sorry for my english
> der.brandt
> thank you
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

More information about the Pd-list mailing list