in Technology by

What is GCD? What are advantages over NSThread?

1 Answer

0 votes
by

GrandcentralDispatch: Because your device only has one processor, GCD probably only creates one thread for executing blocks and your blocks execute sequentially. You’ve created 10 different threads, though, and those each get a little piece of the available processing time. Fortunately, sleeping isn’t very processor-intensive, so all your threads run together pretty well. Try a similar test on a machine with 4 or 8 processing cores, and you’ll see GCD run more of your blocks in parallel.

The nice thing about GCD isn’t that it necessarily offers better performance than threads, it’s that the programmer doesn’t have to think about creating threads or matching the number of threads to the number of available processors. You can create lots of little tasks that will execute as a processor becomes available and let the system schedule those tasks for you.

Related questions

0 votes
0 votes
    What are the advantages of Angular over other frameworks?...
asked Jun 29, 2021 in Technology by JackTerrance
0 votes
    What are the advantages of Hibernate over JDBC?...
asked Feb 4, 2021 in Technology by JackTerrance
0 votes
    What are the advantages of induced draft cooling tower over forced draft cooling tower?...
asked Feb 3, 2021 in Technology by JackTerrance
0 votes
    What are the advantages of piers constructed monolithically with the bridge deck over usage of bearings?...
asked Jan 1, 2021 in Technology by JackTerrance
0 votes
    I know there are many advantages that SVMs have over ANN since they cover two main disadvantages of ANN: ANN covers ... ANNs usable ? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    What Advantages Do Numpy Arrays Offer Over (nested) Python Lists?...
asked Apr 25, 2021 in Technology by JackTerrance
0 votes
    List the advantages NumPy Arrays have over (nested) Python lists?...
asked Apr 24, 2021 in Technology by JackTerrance
0 votes
    Mention some of the advantages of using ORM over JDBC?...
asked Apr 14, 2021 in Technology by JackTerrance
0 votes
    Computer A has 32 32-bit registers, while Computer B has 16 64-bit registers. Give two advantages that Computer A ... over Computer B.? Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
0 votes
    What are the advantages of digital circuits? a) Less noise b) Less interference c) More flexible d) All of the mentioned...
asked Dec 29, 2022 in Technology by JackTerrance
0 votes
    What is the user stories in Scrum? What are the advantages of using them?...
asked Aug 19, 2021 in Technology by JackTerrance
0 votes
    What are the advantages of using a VPN?...
asked Aug 14, 2021 in Technology by JackTerrance
0 votes
    What is Scrum? what are advantages....
asked Jul 18, 2021 in Technology by JackTerrance
0 votes
    What are the advantages of using Spring Boot?...
asked Jul 5, 2021 in Technology by JackTerrance
...