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


Groups > comp.lang.forth > #12697 > unrolled thread

MultiTaskingClass.f released

Started byJos Ven <josvengo@gmail.com>
First post2012-06-04 05:12 -0700
Last post2012-06-05 12:31 -0700
Articles 3 — 2 participants

Back to article view | Back to comp.lang.forth


Contents

  MultiTaskingClass.f released Jos Ven <josvengo@gmail.com> - 2012-06-04 05:12 -0700
    Re: MultiTaskingClass.f released Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-05 16:45 +0000
      Re: MultiTaskingClass.f released Jos Ven <josvengo@gmail.com> - 2012-06-05 12:31 -0700

#12697 — MultiTaskingClass.f released

FromJos Ven <josvengo@gmail.com>
Date2012-06-04 05:12 -0700
SubjectMultiTaskingClass.f released
Message-ID<507a107f-9c6a-4c7a-9f01-c8b111e9bab5@d17g2000vbv.googlegroups.com>
I just released MultiTaskingClass.f
This is an update of the previous MultiTask.f

Changes in the MultiTaskingClass.f:
- Moved the task-block out of the dictionary for the taskobjects
- Added cells+@ cells+! #ActiveTasks: task>cfa task>&StkParams
  and the waitobject wTask including a demo for wTask.
- Removed the tasks in a chain.
  The object wTask does this better and easier.
- ExitTask is now handled by the objects.
  Remove ExitTask from your code when it is still there.
- Now maximal 8 parameters can be passed to a task without much
overhead.
All in all it means that many definitions are now able to run
in a submitted task without having to change the submitted definition.

Background information for MultiTaskingClass.f:

CPU's with multiple cores can execute a program faster than cpu's with
a single core.  This is done by breaking up a program in smaller
pieces
and than execute all pieces simultaneously.

In multiTaskingClass.f this idea is supported as follows:
Breaking up is possible at the definition level or at the program
level by
the 2 classes iTask and wTask.
Then the pieces are submitted and simultaneously executed in a number
of tasks. The Tasks are clustered in an object for easy access.

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 tasks.
Parallel: takes in account the number of hardware threads, so all
these
threads wil be used during execution.

A started task can pickup its range for the do...loop part by using
the
method GetTaskRange: The initialization of the objects defined with
iTask is automatic.
It is possible to change the number of simultaneous tasks before they
run.

Objects defined with wTask can be used to execute concurrently one or
more
different definitions.
These objects must be initialized with the method Start:
The method Start: takes the number of simultaneous tasks as a
parameter.
It does not start any task.
Use the method SubmitTask: for starting a definition as a task.
When a new task is submitted and the maximum number of simultaneous
tasks
is reached the following will happen:
1) The system will wait till one or more tasks are complete.
2) Then it will submit the task.

At this moment the system is limited to 63 simultaneous tasks for each
taskobject
that is defined with wTask or iTask.

Tasks of both classes will get their parameters at the start on the
stack as soon as
the method To&Task: is used just before the task is submitted.
MultiTaskingClass.f uses preemptive multitasking system of windows.
No need to use pause.

MultiTaskingClass.f can be downloaded at http://home.planet.nl/~josv


I hope you like this new extension for Win32Forth.
Jos

[toc] | [next] | [standalone]


#12716

FromAlbert van der Horst <albert@spenarnc.xs4all.nl>
Date2012-06-05 16:45 +0000
Message-ID<m55l86.9sp@spenarnc.xs4all.nl>
In reply to#12697
In article <507a107f-9c6a-4c7a-9f01-c8b111e9bab5@d17g2000vbv.googlegroups.com>,
Jos Ven  <josvengo@gmail.com> wrote:
>I just released MultiTaskingClass.f
>This is an update of the previous MultiTask.f
>
<SNIP>
>
>Background information for MultiTaskingClass.f:
>
>CPU's with multiple cores can execute a program faster than cpu's with
>a single core.  This is done by breaking up a program in smaller
>pieces
>and than execute all pieces simultaneously.
>
>In multiTaskingClass.f this idea is supported as follows:
<SNIP>

>
>
>I hope you like this new extension for Win32Forth.

I'm impressed, but I'm not in a position to experiment with multi-core
cpu's on windows.

If I understand correctly any Forth word may be executed, as long as it
has 8 stack items or less as input.
I would be interested to have an example of sorting a 2 Gbyte array
of cells, where the partitioning is split over as much tasks as there
are processors. Especially the timing results.

Something along the line of
: (QSORT)
  partition
  #idle-proc 0 > IF ['] (QSORT) separate-task ELSE RECURSE THEN
  #idle-proc 0 > IF ['] (QSORT) separate-task ELSE RECURSE THEN
;


Further, I presume there is some .dll involved in Windows.
What is it called? From what version of Windows on is it present?

(I had this parpi programming running as hundreds of parallel processes
under Linux 64 bits, but it was not fully under control.
Unlike qsort it has not the option of not using separate processes.)

>Jos


--
-- 
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

[toc] | [prev] | [next] | [standalone]


#12722

FromJos Ven <josvengo@gmail.com>
Date2012-06-05 12:31 -0700
Message-ID<505861d8-1c63-46a9-bdc0-947d3158ed72@m3g2000vbl.googlegroups.com>
In reply to#12716
Hi Albert,

Thank you for you comment.

> If I understand correctly ANY Forth word may be executed, as long as it
> has 8 stack items or less as input.

A small correction. The exact statement is:
All in all it means that MANY definitions are now able to run
in a submitted task without having to change the submitted definition.

Also note that the maximum of 8 can be changed.
I defined it as default since it was not likely to me that you need
more parameters on the stack.

> I would be interested to have an example of sorting a 2 Gbyte array
> of cells, where the partitioning is split over as much tasks as there
> are processors.

Could be done but it takes quite some time to develop such an example.

> Further, I presume there is some .dll involved in Windows.
> What is it called? From what version of Windows on is it present?

It is quite basic.
All the used functions od Windows were already available in Windows
95.
As soon as I looked to my multicore Pentium I realized that
in most cases only about 12,5% was used of its capacity while I was
waiting.

So I decided to change that and let that monster run for me.

Jos
On 5 jun, 18:45, Albert van der Horst <alb...@spenarnc.xs4all.nl>
wrote:
> In article <507a107f-9c6a-4c7a-9f01-c8b111e9b...@d17g2000vbv.googlegroups.com>,
> Jos Ven  <josve...@gmail.com> wrote:>I just released MultiTaskingClass.f
> >This is an update of the previous MultiTask.f
>
> <SNIP>
>
> >Background information for MultiTaskingClass.f:
>
> >CPU's with multiple cores can execute a program faster than cpu's with
> >a single core.  This is done by breaking up a program in smaller
> >pieces
> >and than execute all pieces simultaneously.
>
> >In multiTaskingClass.f this idea is supported as follows:
>
> <SNIP>
>
>
>
> >I hope you like this new extension for Win32Forth.
>
> I'm impressed, but I'm not in a position to experiment with multi-core
> cpu's on windows.
>
> If I understand correctly any Forth word may be executed, as long as it
> has 8 stack items or less as input.
> I would be interested to have an example of sorting a 2 Gbyte array
> of cells, where the partitioning is split over as much tasks as there
> are processors. Especially the timing results.
>
> Something along the line of
> : (QSORT)
>   partition
>   #idle-proc 0 > IF ['] (QSORT) separate-task ELSE RECURSE THEN
>   #idle-proc 0 > IF ['] (QSORT) separate-task ELSE RECURSE THEN
> ;
>
> Further, I presume there is some .dll involved in Windows.
> What is it called? From what version of Windows on is it present?
>
> (I had this parpi programming running as hundreds of parallel processes
> under Linux 64 bits, but it was not fully under control.
> Unlike qsort it has not the option of not using separate processes.)
>
> >Jos
>
> --
> --
> Albert van der Horst, UTRECHT,THE NETHERLANDS
> Economic growth -- being exponential -- ultimately falters.
> albert@spe&ar&c.xs4all.nl &=nhttp://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web