You are not logged in.

#1 2004-11-23 12:59:10

onami
Member
From: Romania
Registered: 2004-05-05
Posts: 197

Multithread

Does anyone know where I can find a good multuthread tutorial ?
Pleassssssssseeeeeeeeeee!!!!!!!!!!


Forever newbie !!!

Offline

#2 2004-11-23 13:24:08

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,366
Website

Re: Multithread


The impossible missions are the only ones which succeed.

Offline

#3 2004-11-23 13:24:53

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,366
Website

Re: Multithread


The impossible missions are the only ones which succeed.

Offline

#4 2004-11-23 13:25:32

onami
Member
From: Romania
Registered: 2004-05-05
Posts: 197

Re: Multithread

Dp is always helping around !!!!
Thank you !!!!


Forever newbie !!!

Offline

#5 2004-11-23 14:12:46

djhizz
Member
From: Bucharest (Romania)
Registered: 2004-10-26
Posts: 68
Website

Re: Multithread

wazaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


My mama said once: ...........***K OFF!!!!   She was right!
<a href="http://www.nobelcom.com">phone cards</a>

Offline

#6 2004-11-23 15:16:05

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Multithread

if you're serious about this, you'll probably want to look into locking data structures and thread syncronization - with threaded programs, you tend to run into data hazards alot (more than one thread attempting to use a shared resource at the same time):

assume a shared variable: int a = 0
thread 1:
   a = 5;
   a += 2;
thread 2:
   a++;

execution can happen as follows:
thread 1: a = 5;
thread 2: a++;
thread 1: a += 2;

both threads now have unexpected results....

Offline

#7 2004-11-23 17:32:07

onami
Member
From: Romania
Registered: 2004-05-05
Posts: 197

Re: Multithread

Thank you everyone, I'm very serious about this!!!


Forever newbie !!!

Offline

#8 2004-11-23 18:13:31

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Multithread

Many people will tell you the faults of Java, but I don't think even Phrakture can fault its multithreading design. If you have a choice of languages for your project, that will save you a lot of headache.

Dusty

Offline

#9 2004-11-23 18:35:09

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Multithread

Dusty wrote:

Many people will tell you the faults of Java, but I don't think even Phrakture can fault its multithreading design. If you have a choice of languages for your project, that will save you a lot of headache.

Dusty

hey, yeah yeah I'll agree the threading design is done very well... it was also the first language I saw to have a simple statement for preventing data hazards.... what was it lock(...) or sync(...) or something like that.

Offline

#10 2004-11-23 18:35:19

onami
Member
From: Romania
Registered: 2004-05-05
Posts: 197

Re: Multithread

I have to learn this with c++


Forever newbie !!!

Offline

#11 2004-11-24 00:59:53

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,615
Website

Re: Multithread

phrakture wrote:

hey, yeah yeah I'll agree the threading design is done very well... it was also the first language I saw to have a simple statement for preventing data hazards.... what was it lock(...) or sync(...) or something like that.

snychronize I believe..


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#12 2004-11-24 13:38:53

onami
Member
From: Romania
Registered: 2004-05-05
Posts: 197

Re: Multithread

can anybody give me a hint on these mutex characters ???
Please  sad  :cry:


Forever newbie !!!

Offline

#13 2004-11-24 14:43:53

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,366
Website

Re: Multithread

onami wrote:

can anybody give me a hint on these mutex characters ???
Please  sad  :cry:

http://en.wikipedia.org/wiki/Mutex

... and if you changed your mind and want a tutorial for java threads, here the one that suited me best for me to learn it some time ago:

http://www.wilsonmar.com/1threads.htm


The impossible missions are the only ones which succeed.

Offline

#14 2004-11-24 14:46:32

onami
Member
From: Romania
Registered: 2004-05-05
Posts: 197

Re: Multithread

I need it at work this way!!!
roll
thank you


Forever newbie !!!

Offline

#15 2004-11-25 22:13:42

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: Multithread

Dusty wrote:

Many people will tell you the faults of Java, but I don't think even Phrakture can fault its multithreading design. If you have a choice of languages for your project, that will save you a lot of headache.

Dusty

You mean apart from the fact that they implement synchronize differently in different JVM architectures? tongue


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#16 2004-11-25 23:28:10

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Multithread

Xentac wrote:

You mean apart from the fact that they implement synchronize differently in different JVM architectures? tongue

but is that the fault of Java, the language? I would say its the fault of Java, the virtual machine (more specifically its designers).

Dusty

Offline

#17 2004-11-30 16:06:30

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Multithread

onami wrote:

can anybody give me a hint on these mutex characters ???
Please  sad  :cry:

Mutex is short for mutual exclusion - that doesn't do much for non native english speakers, so I'll define further.  It is a way to take a group of things (mutual) and leave a portion out (exclude).  Basically, a mutex allows you to have a group of threads changing a shared data store (variable, object, memory loc, whatever) at the same time safely.
Before you write to a shared data store, a mutex lock is requested.  If it is already locked, the requesting thread waits until it is free.  When the thread is able to lock the mutex, it writes to the data store and unlocks the mutex.

for example:

thread a:
lock(mutex);
variable = 5;
unlock(mutex);

thread b:
lock(mutex);
variable += 2;
unlock(mutex);

this way only one change to variable a can be made at a time, thanks to the mutex.  Most common mutex usage is like above... lock-write-unlock.  You want the mutex to be locked for the shortest time possible, to make performance better.

If you're doing this in C/C++ take a look at pthreads... posix threads.

Offline

Board footer

Powered by FluxBB