parallel processing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexandre MELARD

    parallel processing

    HI,
    I have a tricky problem about parallel processing using JavaScript.

    a script makes use of classes.
    2 objects A and B are created at intialisation. The two objects make
    use of the same function foo().
    at runtime, the action:
    A.foo();
    B.foo();
    is executed.

    I noticed that in any browser, the result will be that the browser
    executes the function foo() related to A. Then stop and execute the
    function foo() related to B. This leave A unfinished.
    Is there a possiblity to have the function called by A running at the
    same time than B's one? I mean having two instance of the function
    running at once.

    Any help would be greatly apreciated.

    Thank you.

    Alexandre MELARD.
  • Jim Ley

    #2
    Re: parallel processing

    On 6 Jun 2004 05:19:31 -0700, amelard@hotmail .com (Alexandre MELARD)
    wrote:
    [color=blue]
    >I have a tricky problem about parallel processing using JavaScript.[/color]

    I've never seen a JS implementation that isn't single threaded.

    Jim.
    --
    comp.lang.javas cript FAQ - http://jibbering.com/faq/

    Comment

    • Dennis M. Marks

      #3
      Re: parallel processing

      In article <ebce2377.04060 60419.7ccabcad@ posting.google. com>, Alexandre
      MELARD <amelard@hotmai l.com> wrote:
      [color=blue]
      > HI,
      > I have a tricky problem about parallel processing using JavaScript.
      >
      > a script makes use of classes.
      > 2 objects A and B are created at intialisation. The two objects make
      > use of the same function foo().
      > at runtime, the action:
      > A.foo();
      > B.foo();
      > is executed.
      >
      > I noticed that in any browser, the result will be that the browser
      > executes the function foo() related to A. Then stop and execute the
      > function foo() related to B. This leave A unfinished.
      > Is there a possiblity to have the function called by A running at the
      > same time than B's one? I mean having two instance of the function
      > running at once.
      >
      > Any help would be greatly apreciated.
      >
      > Thank you.
      >
      > Alexandre MELARD.[/color]

      Please be clearer as to what you mean by unfinished. There is no
      parallel procesing in javascript. The function will be reused with its
      variables reinitialized.

      --
      Dennis Marks

      Mail to the return email address is bounced.
      Go to web site for active email address.


      -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
      http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
      -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

      Comment

      • Alexandre MELARD

        #4
        Re: parallel processing

        jim@jibbering.c om (Jim Ley) wrote in message news:<40c382b2. 35732260@news.i ndividual.net>. ..[color=blue]
        > On 6 Jun 2004 05:19:31 -0700, amelard@hotmail .com (Alexandre MELARD)
        > wrote:
        >[color=green]
        > >I have a tricky problem about parallel processing using JavaScript.[/color]
        >
        > I've never seen a JS implementation that isn't single threaded.
        >
        > Jim.[/color]

        Ok, I run a script which make sliding panels.
        When onmuseover, a panel start sliding calling a function slide().
        I call the same function for every panels. The problem is that when
        moving a panel, if the user point th emouse over another panel. The
        first one stop and the last panel start moving. Thus leaving the first
        where it was...

        So if it is really multi-threading, why the I cannot run two instance
        of a function at one time?

        Alexandre.

        Comment

        • Andrew Thompson

          #5
          Re: parallel processing

          On 7 Jun 2004 01:40:46 -0700, Alexandre MELARD wrote:[color=blue]
          > jim@jibbering.c om (Jim Ley) wrote in message news:...[color=green]
          >> On 6 Jun 2004 05:19:31 -0700, (Alexandre MELARD) wrote:
          >>[color=darkred]
          >>>I have a tricky problem about parallel processing using JavaScript.[/color]
          >>
          >> I've never seen a JS implementation that isn't single threaded.[/color][/color]
          ....[color=blue]
          > So if it is really multi-threading, why the I cannot run two instance
          > of a function at one time?[/color]

          ...err. Hold up. I think that sentence of Jim's
          had a few too many 'double negatives' to be easy
          to understand. I might rewrite Jim's words as..

          <apologies if wrong>
          "I have *always* seen single thread JS"
          </apologies if wrong>

          --
          Andrew Thompson
          http://www.PhySci.org/ Open-source software suite
          http://www.PhySci.org/codes/ Web & IT Help
          http://www.1point1C.org/ Science & Technology

          Comment

          • bruce

            #6
            Re: parallel processing

            amelard@hotmail .com (Alexandre MELARD) wrote in message news:<ebce2377. 0406060419.7cca bcad@posting.go ogle.com>...[color=blue]
            > HI,
            > I have a tricky problem about parallel processing using JavaScript.
            >
            > a script makes use of classes.
            > 2 objects A and B are created at intialisation. The two objects make
            > use of the same function foo().
            > at runtime, the action:
            > A.foo();
            > B.foo();
            > is executed.
            >
            > I noticed that in any browser, the result will be that the browser
            > executes the function foo() related to A. Then stop and execute the
            > function foo() related to B. This leave A unfinished.
            > Is there a possiblity to have the function called by A running at the
            > same time than B's one? I mean having two instance of the function
            > running at once.
            >
            > Any help would be greatly apreciated.
            >
            > Thank you.
            >
            > Alexandre MELARD.[/color]


            I guess that the judicial use of setInterval() method can make the
            script appear to be multi-threaded. I've used this to create a clock
            in one frame, while there is extended processing in another frame
            going on. This way the user at least sees that his machine is not
            frozen

            Comment

            • Kien

              #7
              Re: parallel processing

              Hi,
              There is only ONE double negative in Jim's post.
              And Jim's makes more sense than Andrew's useless answer.

              Hi Alex,
              You cannot make the same function run two things separately.



              I suggest that you make allowance for the user to do whatever he
              chooses.
              So as he touches the second panel, put the first panel into it's final
              position before moving the second panel.



              HTH
              Kien




              Andrew Thompson <SeeMySites@www .invalid> wrote in message
              news:<va92y96rb zq0.1iti1iwfh82 lx$.dlg@40tude. net>...[color=blue]
              > On 7 Jun 2004 01:40:46 -0700, Alexandre MELARD wrote:[color=green]
              > > jim@jibbering.c om (Jim Ley) wrote in message news:...[/color][/color]
              [color=blue][color=green][color=darkred]
              > >> On 6 Jun 2004 05:19:31 -0700, (Alexandre MELARD) wrote:
              > >>
              > >>>I have a tricky problem about parallel processing using JavaScript.
              > >>
              > >> I've never seen a JS implementation that isn't single threaded.[/color][/color]
              > ...[color=green]
              > > So if it is really multi-threading, why the I cannot run two instance
              > > of a function at one time?[/color]
              >
              > ..err. Hold up. I think that sentence of Jim's
              > had a few too many 'double negatives' to be easy
              > to understand. I might rewrite Jim's words as..
              >
              > <apologies if wrong>
              > "I have *always* seen single thread JS"
              > </apologies if wrong>[/color]

              Comment

              Working...