title: Are swift actors concurrent, but not parallel?
body: <p>I'm trying to figure out, what actor brings to use.
  It's not clear for me - are they truly parallel or just concurrent.</p>
  <p>I did little test to check myself:</p>
  <pre><code>actor SomeActor {
      func check() {
          print(&quot;before sleep&quot;)
          sleep(5)
          print(&quot;after sleep&quot;)
      }
  }
  
  let act1 = SomeActor()
  let act2 = SomeActor()
  Task {
      await withTaskGroup(of: Void.self) { group in
          group.addTask {
              await act1.check()
          }
  
          group.addTask {
              await act2.check()
          }
      }
  }
  </code></pre>
  <p>Output is:</p>
  <pre><code>before sleep // Waiting 5 sec
  after sleep
  before sleep // Starting after 5 sec
  after sleep
  </code></pre>
  <p>I block current executor thread so it doesn't yield it.
  But second task doesn't start in parallel.</p>
  <p>So does it mean that each instance of the same actor type share executor instance?</p>
  <p>If so then multiple instance of same actor don't support truly parallelism, but concurrent execution?</p>
  <p>UPD:</p>
  <p>I have a little bit new observations. So example above use inherited isolation when we run group.add(). So it can't pass second actor call immediately.</p>
  <p>My second observation - when we run tasks this way:</p>
  <pre><code>        let act1 = SomeActor()
          let act2 = SomeActor()
          
          Task.detached {
              await act1.check()
          }
          Task { @MainActor in
              await act2.check()
          }
  </code></pre>
  <p>Output is:</p>
  <pre><code>before sleep
  before sleep
  after sleep
  after sleep
  </code></pre>
  <p>So it's truly parallel</p>
  <p>But when I use detached task, output is serial the same:</p>
  <pre><code>        let act1 = SomeActor()
          let act2 = SomeActor()
          
          Task.detach {
              await act1.check()
          }
          Task.detached { @MainActor in
              await act2.check()
          }
  </code></pre>
  <p>Output is:</p>
  <pre><code>before sleep
  after sleep
  before sleep
  after sleep
  </code></pre>