monit-dev
[Top][All Lists]
Advanced

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

RE: Problems with depend


From: Jan-Henrik Haukeland
Subject: RE: Problems with depend
Date: Wed, 6 Nov 2002 02:31:29 +0100

> it's probably an easier and simpler way to
> solve this than to bring in Dijkstra and advanced graph algorithms.

I think that the algorithm can be kept simple, at least when I think about it
now late at night. The enclosed diagram shows the set-up. The diagram shows
first a dependency list, then the standard process list and finally a matrix
where the dependency list is combined with the process list. This is the
current data structure we already have. To start all processes in a dependant
order and not start or stop processes twice the following algorithm can be
used:

 for each process in the process list  (This is the standard for-loop in
validate.c)

  if process is marked as visited then
      continue;
  else
  again:
   if process has a depend list          $
    for each process in the depend list; @
       if process is marked then error("Got Loop");
       else goto again;
   else begin
           start/stop process;
           mark process as visited;
        end

That's basically it, the loop marked with @ must be recursive in that the
search is done for the process without a depend list then backtrack and
start/stop each process as we go back to the original process in the line
marked with $.

I think this should work (with some work), what do you think?

my $0.002 late at night

Jan-Henrik

Attachment: depend.gif
Description: GIF image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]