Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #50597

Re: POSIX vs Forth cooperative tasker

Newsgroups comp.lang.forth
Date 2016-09-01 03:11 -0700
References <7fddacae-373d-4cd5-a857-f4ae00486388@googlegroups.com> <87y43co557.fsf@jester.gateway.pace.com> <7600a314-a7c5-4424-9e38-19beb024bc17@googlegroups.com> <nq8pm8$ot7$1@cherry.spenarnc.xs4all.nl>
Message-ID <449237e2-e0e7-41c4-b8e1-47ca23c0010d@googlegroups.com> (permalink)
Subject Re: POSIX vs Forth cooperative tasker
From josv@planet.nl

Show all headers | View raw


> That is a lot to take in
The extension was written because Forth was not able to use all
the hardware threads of my PC at that time.

>Objects defined with iTask can be used as soon as ONE definition should be
>executed in a parallel way and the definition uses a do...loop.
>The method Parallel:  divides, distributes and submits for execution the
>specified cfa over a number of jobs.
>A started job can pickup its range for the do...loop part by using the
> method GetRange:.
>It is possible to change the number of simultaneous jobs before they run
>
<SNIP> Elaborate description

By default the object will use all the available hardware threads in one
object. If you do not want that than you can modify the number of hardware
threads used in an object.
With GetRange: you can get an index which can be used to point a location
in an array.

A simple demo using your example:

needs MultiTaskingClass.f \ Of Win32Forth Version: 6.15.04

wTasks myTasks     \ Make the object myTasks.
VARIABLE RESULT    VARIABLE READY   0 RESULT !
: test 1 2 + 10000 MS ;
: jobDemo 0 READY !    test RESULT !    -1 READY ! ;

Start: myTasks \ Initializes the object.

cr .( Starting calculation)

' jobDemo Submit: myTasks
WaitForAll: myTasks

cr .( Calculation finished )
RESULT @ .

\s
Demo's for Parallel: can be found at the end of MultiTaskingClass.f
Jos

On Thursday, September 1, 2016 10:34:32 UTC+2 Albert van der Horst wrote:
> In article <7600a...googlegroups.com>,
>  <jos...net.nl> wrote:
> >On Thursday, September 1, 2016 02:06:13 UTC+2 Paul Rubin wrote:
> >
> >> foxaudiore...com writes:
> >> > I would be interested to see if there is overlap in name choice and
> >> > functionality and if others believe we should get some of this
> >> > "standardized".
> >>=20
> >> I had the impression that lots of people have been interested in
> >> standardizing multi-tasking, but there was not enough agreement between
> >> interested parties to agree on a specification. =20
> >>=20
> >> It would be nice if you could post some documentation of your word set.
> >> I remember being impressed by how simple the eForth multi-tasker is.
> >>=20
> >> I notice your word set doesn't seem to say anything about communication
> >> between tasks, via mailboxes or whatever.
> >
> >Here is help part of the MultiTaskingClass from Win32Forth
> >I hope it is readable since the lines are a bit long:
> >
> >MultiTaskingClass -- For clustered tasks in objects.=20
> >Abstract:=20
> >CPU's with multiple cores can execute a program faster than cpu's with a si=
> >ngle core.=20
> >This is done by breaking up a program in smaller pieces and than execute al=
> >l pieces simultaneously.=20
> >In multiTaskingClass.f this idea is supported as follows:=20
> >Breaking up is possible at the definition level or at the program level by =
> >the 2 classes iTask and wTask.=20
> >Then the pieces are submitted and simultaneously executed in a number of ta=
> >sks.=20
> >Tasks are coverted to jobs and clustered in an object for easy access.=20
> >
> >Objects defined with iTask can be used as soon as ONE definition should be =
> >executed in a parallel way and the definition uses a do...loop.=20
> >The method Parallel:  divides, distributes and submits for execution the sp=
> >ecified cfa over a number of jobs.=20
> >A started job can pickup its range for the do...loop part by using the meth=
> >od GetRange:.=20
> >It is possible to change the number of simultaneous jobs before they run.=
> >=20
> >
> <SNIP> Elaborate description
> 
> >
> >:M Single: ( limit IndexLow cfa -- )=20
> >Executes the definition of the specified cfa in the main thread. The execut=
> >ed definition can get its range by using GetRange:. Made for debugging whil=
> >e running in the MainThread.=20
> 
> That is a lot to take in. What does a simple example look like?
> 
> >
> >\s Jos
> 
> Groetjes Albert
> -- 
> Albert van der Horst, UTRECHT,THE NETHERLANDS
> Economic growth -- being exponential -- ultimately falters.
> albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

POSIX vs Forth cooperative tasker foxaudioresearch@gmail.com - 2016-08-31 07:11 -0700
  Re: POSIX vs Forth cooperative tasker Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-08-31 11:02 -0500
  Re: POSIX vs Forth cooperative tasker albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-08-31 20:40 +0200
    Re: POSIX vs Forth cooperative tasker foxaudioresearch@gmail.com - 2016-08-31 11:54 -0700
  Re: POSIX vs Forth cooperative tasker Gary Bergstrom <forthprgrmr@gmail.com> - 2016-08-31 11:34 -0700
  Re: POSIX vs Forth cooperative tasker Paul Rubin <no.email@nospam.invalid> - 2016-08-31 17:06 -0700
    Re: POSIX vs Forth cooperative tasker josv@planet.nl - 2016-09-01 01:00 -0700
      Re: POSIX vs Forth cooperative tasker albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-09-01 10:42 +0200
        Re: POSIX vs Forth cooperative tasker albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-09-01 11:13 +0200
          Re: POSIX vs Forth cooperative tasker foxaudioresearch@gmail.com - 2016-09-01 09:37 -0700
            Re: POSIX vs Forth cooperative tasker Julian Fondren <julian.fondren@gmail.com> - 2016-09-01 20:44 -0700
              Re: POSIX vs Forth cooperative tasker albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-09-02 11:39 +0200
          Re: POSIX vs Forth cooperative tasker franck.bensusan@gmail.com - 2016-09-01 15:06 -0700
        Re: POSIX vs Forth cooperative tasker josv@planet.nl - 2016-09-01 03:11 -0700
    Re: POSIX vs Forth cooperative tasker foxaudioresearch@gmail.com - 2016-09-01 08:26 -0700

csiph-web