Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 157285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:28:37+00:00 2026-05-11T10:28:37+00:00

Does asynchronous call always create a new thread? Example: If JavaScript is single threaded

  • 0

Does asynchronous call always create a new thread?

Example:

If JavaScript is single threaded then how can it do an async postback? Is it actually blocking until it gets a callback? If so, is this really an async call?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:28:38+00:00Added an answer on May 11, 2026 at 10:28 am

    This is an interesting question.

    Asynchronous programming is a paradigm of programming that is principally single threaded, i.e. ‘following one thread of continuous execution’.

    You refer to javascript, so lets discuss that language, in the environment of a web browser. A web browser runs a single thread of javascript execution in each window, it handles events (such as onclick=’someFunction()’) and network connections (such as xmlhttprequest calls).

    <script> function performRequest() {   xmlhttp.open('GET', 'someurl', true);   xmlhttp.onreadystatechange = function() {     if (xmlhttp.readyState == 4) {       alert(xmlhttp.responseText);     }   }   xmlhttp.send(sometext); } </script> <span onclick='performRequest()'>perform request</span> 

    (This is a nonworking example, for demonstration of concepts only).

    In order to do everything in an asynchronous manner, the controlling thread has what is known as a ‘main loop’. A main loop looks kind of like this:

    while (true) {     event = nextEvent(all_event_sources);     handler = findEventHandler(event);     handler(event); } 

    It is important to note that this is not a ‘busy loop’. This is kind of like a sleeping thread, waiting for activity to occur. Activity could be input from the user (Mouse Movement, a Button Click, Typing), or it could be network activity (The response from the server).

    So in the example above,

    1. When the user clicks on the span, a ButtonClicked event would be generated, findEventHandler() would find the onclick event on the span tag, and then that handler would be called with the event.
    2. When the xmlhttp request is created, it is added to the all_event_sources list of event sources.
    3. After the performRequest() function returns, the mainloop is waiting at the nextEvent() step waiting for a response. At this point there is nothing ‘blocking’ further events from being handled.
    4. The data comes back from the remote server, nextEvent() returns the network event, the event handler is found to be the onreadystatechange() method, that method is called, and an alert() dialog fires up.

    It is worth noting that alert() is a blocking dialog. While that dialog is up, no further events can be processed. It’s an eccentricity of the javascript model of web pages that we have a readily available method that will block further execution within the context of that page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 85k
  • Answers 85k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Looks like a UNION could help, e.g. (depending how your… May 11, 2026 at 5:08 pm
  • Editorial Team
    Editorial Team added an answer If the images are going to be shown on your… May 11, 2026 at 5:08 pm
  • Editorial Team
    Editorial Team added an answer A syscall is used specifically to run an operating in… May 11, 2026 at 5:08 pm

Related Questions

Does an asynchronous call always create a new thread? What is the difference between
I have a web page with DIV s with a mouseover handler that is
I have a control application - using asp.net webservices. I have a timer which
Let's say I have a class that implements the IDisposable interface. Something like this:

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.