BBC BASIC
« Many BBC Basic programs running at the same time »

Welcome Guest. Please Login or Register.
Jan 20th, 2018, 4:21pm


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Many BBC Basic programs running at the same time  (Read 217 times)
michael
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 141
xx Many BBC Basic programs running at the same time
« Thread started on: Aug 10th, 2017, 01:05am »

I had a thought that it may be possible to achieve massive speeds in graphics if say I had many programs using the same graphics.

So here is the theory:
Get other multiple programs on standby mode so they don't interfere with the upcoming graphics screen.

Get the LAST program to set up the graphics full screen and get its own series of actions working on screen.

Once the screen is active, then the other programs could sense a color and when that color appears, they would sync.

Does this sound possible Richard?

The last Graphics screen should override the inactive windows and the graphics should plot. Windows should multitask each program in its own thread.
User IP Logged

I like reinventing the wheel, but for now I will work on tools for D3D
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: Many BBC Basic programs running at the same ti
« Reply #1 on: Aug 10th, 2017, 08:35am »

on Aug 10th, 2017, 01:05am, michael wrote:
I had a thought that it may be possible to achieve massive speeds in graphics if say I had many programs using the same graphics.

Putting graphics to one side, it's certainly true that the way to get the best performance from a modern multi-core or multi-CPU PC is to run multiple threads or processes at the same time, so that you can leverage the parallelism available. I have a BBC BASIC program that makes heavy use of three cores on a fast four-core PC to process high-definition video in real time.

Graphics is something of a special case, however, because of the presence of the GPU. If you have a powerful GPU, of the kind found in 'gaming' PCs, you will probably get better results from offloading as much as possible of the graphics processing onto the GPU, before worrying about spreading it between CPU cores. Of course if you can do both (e.g. the CPU doing calculations and the GPU plotting) you may get the best of both worlds.

Unfortunately, making the most of the GPU when programming in BBC BASIC is not so easy. When you can take advantage of Direct3D (on Windows) or OpenGL (on other platforms) then you should do so, because usually the back-end processing will be done on the GPU in that case. To take control of the GPU at a lower level typically means writing code in High Level Shader Language (HLSL) which gets compiled and loaded into the GPU. You can do that from BASIC (Michael Hutton produced some examples in the old days) but there's a steep learning curve.

But, yes, you can attempt to spread graphics processing between multiple BBC BASIC programs if you can overcome the problems of synchronisation and sharing of the graphics output. For the latter I would recommend creating a shared DIB Section: the CreateDIBSection API has the capability of forcing the DIB to be resident in a file mapping object, which can be shared between multiple processes. You could then divide up the graphics processing between multiple instances of BBC BASIC, all of which are writing to the same DIB Section.

I've never attempted that myself but it sounds like an exciting and challenging thing to try, so I look forward to learning what success you have.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls