Multi-threading support in language

Previous topic - Next topic

bigsofty

Some commands for dealing with multi-core platforms would be nice. Basic thread creation/killing/variable locking. It would be nice to spawn off the odd subroutine to a different core. No small task for Gernot though, I understand but no harm is asking. ;)
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

There is an INLINE wrapper for my internal threading functions.
Wait...
oh. I'll attach it.

[attachment deleted by admin]

WPShadow

Hier h?tte ich eine kleine Frage:

Funktioniert hier Variablen - ?bergabe zwischen verschiedenen Threads ?berhaupt, oder werden diese als getrennte Module behandelt?

Normalerweise funktioniert es ja nicht, oder?

Gru?

W.
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

bigsofty

Quote from: Kitty Hello on 2009-Sep-22
There is an INLINE wrapper for my internal threading functions.
Wait...
oh. I'll attach it.

This is really good stuff Gernot, many thanks! :D

@WPShadow... In the way of a polite request, can we keep a thread in the language that it was started in please, otherwise it gets very confusing for the author...  :whistle:
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)

FutureCow

The idea's cool, but I don't have the foggiest how to make use of it in my programs...  =D

WPShadow

ups, really sorry! I'm very confused at the moment...  :'(

The question for me is, if there's a way to give (for example) an integer from a threat to an other?

AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Kitty Hello

Yes, you can access globals from both threads. But you must make sure that noone's writing to a variable when another one reads from it -> crash.
That for you need "Mutex" objects, that can be used as a lock.

WPShadow

AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

bigsofty

Quote from: WPShadow on 2009-Sep-24
ups, really sorry! I'm very confused at the moment...  :'(

No problem Amigo! ;)

Gernot, this is one of these in-lines that is SO powerful, that you have got to wonder why its not part of the command set? It would definitely add to the selling power of GLB if it had the line "GLBasic with full Multi-threading Support!".
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)

Schranz0r

Mutex are multiplatform , right?
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

bigsofty

Quote from: Ocean on 2009-Sep-25

careful here!  Before claiming 'full' multi-threading support you need a runtime library that is fully thread-safe.  GLB's runtime library is not.  

Perfectly true, as GLBasic is a cross compiler and GCC has got quite good thread support already, it may (Or may not! :P) be a reasonable feature to implement?
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)

Schranz0r

You didnt need it for games, i think...  =D
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

metzzo

If you want big landscapes or a MMO game, you need MultiThreading, otherwise the program would have really bad FPS... Or if you want to load the mediafiles in the background.
That's no Bug, that's my project!

http://programming-with-design.at/

bigsofty

#13
Quote from: Schranz0r on 2009-Sep-26
You didnt need it for games, i think...  =D

Your right, you don't "need" it to run your game but wouldn't it be preferable to allow the programmer to have the option to use it?

Especially considering how nearly all modern processors are now multi-core?




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)

MrTAToad

The big problem would be : Is SDL multi-threaded ?