Results 1 to 7 of 7

Thread: Does Vb Support Parallel Processing???

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    2

    Question Does Vb Support Parallel Processing???

    WELL, THE TITLE PRETTY MUCH DECLARES MY QUESTION. CAN VB BE USED TO CREATE A PARALLEL PROCESSING ENVIRONMENT ? IF SO, HOW WOULD THIS BE DONE? THANKS.

  2. #2
    Member
    Join Date
    Apr 2002
    Posts
    36
    Hmm I am not sure what parallel processing is, but I am sure it sounds too complicated for VB 1-6, perhaps .NET does

  3. #3
    jim mcnamara
    Guest
    Parallel processing is implemented at the OS level, not normally the application level. VB will run on Mutli-CPU Windows boxes.

  4. #4
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    uk
    Posts
    327
    If you mean multithreading, then no it can't. Native VB is not thread safe, and although it is possible to create multithreaded apps, its stupidly complex, and requires a deep knowledge of COM and API and Win32 concepts...

    However, you can run out-of-process-space ActiveX EXEs. They will run concurrently to whatever else you may be doing.... eg
    Code:
    Dim WithEvents obj As AxExeObj
    
    Private Sub Form_Load()
      Set obj = New AxExeObj
    
      Debug.Print "Before"
      AxeExeObj.LongFunction
      Debug.Print "After"
    End Sub
    
    ' in the active x
    Private Sub LongFunction()
      ' wait for one second
      Sleep 1000
      Debug.Print "Done"
    End Sub
    Here, you would expect the output to be
    Code:
    Before
    Done 
    After
    because VB processes things concurrently. However, the actual output would be
    Code:
    Before
    After
    Done
    because VB won't wait for the function call to return before continuing with execution.

  5. #5
    Lively Member
    Join Date
    Mar 2001
    Location
    Graduate Office (aka "Pit of Despair")
    Posts
    88
    Perhaps I'm misunderstanding, but if your ActiveX component contains a function that is returning a value to VB, musn't it wait before continuing?

    Similar to your example:

    Code:
    if ActiveXFunctionHere Then
       debug.print "True"
    else
       debug.print "False"
    End if
    I would assume VB has no choice but to wait for the function to be evaluated, otherwise code like the above would always be false...

    If so, is there any way to force VB to wait until the function is returned?
    - Kronix


    "I have not failed. I have merely found 10,000 ways that won't work." - Thomas Edison

  6. #6
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253
    I'm sure you will correct me if I'm wrong but . . .

    True Parallel processing means more than one processor. As the 'main' unit of execution in a Win32 environment is a process as long as you can assign a vb executable to run on different processors then you have parallel processing. The real trick is to synchronise between the two - and Win32 provides a rich set of synchronisation objects that are easily used within VB.

    Another problem will be sharing data but a memory mapped file will be sufficient (and is pretty efficient)

  7. #7
    mcsd2002
    Guest
    If so, is there any way to force VB to wait until the function is returned?
    In a situation such as that you would want to implement a CallBack. VB will not "wait" for the function to return but will "listen" for the function in the ActiveX EXE to "callback" with the results of the function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width