Multi Core

Previous topic - Next topic

bigsofty

I like a lot of people, have just gotten a multi core CPU.

It would be nice to have thread support (even just 2) to separate visuals from logic processing in my game, currently the 2nd processor is not being used by GLB.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

Oh dear. Multithreading causes some trouble, because you must interchange variables between the threads, right But you cannot simply make a global variable and access it from both threads, because if both access it at the same time, you're getting an uh-oh effect. Thus, you need thread syncronization objects like mutex or some locks. It would be a lot of overhead.
I'll see if I can implement it, but it's not "Basic" anymore.

bigsofty

I've used mutex, locks before, its not a big deal, to access a variable you just do some handshaking with mutex vars... then again not in Basic... hehe

There must be a simpler way to keep the complexity away from beginners, even at the loss of functionality... any ideas... anyone?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

Sure, you can watch the use of a variable and auto-lock it. But that hits performance dramatically. So it's not an option to me.

bigsofty

Most variables dont need to be locked at all with carefull programming. For instance, 1 thread that controls the background in a scrolling platform game, only needs to read, not write, X & Y coords of the player, it then would go off and draw the background. This leaves the whole of the 1st processor to only control the player. On my low dual core system, thats a giant boost, 100%, of processing power.

I do realise its a pain to program this into the compiler Gernot AND I probably a minority here who needs this feature... so possibly something for the future? ;)
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

Well, you might try INLINE. I aint got time right now, but I might give you some sample.