ID:275025
 
I'm part of a competitition team that will soon be entering in a QBASIC competition, and I'm having trouble figuring out how to multithread - or simulate multithreading - in my programs. Can anyone with more BASIC experience give me a push in the right direction, possibly followed by an example? Thanks!

-LoW
Geez dude. QBASIC doesn't support multithreading....and I don't think you are going to be able to simulate it either.

C/C++ uses the fork() statement which creates a seperate process with its own copy of data.

Java uses Threads which (from what we learned in our Opertating Systems class) run under the same process and share the same data. Java's virtual machine has its own job scheduler that tells each thread when they are allowed to run.

If you do get something done, I bet its going to involve some assembly code.
In response to CableMonkey
We did work something out eventually - a crude simulation that was close enough to the real thing that the judges took it, every time. Thanks!
In response to Lord of Water
Impressive...to say the least.
In response to CableMonkey
i'd love to see the source to that - multithreading *in* qbasic should be near to impossible because of the way the language works - at least no without a bit of external help.

i have seen links to a multithreaded qbasic Gui interface - but not of m-t running programs *in* qbasic.
In response to digitalmouse
We didn't ACTUALLY multithread the program in a literal sense -- we just simulated it by performing actions according to a strict timer-based system, allowing us to force procedures to run side-by-side. There was some extenal help, but the details of that are beyond my comprehension of QBASIC. It's a dumb language any way and soon we'll never be using it again, so I'm not too eager to find out just what it all means... we got the job done, as a team.

-Lord of Water