Multi processing

This is a discussion on Multi processing within the Pascal forums in Programming Languages category; Hallo alemaal, Just a question out of curiousity: is it possible to create program under TP that can make use of more then one CPU? -- ___ / __|__ / / |_/ Groetjes, Ruud \ \__|_\ \___| URL: Ruud.C64.org...

Go Back   Application Development Forum > Programming Languages > Pascal

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 03-11-2008, 07:11 AM
Ruud.Baltissen@apg.nl
Guest
 
Default Multi processing

Hallo alemaal,


Just a question out of curiousity: is it possible to create program
under TP that can make use of more then one CPU?

--
___
/ __|__
/ / |_/ Groetjes, Ruud
\ \__|_\
\___| URL: Ruud.C64.org

Reply With Quote
  #2  
Old 03-11-2008, 07:50 AM
Marco van de Voort
Guest
 
Default Re: Multi processing

On 2008-03-11, Ruud.Baltissen@apg.nl <Ruud.Baltissen@apg.nl> wrote:
> Just a question out of curiousity: is it possible to create program
> under TP that can make use of more then one CPU?


The long answer

Anything is possible under TP. TP just creates a stream of assembler
instructions to execute, and if you labour hard enough you can accomplish a
lot. But since both TP and Dos hardly can do anything that modern systems
can, you will have to fill all the blanks yourself.

Of course that means you will have to write a SMP safe threadlibrary with a
SMP scheduler, and adapt the RTL to use that. That's where the problem lies.
Dos provides nothing. So effectively it would be like creating your own
realtime OS system with a minimal dos emulation to run your TP programs.

The short answer:

See if you can find thread support in an existing system that can run dos
binaries (e.g. Windows and Desqview X). Then you might be able to use that
scheduler

The ultra short answer:

start two dos binaries under Windows. Find some way to connect them together
via IPC or sockets.

Reply With Quote
  #3  
Old 03-14-2008, 07:42 AM
Ruud.Baltissen@apg.nl
Guest
 
Default Re: Multi processing

Hallo Marco,


> start two dos binaries under Windows. Find some way to connect
> them together via IPC or sockets.


Thank you for answering. If I understand things correctly, you are
telling that I have two write two programs and then to find a way to
connect them in some way. So I can forget about writing only _one_ PAS-
file that tells _two_ CPU's what to do.


--
___
/ __|__
/ / |_/ Groetjes, Ruud
\ \__|_\
\___| URL: Ruud.C64.org






Reply With Quote
  #4  
Old 03-14-2008, 08:34 AM
Marco van de Voort
Guest
 
Default Re: Multi processing

On 2008-03-14, Ruud.Baltissen@apg.nl <Ruud.Baltissen@apg.nl> wrote:
>
>> start two dos binaries under Windows. Find some way to connect
>> them together via IPC or sockets.

>
> Thank you for answering. If I understand things correctly, you are
> telling that I have two write two programs and then to find a way to
> connect them in some way. So I can forget about writing only _one_ PAS-
> file that tells _two_ CPU's what to do.


Yes, that there is nothing that can schedule the relevant threads. In theory
one could try to hack a complete OS in your dos binary (threading support,
scheduler support etc), but that is not writing an application, that is
implementing a complete OS in your app, with the usual problems.

If you really must have that, there are four options, in decreasing order of
use/work ratio.
- choose a compiler and OS from this millenium.
- If you have BP7, try to redress your program as a "windows 3.x" program
using BPW, and see if that can somehow access threads. If so, you have a
small chance they are mapped to different CPUs.
- Ask on a FreeDOS list how to use multiple cores in 16-bits binaries.
- Implement a complete SMP threading library + scheudler in your binary.
Reply With Quote
  #5  
Old 03-14-2008, 03:52 PM
Dr J R Stockton
Guest
 
Default Re: Multi processing

In comp.lang.pascal.borland message <586f1157-6b6d-4395-9785-b7ce0be07ba
4@u10g2000prn.googlegroups.com>, Fri, 14 Mar 2008 04:42:08,
Ruud.Baltissen@apg.nl posted:
>
>
>> start two dos binaries under Windows. Find some way to connect
>> them together via IPC or sockets.

>
>Thank you for answering. If I understand things correctly, you are
>telling that I have two write two programs and then to find a way to
>connect them in some way. So I can forget about writing only _one_ PAS-
>file that tells _two_ CPU's what to do.



By using compile time conditionals, one can generate as many entirely
different EXEs from a single PAS as one wishes, until one hits a size
constraint.

In your case, with one PAS and two EXEs, you can keep one copy of common
code. Of course, you could use units, but that would be multiple PAS
files.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.merlyn.demon.co.uk/clpb-faq.txt> RAH Prins : c.l.p.b mFAQ;
<URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:00 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.