synchronous vs asynchronous

I am a newbie and can anyone explain to me the difference between synchronous vs asynchronous programming

Does .NET framework (VB 2005) is synchronous by default



Answer this question

synchronous vs asynchronous

  • Juliano Horta

    Ken, I am still little confused with foreground and background. Say for e.g. I have two procedures foo1 and foo2 and I do extensive calculationis and looping inside foo1(). VB compiler does not start executing foo2() before foo1() finishes. This is call synchronous please correct me

    Call foo1()

    Call foo2()


  • EdNeo

    asynchronous means the code in the background. You should use this for procedures that take a long time to run so your program does not appear to be locked up.

    Synchronous means the code runs in the foreground.



  • JessicaM

    Actually,

    The topic is really complicated and depends upon the scheduling algorthms of a given operating system which means that the discussion is OS dependent.

    Arbitrarily lets call a thread the "foreground". We can have another thread and we could call that the background.

    If the forground is compute bound meaning that it just calculates. Mutltihreading will not help with the XP scheduler. A compute bound tak has to let go of the processor other threads can get for excution.

    But lets say that your foreground thread does I/O or interacts with the user. The back ground can process while the user thinks.

    So multithreading does not magically produce cpu cycles...

    But it can snatch ones that would have been wasted.



  • highgrade

     

    When We talk about Syncronization it means we are talking about two or more objects Connection when they execute. Where all objects must be Independent ( Classes for example). So they can excute independently.

    We can make some connection between e.g two Independent objects. The reason is  so we can get some results by excution of one Object and then can store/ use them in other.

    This Connection have two kinds : Syncronised and Asyncronized.  If connection is Syncronized ( as most of Applications are of this type) then 1st Object waits for the Other Object to Execute. when That Function of Object is done working it can either return a Value or just inform the Parant that it is done. Now the Parant again can do its further work.

    In the Asyncronized type no Object waits or others. They keep working till either work is finished or User Manually stoped them. Example of this kind is "Worker Threads".



  • mracuraintegra

    That is correct foo2 will not be called until foo1 is done

  • synchronous vs asynchronous