Page 2 of 2

Posted: Mon Jun 02, 2003 8:51 pm
by dmoc
tinman, I agree. It's one of those areas that gets confused due to informal/ ill-defined definitions, eg, performance, in terms of throughput, is perfectly acceptable to the one client getting serviced by a non-threaded server.

PS: @tinman - I ain't preaching doc :wink: You must have had the pleasure of working on some pretty impressive parallel hardware no?

Posted: Mon Jun 02, 2003 8:59 pm
by tinman
dmoc wrote:PS: @tinman - I ain't preaching doc :wink: You must have had the pleasure of working on some pretty impressive parallel hardware no?
Sadly, no :)

Posted: Mon Jun 02, 2003 10:25 pm
by dmoc
That is sad, given the topic. PS: I particularly like the "Fear Kevin" link but can't decide whether you are fan or foe. Related: have you read Steve Grand's book "Creation: life and how to make it"?

Posted: Mon Jun 02, 2003 10:48 pm
by aszid
hmmm... well, i still intend to make something to get threads to share variables in some shape or fashion... but i've been really swamped at work lately, so i haven't gotten a chance to work on it at all...

i thought i'd pop in and leave a message, so people don't peg me as un-reliable

*sigh* being a sys-admin can be demanding at times... and VERY BORING at other times... too bad this week isn't a boring one...

Posted: Mon Jun 02, 2003 10:52 pm
by aszid
hmm... i thought of another question that i "think" i know the answer to... but i'm not sure... can reading a variable (string or otherwise) from 2 threads at the same time cause problems, or is it only writing to the variable?

Posted: Tue Jun 03, 2003 12:10 am
by tinman
dmoc wrote:That is sad, given the topic. PS: I particularly like the "Fear Kevin" link but can't decide whether you are fan or foe. Related: have you read Steve Grand's book "Creation: life and how to make it"?
No, I haven't read it (don't have as much time to expand myself as I would like), but I did get quite interested in his work on Creatures. Pretty clever stuff in there.

As for Kevin, I'm just jealous 8)

Posted: Tue Jun 03, 2003 12:14 am
by tinman
aszid wrote:hmm... i thought of another question that i "think" i know the answer to... but i'm not sure... can reading a variable (string or otherwise) from 2 threads at the same time cause problems, or is it only writing to the variable?
Reading variables should be safe, but be careful with strings because it is the string buffer which is not thread safe, not just the string itself.

The library I started has enough in it for you to be able to safely share resources between threads. And there are a couple of examples in the archive.

Posted: Tue Jul 22, 2003 8:20 pm
by aszid
wow, time flies when you forget about the examples you were intending to make....

anyhow, i would like some input from people concerning this snippet, it works fine on my work computer, and the threads share the string equally, but i want to have a few more people, with different OS's and configurations to test it out and see if anything weird happens....

Code: Select all

Global a,b,c,text$

Procedure testme(string$)
  Repeat
    Repeat
      If a = 0
        a = 1
        Repeat
          Delay(1)
        Until b = 1
        text$+"bleh "
        c = 1
      EndIf
    Until c = 1
    a = 0
    b = 0
    c = 0
    Delay(1)
  Until Len(text$) > 500
EndProcedure


CreateThread(@testme(),"bleh")
Repeat
  If a = 1 And c = 0
    b = 1
    Delay(1)
  ElseIf a = 0 And c = 0
    text$ + "blah "
    Delay(1)
  EndIf
Until Len(text$) > 500

Debug text$
please let me know if this crashes your computer, or if you get anything but the desired result (the desired result is: "blah bleh blah bleh.....")

thanks in advance

Posted: Wed Jul 23, 2003 7:19 pm
by aszid
umm... anyone?? it wont like... break your computer or anything... worst case it'll just crash the program.... maybe windows.... (but i doubt it)

*sigh*

Posted: Thu Jul 24, 2003 12:44 am
by ebs
It works fine on my machine - Win XP (Home), 512MB RAM.

Eric

Posted: Thu Jul 24, 2003 1:16 am
by Karbon
Worked great here..

XP Pro + every patch known to man. P4 2.8GHz, 1 gig of RAM.

After I put this 98 box back together I'll test it on that too.

Posted: Fri Jul 25, 2003 5:51 am
by HarryO
aszid,

I tried it and I only get one string with "blah blah blah" and so on.

Was that the results I was suppose to get?

HarryO

Posted: Fri Jul 25, 2003 6:50 am
by aszid
well, the desired result was "blah bleh blah bleh" but way longer, the key thing i wanted to make sure of is that each thread got access equally to the variables, one thread adds a "blah" the other adds a "bleh"

so if you just got blah's then that means it didn't work right on your comp...

what os are you running?

thanks for testin it out everyone

Posted: Fri Jul 25, 2003 7:01 am
by HarryO
aszid,

I have a win98 se w/256mb mem.

I did get a very long string, but it only had 'blah' repeated in it.

HarryO