| OCR Text |
Show 123 6.3 Parallel Execution Strategies As a result of the rapid decline in hardware costs and the need for modeling distributed computations, parallel programming and models for parallel execution of programs have been an active research area in recent years . Among others, functional programming (represented by data flow languages, e.g., [1, 19, 20]} and logic programmi ng (e.g., [14, 78, 105, 120]) have emerged as two promising f ormali zat ions for parallel processing. In this section we will argue that our functional model is amenable to data flow processing, and that the parallel execution model for Funlog can be viewed as an embedding of a data flow model into a parallel execution model for logic programs. The purpose of the example presented bel ow is twofo ld : (1) it serv es as a further demonstration of the power of the proposed computational model; (2) it illustrates how Horn clauses involving executable functions can be executed in a data flow model. Example 14. Fi nd ing the First N Lucky Numbers. A well-known number-theoretic computation involves the computation of lucky numbers [97], which proceeds as follows : from the list of numbers 1,2,3,4, ... we remove every second number, leaving the list 1,3,5,7,9, .... Since 3 is the first number (except for 1) that has not been used in "sifting," we remove every third number from the remaining numbers, obtaining 1,3,7,9,13,15,19,21, .... Every seventh number is next removed, leaving 1 ,3,7,9, 13,15,21 , .... and so on. The numbers that are never removed from the list are the lucky numbers. The difficulty with computational frameworks that do not support computations with infinite data structures is that it may require complex number-theoretic calculations to estimate a priori how many integers should be produced in order to get the first N lucky numbers. One can, of course, use a liberal range of integers to search for the first N lucky numbers in which case some of the computations wi ll be redundant. |