I have written a sample code for getting deep into the threading concepts as below.
print("a")
DispatchQueue.global(qos: .default).async {
   print("b")
   DispatchQueue.global(qos: .default).async {
      print("c")
      DispatchQueue.global(qos: .default).async {
        print("d")
        DispatchQueue.global(qos: .default).async {
         print("e")
        }
        print("f")
      }
      print("g")
   }
   print("h")
}
print("i")
OUTPUT
a
i
b
h
c
g
d
f
e
How the output seems like this. What is actually happening inside?
 
     
     
    