Threading Building Blocks

BlitzMax Forums/BlitzMax Programming/Threading Building Blocks

Kurator(Posted 2008) [#1]
Does anyone of the pro's outside see a chance to port this technically to bmax?

The Lib is LGPL and should work on Win, Linux and Mac OSX.

What I could not see, it if is possible to wrap all this C++ templates around to BMAX.

The libs provides many useful things for creating programs wich can use multicores quite effeciently.

Link: http://threadingbuildingblocks.org/


Gabriel(Posted 2008) [#2]
What's the point? BlitzMax isn't thread safe.


Kurator(Posted 2008) [#3]
The GC is not threadsafe - also big parts of the STL in C++ are not threadsafe.

As far as I unterstand, the library give some essential basics as shared memory, mutexes and a thread scheduler


Gabriel(Posted 2008) [#4]
Ok, but for those of us who know next to nothing about threading, if this were made to work in BlitzMax, what would you be able to do, bearing in mind the aforementioned non-threadsafe areas with BlitzMax?


GaryV(Posted 2008) [#5]
What's the point? BlitzMax isn't thread safe.
If you can't write thread safe code, you shouldn't be using threads.

I am using threads in my BM windows project, and not having any problems.


Kurator(Posted 2008) [#6]
This is from Intel-FAQ:

"Threading Building Blocks includes algorithms, highly concurrent containers, locks and atomic operations, a task scheduler and a scalable memory allocator. These components in TBB can be used individually or all together to ease C++ development for multi-core."

The idea behind ist, not to create threads, but "tasks". The scheduler inside the library manages to distribute it in a very efficient way onto the different cores (including optimisation on cache usage)

The lib has templates for:
parallel_for
parallel_reduce
parallel_scan
parallel_while
pipeline
parallel_sort
task

It also implements:
concurrent_hash_map
concurrent_vector
concurrent_queue

Furhtermore:
Memory Allocator
Task Scheduler


GaryV(Posted 2008) [#7]
robobimbo: What platform are you targeting?


Kurator(Posted 2008) [#8]
Basicly win32 for my personal needs :)


Gabriel(Posted 2008) [#9]
If you can't write thread safe code, you shouldn't be using threads.

I am using threads in my BM windows project, and not having any problems.

Oh right, I just won't worry my pretty little head about it then, eh?


GaryV(Posted 2008) [#10]
Basicly win32 for my personal needs :)
Why are you looking at Intel's solution instead of using the threading built into the Windows API?

Oh right, I just won't worry my pretty little head about it then, eh?
Hey man, I am sorry. I didn't mean to sound mean.


Kurator(Posted 2008) [#11]
Unfortunately the windows API provides none of the higher level constructs such as the hash map.

The intel sollution is also very efficient on amd cpus


GaryV(Posted 2008) [#12]
Gotcha. Was just curious ;c)


Dreamora(Posted 2008) [#13]
Sure Intels solution is efficient. Intel writes one of the most capable highly parallel compilers for cluster computers, ICC actually :)