GB2173614A - Calculating processing method - Google Patents

Calculating processing method Download PDF

Info

Publication number
GB2173614A
GB2173614A GB08603266A GB8603266A GB2173614A GB 2173614 A GB2173614 A GB 2173614A GB 08603266 A GB08603266 A GB 08603266A GB 8603266 A GB8603266 A GB 8603266A GB 2173614 A GB2173614 A GB 2173614A
Authority
GB
United Kingdom
Prior art keywords
predicate
queue
execution
lazy
program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
GB08603266A
Other versions
GB2173614B (en
GB8603266D0 (en
Inventor
Takeshi Chusho
Hirohide Haga
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Publication of GB8603266D0 publication Critical patent/GB8603266D0/en
Publication of GB2173614A publication Critical patent/GB2173614A/en
Application granted granted Critical
Publication of GB2173614B publication Critical patent/GB2173614B/en
Expired legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/313Logic programming, e.g. PROLOG programming language
    • G06F8/3135Unification or backtracking

Abstract

A logic programming language machine involves restoration of a side effect when a backtracking is executed after an execution of a predicate accompanied by a side effect. The machine functions in place of an indication to execute a predicate accompanied by a side effect, to preserve such a predicate in a queue, to dequeue the predicate from the queue at the backtracking, and to execute predicates in the queue, wherein a specific atomic formula is enqueued in a lazy execution queue (6), the enqueued atomic formula is dequeued and executed, and the enqueue operation is cancelled. <IMAGE>

Description

SPECIFICATION Calculating processing method Background of the invention Field of the invention The present invention relates to a calculation processing method, and in particular, to a calculation processing method in which a calculation processing associated with a side effect of a program is delayed as long as possible so that such a processing is easy to cancel.
Description of the prior art In the conventional calculation processing method using a logic programming language, Prolog, for example, there has been provided a backtracking function as described in the literature "Programming in Prolog" by W.F. Clocksin and C.S. Mellish, especially Section 6.4, namely, when the execution of all clauses for a subgoal taken on the way to a final goal is found to have failed, the processing is backtracked to execute clauses that have not been executed, for the previous subgoal. However, considerations have not been given to such a point that when a backtracking occurs after execution of an input/ output processing or a database manipulation, a side effect resulting from the execution, such as an action for modifying a program function, for example, due to a write operation effected in a global memory should be removed.
Summary of the invention It is therefore an object of the present invention to provide a calculation processing method having a function for delaying an actual execution of a built-in predicate accompanied by a side effect to a point at which backtracking may no longer occur, thereby minimizing deterioration of an inference facility using backtracking specifically characteristic for the logic programming language (machine) such as the Prolog, caused by utilization of the built-in predicate accompanied by a side effect unrecoverable upon occurrence of the backtracking.To this end, the present invention provides a calculation method in a language-oriented machine including a built-in predicate unit and an information processing unit comprising the steps of providing a lazy execution queue; enqueuing a specific atomic formula in the lazy execution queue; dequeuing and executing the enqueued atomic formula; and cancelling the enqueuing operation when backtracking occurs.
Brief description of the drawings The present invention will be apparent from the following detailed description taken in conjunction with the accompanying drawings in which: Figure 1 is a diagram illustrating an example of a prior art Prolog program; Figure 2 is a system configuration diagram illustrating an embodiment of the prior art Prolog machine; Figure 3 is a diagram illustrating the general format of a set of clauses having the same clause name at the head part thereof in a Prolog program; Figure 4 is a diagram illustrating a flowchart of a processing in which an atomic formula of a clause in the Prolog is calculated according to the prior art method such as shown in Figure 2; Figure 5 is a diagram illustrating an example of a Prolog program using a function of the present invention; and Figure 6is a system configuration diagram illustrating an embodiment of the present invention.
Description of the preferred embodiments A description will be made of embodiments of the present invention with reference to the accompanying drawings. Figure 1 is a diagram representing a simple example of a Prolog program in which the syntax rules conform to the DEC10 Prolog. In this program, a word "send" is assumed to be a predicate accompanied by a side effect, which is an object to be manipulated according to the present invention. In general, a predicate accompanied by a side effect can be beforehand known because of necessity of storing the relevant state variable in a global memory for a long period of time, for example.
Figure 2 is a schematic diagram illustrating an example of the prior art processing system for processing a Prolog program. An inputloutputter- minal 1 is adapted for an input operation by the operator and for the display of a data outputted from the system and is controlled by an input/output processing unit 2. The program execution is actually effected by a calculation unit 3, which communicates information with a program unit 4 controlling programs written by the user and with a built-in predicate unit 5 controlling programs prepared on the system side.
Figure 3 is a diagram illustrating a general format of a set of clauses each having the same predicate name, p in this example, on the left side of namely, in the head part thereof in a Prolog program.
Figure 4 is a flowchart of a processing in a case in which one element, for example, qkf selected from the list of atomic formulas on the right side of ":-" of each clause shown in Figure 3 is executed by the processing system of Figure 2. The processing portion will be referred to as SG herebelow. The SG has two kinds of inputs, that is, an atomic formula to be subjected to a calculation and information indicating which one of the set of clauses having the same predicate in the head part thereof is the first item to be executed (Figure 3). The latter corresponds to kin Figure 4 and a value changed during a processing is returned fork at the end of processing.
This SG is recursively executed in block 21 of Figure 4.
Referring now to Figure 4, the following describes a processing flow in a case where the program of Figure 1 is executed by use of the execution processing system of Figure 2. Assume here ?-p(b) as an input. The calculation unit 3 then start execution of the SG set to SG (p(b), 0). The first line of Figure 1 is effected with k= 1. First, X=b results, then the first item q(Y) of the right side of the first line is executed, which leads to a resu It of Y=a. Next, the second item r(Y) of the same line is processed to attain a result of Z=a; thereafter, send (a, c) accompanied by a side effect is executed. When an attempt is made to execute S (X, Y), the execution of S(b, a) fails and a backtracking is therefore caused. In block 23, the value of P is decremented by one.The processing to return to step 21 is repeated until the value of t is changed from 3 to 1. When an attempt is made to execute q(Y) again in this state, line 3 of Figure 1 is executed because oft(f)=1,which leads to Y=b. Then, r(Y) is executed again, send (b, c) is effected, and the execution of S(X, Y) is successfully achieved, thereby completing the processing. In this example, there exists a problem such that at the occurrence of the backtracking, the side effect caused by the send (a, c) already executed has not been cancelled.
Figure 5 is a diagram of a program implemented by improving the program of Figure 1 in which built-in predicates, queue and dequeue are incorporated according to the present invention, thereby removing the problem described above; Figure 6 is a configuration diagram illustrating an embodiment of the present invention in which a lazy execution queue 6 is added to the conventional system of Figure 2. The method for utilizing the lazy execution queue 6 will be described herebelow as an additional processing of the processing flow of the prior art technique shown in Figure 4.
(1) Immediately before execution of the block 20, the predicate name of an atomicformula qkf to be next executed is checked to determine whether or not it is queue. If this is the case, the argument is enqueued in the lazy execution queue 6.
(2) Immediately before execution of the block 20, the qkf is checked to determine whether or not it is dequeue. If this is the case (it is dequeue), the atomic formulas enqueued in the lazy execution queue 6 are dequeued and executed in the enqueue sequence.
(3) When a processing of the backtracking is started in block 23, the atomic formula enqueued in the lazy executing queue 6 by the queue subjected to cancellation of the execution is removed.
As a consequence, if the program of Figure 5 is executed in the system configuration of Figure 6, the send (a, c) is not immediately effected at the first execution of r(Y). As an alternative, the send (a, c) is first registered to the lazy execution queue 6 and is removed by the backtracking processing caused due to a failure in a execution of s(X, Y). In the second execution of r(Y), the send (b, c) is enqueued; and when dequeue is executed, the send (b, c) is dequeued from the lazy execution queue 6 and is performed.
The calculation processing method described above can realize the same effect as cancellation to be achieved after an execution of a predicate accompanied by a side effect.
The "queue" and "dequeue" as described above can be effectively used as supervisor macros of the operating system handling such predicates.
According to the present invention, the calculation processing of portions of a program accompanied by a side effect can be delayed by enqueuing the program portions in the lazy execution queue, and hence a cancel processing of cancelling a side effect is not necessitated when a backtracking is executed in a logic programming language machine, which facilitates utilization of the interference facility with backtracking operations characterizing the logic programming language machine; furthermore, unnecessary processing is eliminated, thereby improving the processing efficiency.
In addition, the present invention provides a system which simultaneously solves such two contradictory problems of the side effect and backtracking which are likely to occur in a system implemented by combining the prior art logic programming language with an object-oriented language, which provides a novel computer architecture.

Claims (7)

1. A calculation processing method in a language-oriented machine having a built-in predicate unit and an information processing unit and a lazy execution queue, comprising the steps of: enqueuing a specific atomic formula in the lazy execution queue; dequeuing and executing the enqueued atomic formula from said lazy execution queue; and cancelling the enqueue operation.
2. A calculation processing method according to Claim 1 wherein said specific atomic formula is a predicate accompanied by a side effect which cannot be easily recovered to its original state when backtracing occurs.
3. A calculation processing method according to Claim 2 further comprising a step of delaying execution of the specifi atomic formula to a point of time at which the backtracking may no longer occur.
4. A calculation processing method according to Claim 3 wherein said point of time includes when a given goal is satisfied and when a dequeue command is explicitely designated in a program.
5. A calculation processing system in a language-oriented machine using a logic programming language and an object-oriented language, including an input/output processing unit, a built-in predicate unit for managing or system program, a program unit for managing a user's program, an information processing unit coupled with said units for executing a program, comprising:: lazy execution queue means coupled with said information processing unit for giving a lazy execution to a specified predicate having a side effect which is difficult to restore in its original state when a back-tracking is executed or triggered; enqueue means for determining whether the name of a predicate to be executed is queue and enqueuing its argument atomic formula into said lazy execution queue means when it is queue, prior to execution of said predicate; dequeue means for determining whether the name of said predicate is dequeue and dequeuing and executing the atomic formulas enqueued into said lazy execution queue means when it is dequeue in an enqueued orderpriorto execution of said predicate; and queue cancel means for striking out an atomic formula enqueued in said lazy execution queue means by a queue subjected to cancellation of the execution at the beginning of a backtracking processing.
6. A calculation processing method substantially as hereinbefore described with reference to the accompanying drawings.
7. A calculation processing system constructed and arranged to operate substantially as hereinbefore described with reference to and as illustrated in Figure 6 of the accompanying drawings.
GB08603266A 1985-03-15 1986-02-11 Logic program processing method and system Expired GB2173614B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP60050425A JPS61210432A (en) 1985-03-15 1985-03-15 Calculation processing system

Publications (3)

Publication Number Publication Date
GB8603266D0 GB8603266D0 (en) 1986-03-19
GB2173614A true GB2173614A (en) 1986-10-15
GB2173614B GB2173614B (en) 1988-12-21

Family

ID=12858510

Family Applications (1)

Application Number Title Priority Date Filing Date
GB08603266A Expired GB2173614B (en) 1985-03-15 1986-02-11 Logic program processing method and system

Country Status (3)

Country Link
JP (1) JPS61210432A (en)
FR (1) FR2578990B1 (en)
GB (1) GB2173614B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE3616740A1 (en) * 1986-05-17 1987-11-19 Heidenhain Gmbh Dr Johannes DEVICE FOR OBTAINING WORKPIECE CONTOURS

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0026589A2 (en) * 1979-09-29 1981-04-08 Plessey Overseas Limited Multi-programming data processing system process suspension
EP0168827A2 (en) * 1984-07-17 1986-01-22 Hitachi, Ltd. Data processing method and apparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0097239B1 (en) * 1982-06-21 1989-09-27 International Business Machines Corporation Method and apparatus for restoring data in a computing system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0026589A2 (en) * 1979-09-29 1981-04-08 Plessey Overseas Limited Multi-programming data processing system process suspension
EP0168827A2 (en) * 1984-07-17 1986-01-22 Hitachi, Ltd. Data processing method and apparatus

Also Published As

Publication number Publication date
FR2578990A1 (en) 1986-09-19
JPS61210432A (en) 1986-09-18
GB2173614B (en) 1988-12-21
FR2578990B1 (en) 1991-10-11
GB8603266D0 (en) 1986-03-19

Similar Documents

Publication Publication Date Title
EP0344450A2 (en) Apparatus and method for implementing precise interrupts on pipelined processor with multiple functional units
US7146571B2 (en) System and method for two tier paste buffer and display
US6243786B1 (en) Apparatus and method for generating an interrupt prohibited zone in pipelined data processors
GB2173614A (en) Calculating processing method
JP3035108B2 (en) Parallel processing unit
JPS62262146A (en) Processor
JP2000076095A (en) Device and method for tracing program and storage medium storing program therefor
JPS5831005B2 (en) Electronics
JPS5868162A (en) Retry processing system
JP2642788B2 (en) Execution monitoring point reduction method
JPH04338825A (en) Arithmetic processor
JPS6159538A (en) Queue control system between tasks
KR950005523B1 (en) Step-run processing method of programmable logic controller
JPS60178539A (en) By-pass control system of information processor
JP3039450B2 (en) Stack area switching method and method, and storage medium storing stack area switching program
JPH0744398A (en) Information processor
JPH0477840A (en) Collection system for fault analysis system
JPH0314137A (en) Program executing time calculating system
JPH04291636A (en) Data structure operating system
JPS6126692B2 (en)
JPS6240550A (en) Program debug device
JPH1011320A (en) Rom program monitor device of processor of computer or the like
JPH0619721A (en) Machine language translation optimizing system
JPS59189452A (en) Queue structure for data processor
JPS62159231A (en) Instruction prefetching device

Legal Events

Date Code Title Description
PCNP Patent ceased through non-payment of renewal fee

Effective date: 19990211