title: How scala Future allow asynchronous execution?
body: <p>I am new to parallel execution and scala. 
  I have a few questions around using the Future in scala.</p>
  
  <p>I believe that the Future allows the asynchronous parallel execution. So up to my understanding in the following code the <code>donutStock</code> method will run on a separate thread. Official document also says that it does not block the main thread. So If the main thread is not blocked then the new child thread and the main thread should be executed in parallel.</p>
  
  <p>So in the following example, I expect that as soon as the donutStock method is called the control on the main thread should go forward and then the main thread should call the second donutStock method on another thread. </p>
  
  <p>However, I noticed that the second method is called only after the completion of the first call. Is my understanding of the non-blocking or asynchronous is correct? And if I wanted to execute both method call is parallel then what is the correct way to do that.</p>
  
  <p>I read that we should do the async operation in the server main thread. What is the advantage of async operation in such cases </p>
  
  <pre><code>import scala.concurrent.Future
  import scala.concurrent.ExecutionContext.Implicits.global
  import scala.util.{Failure, Success}
  
  def donutStock(donut: String): Future[Int] =  Future {
    (1 until 100).foreach { value ⇒
      println(s"checking donut stock $donut")
    }
    10
  }
  
  donutStock("My Donut").onComplete{
    case Success(value) ⇒ println("Call 1 Completed")
    case Failure(exception) ⇒ println("Call 1 Failed")
  }
  
  donutStock("Your Donut").onComplete{
    case Success(value) ⇒ println("Call 2 Completed")
    case Failure(exception) ⇒ println("Call 2 Failed")
  }
  
  </code></pre>