Varga Zolt
1 min readJun 17, 2022

--

Hi Vyankatesh,

i will try to simplify it (*so this is not 100% right in every case considering the technology that now you have 8 core cpu with 16 threads...).

1.) Image you have 8 core CPU, this mean you have 8 threads*.

Look in article the image "Example of SerialQueue" and you can see on right side 8 Thread in xcode. Every thread can have one or more task, in the queue. If you add ID then you can monitor that also when is finished that particular task.

2.) main.sync will stop/block the calling queue till the task is finished and just then proceed (Look into the DeadLock problem)

main.async will not block the queue(the code will run to the next line :) ), it will proceed and at some point it will be finished.

I recomend to play a bit with it. It is easier to connect the dots when you play with it. :)

Hope this helps at least a bit. :)

--

--

Varga Zolt
Varga Zolt

Written by Varga Zolt

 Mobile Tech Lead📱 🧑‍💻 Writing about new Technologies. Coding for fun since 2005, for food since 2008 🚀 Site: https://bit.ly/skyspiritlabs

Responses (1)