TOC, 1, 2, 3,
4, 5, 6,
7, 8, 9,
10, 11, 12
13, 14
8) PROGRAMMING IN NETWORK LINDA
8.1) Is there a way to find out how many
processors are available to avoid evaling more Linda processes than
processors?
Use the lprocs()
function in C-Linda, and
the flprocs()
function in Fortran-Linda. The value returned
includes the real_main
process. Thus, the value is >= 1, and it
is safe to execute (lprocs() - 1)
evals, as in the example
for (i = 0; i < lprocs() - 1; i++)
eval("worker", worker(i));
Note that your program may need to check if lprocs()
returns
one, if it needs to execute at least one eval
to work properly.