🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4220

Re: Process Control in Prolog

#4220
From: Richard O'keefe
Date: Fri, 23 Feb 1990 02:58
33 lines
1808 bytes
In article <378@88opensi.UUCP>, pling@88opensi.UUCP (Paul Ling) writes:
> Question : 
> 	How can I do process control in Prolog?
> For example, I would like to implement the following:
> 	1. Parent process forks a child process
> 	2. Parent process waits for a condition to be set
> 	3. Child finishes and sets the condition
> 	4. Child exits
> 	5. Parent continues.

The sequence of steps described above is no more and no less than
a procedure call.  You only need multiple processes when the parent
must continue while the child is still running.  UNIX programs
typically use "fork" simply to get a new address space; other
operating systems (AEGIS, Multics, B6700/MCP, Lilith) allow a
program to be "called" in the same address space.

Many Prolog systems provide a built in command called system/1,
or something like that, so you could do
	system('prog arg')
	unix(system('prog arg'))
	sh('prog arg')
or something similar.  NU Prolog provides 'fork' and 'wait' as
built in commands; Prologs with a C interface let you add them
easily, and Prologs-with-source like C Prolog and SB Prolog also
let you add them easily.

If you want multi-threading where parent and child processes are
both Prolog, and more than that, share the same address space,
there are some extensions to Prolog around which will let you do
it, but it's not very common (yet).

What are you really trying to accomplish?
Technical Details
Message-ID: <2902@goanna.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!goanna!ok
References: <378@88opensi.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!goanna!ok
From: ok@goanna.oz.au (Richard O'keefe)
Newsgroups: comp.lang.prolog
Subject: Re: Process Control in Prolog
Keywords: process
Message-ID: <2902@goanna.oz.au>
Date: 23 Feb 90 02:58:54 GMT
References: <378@88opensi.UUCP>
Organization: Comp Sci, RMIT, Melbourne, Australia
Lines: 33