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

  • SEARCH
  • Home
  • 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 1012505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:57:23+00:00 2026-05-16T09:57:23+00:00

I am trying to learn how async and let! work in F#. All the

  • 0

I am trying to learn how async and let! work in F#.
All the docs i’ve read seem confusing.
What’s the point of running an async block with Async.RunSynchronously? Is this async or sync? Looks like a contradiction.

The documentation says that Async.StartImmediate runs in the current thread. If it runs in the same thread, it doesn’t look very asynchronous to me… Or maybe asyncs are more like coroutines rather than threads. If so, when do they yield back an forth?

Quoting MS docs:

The line of code that uses let! starts the computation, and then the thread is suspended
until the result is available, at which point execution continues.

If the thread waits for the result, why should i use it? Looks like plain old function call.

And what does Async.Parallel do? It receives a sequence of Async<‘T>. Why not a sequence of plain functions to be executed in parallel?

I think i’m missing something very basic here. I guess after i understand that, all the documentation and samples will start making sense.

  • 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. Editorial Team
    Editorial Team
    2026-05-16T09:57:24+00:00Added an answer on May 16, 2026 at 9:57 am

    A few things.

    First, the difference between

    let resp = req.GetResponse()
    

    and

    let! resp = req.AsyncGetReponse()
    

    is that for the probably hundreds of milliseconds (an eternity to the CPU) where the web request is ‘at sea’, the former is using one thread (blocked on I/O), whereas the latter is using zero threads. This is the most common ‘win’ for async: you can write non-blocking I/O that doesn’t waste any threads waiting for hard disks to spin around or network requests to return. (Unlike most other languages, you aren’t forced to do inversion of control and factor things into callbacks.)

    Second, Async.StartImmediate will start an async on the current thread. A typical use is with a GUI, you have some GUI app that wants to e.g. update the UI (e.g. to say “loading…” somewhere), and then do some background work (load something off disk or whatever), and then return to the foreground UI thread to update the UI when completed (“done!”). StartImmediate enables an async to update the UI at the start of the operation and to capture the SynchronizationContext so that at the end of the operation is can return to the GUI to do a final update of the UI.

    Next, Async.RunSynchronously is rarely used (one thesis is that you call it at most once in any app). In the limit, if you wrote your entire program async, then in the “main” method you would call RunSynchronously to run the program and wait for the result (e.g. to print out the result in a console app). This does block a thread, so it is typically only useful at the very ‘top’ of the async portion of your program, on the boundary back with synch stuff. (The more advanced user may prefer StartWithContinuations – RunSynchronously is kinda the “easy hack” to get from async back to sync.)

    Finally, Async.Parallel does fork-join parallelism. You could write a similar function that just takes functions rather than asyncs (like stuff in the TPL), but the typical sweet spot in F# is parallel I/O-bound computations, which are already async objects, so this is the most commonly useful signature. (For CPU-bound parallelism, you could use asyncs, but you could also use TPL just as well.)

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

Sidebar

Related Questions

Trying to learn a bit about PDO and is going through this tutorial .
I'm trying to learn about this feature of javascript I keep seeing in code,
Trying to learn PL/SQL with multimedia data. Can anyone please point out that from
Trying to learn Django, I closed the shell and am getting this problem now
I am trying learn how to work with CEDET. I don't have any project
Trying to learn C. Want to read the first line of a text file,
trying to learn and practice arrays but I have a problem with this small
I'm trying learn Python (3 to be more specific) and I'm getting this error:
Trying to learn pointer math better I wrote this code. The intention was to
Trying to learn pointers better I wrote this code. The intention was to print

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.