A few days ago, someone asked me a question about the task queue: it is required that only 2 tasks can be executed at the same time, and other tasks can be executed after the completion of any one task. There are always only 2 tasks in synchronous execution. Today, I wrote the code for implementation, if you are interested, you can have a look

Create global dispatch_semaphoRE_t

Singnal is mainly used after simulation tasks

Create asynchronous parallel queues

Then run dispatch_semaphore_signal

Print the content