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 8274239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:40:35+00:00 2026-06-08T07:40:35+00:00

Both C# and Scala have adopted frameworks for simplifying doing asynchronous/parallel computation, but in

  • 0

Both C# and Scala have adopted frameworks for simplifying doing asynchronous/parallel computation, but in different ways. The latest C# (5.0, still in beta) has decided on an async/await framework (using continuation-passing under the hood, but in an easier-to-use way), while Scala instead uses the concept of “actors”, and has recently taken the actors implementation in Akka and incorporated it into the base library.

Here’s a task to consider: We receive a series of requests to do various operations — e.g. from user input, requests to a server, etc. Some operations are fast, but some take awhile. For the slow ones, we’d like to asynchronously do the operation (in another thread) and process it when the thread is done, while still being free to process new requests.

A simple synchronous loop might be (pseudo-code):

while (1) {
  val request = waitForAnything(user_request, server_request)
  val result = do_request(request)
  if (result needs to be sent back)
    send_back_result(result)
}

In a basic fork/join framework, you might do something like this (pseudo-code):

val threads: Set[Thread]

while (1) {
  val request = waitForAnything(user_request, server_request, termination of thread)
  if (request is thread_terminate) {
    threads.delete(request.terminated_thread)
    val result = request.thread_result
    if (result needs to be sent back)
      send_back_result(result)
  } else if (request is slow) {
    val thread = new Thread(() => do_request(request))
    Threads.add(thread)
    thread.start()
  } else {
    val result = do_request(request)
    if (result needs to be sent back)
      send_back_result(result)
  }
}

How would this look expressed using async/await and using actors, and more generally what are the advantages/disadvantages of these approach?

  • 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-06-08T07:40:39+00:00Added an answer on June 8, 2026 at 7:40 am

    Please consider mine as a partial answer: “old” Scala actors have been replaced by Akka actors , which are much more then a simple async/await library.

    1. Akka actors are “message-handlers” which are organized into a hierarchy which can be running on one or more JVMs and even distributed across a network.
    2. When you realize your asynchronous processing requires actors (read later why this is not forcely necessary), Akka let you and helps you to put in place the best patterns in terms of failure handling, dispatching and routing
    3. Akka comes with different transport layers, and other fancies ready-to-use facilities such as explicit Finite State Machines, Dataflow concurrency and others.
    4. Akka comes with Futures, which are more likely to corresponds to the Async/Await framework in C# 5.0

    You can read more about Akka futures on the Akka website or on this post:

    Parallel file processing in Scala

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

Sidebar

Related Questions

Nullable (C#) has a bit different meaning, but anyway both Option (Scala) and Nullable
I'm relatively new to both scala and jodatime, but have been pretty impressed with
Both are BDD (Behavior Driven Development) capable unit test frameworks for Scala written in
I'm new to both Play! & Scala, but I'm trying to make a service
Both of these frameworks are great, but I've noticed that Knockout likes to point
Both Network.Socket.ByteString and Network.Socket.ByteString.Lazy have a send function. Network.Socket.ByteString has a sendTo function, but
I have been working on a project in scala, but I am getting some
Is it possible to have both java and scala controllers and views in play
For a project I'm using both Scala and Riak (two things I have never
Programming in Lift ( Scala ) is really stressful, both of them have very

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.