Tuesday, March 26, 2024

Concurrency by Tutorials | Kodeco

Must read

This ebook is for intermediate iOS builders who already know the fundamentals of iOS and Swift
improvement however need to learn to make their app effectively carry out duties with out
affecting efficiency, and how one can correctly divide work to make the most of {hardware} to the fullest extent.

  • Grand Central Dispatch
  • Operations & Operation Queues
  • Widespread Concurrency Issues
  • Threads & Thread Sanitizer

Dive Into Concurrency in Your iOS Apps!

What’s concurrency, and why would you even need to use it in your apps? Discover out every little thing it’s worthwhile to know on this ebook. Study Grand Central Dispatch, Apple’s implementation of C’s libdispatch, also referred to as GCD — one of many…


This part tells you just a few issues it’s worthwhile to know earlier than you get began, resembling what you’ll want for {hardware} and software program, the place to seek out the challenge information for this ebook and extra.

On this a part of the ebook, you’re going to be taught in regards to the fundamentals of Concurrency. You’re going to be taught what it’s, what sort of issues it solves and when and the way you’d use it.

Moreover, you’ll be taught the fundamental items which comprise Concurrency in iOS improvement: Grand Central Dispatch and Operations.

This part will give you foundational information relating to Concurrency, so you’ll want to learn it by means of! The upcoming sections will dive a lot deeper into every of those ideas individually.

Get a fast overview of what concurrency is and why you would possibly need to use it.

Concurrency may be dealt with by both Grand Central Dispatch (GCD) or Operations. Study in regards to the variations.

On this part, you’ll take a deep dive into Apple’s hottest and easy-to-use mechanism to put in writing and handle concurrent duties — Grand Central Dispatch. You’ll learn to make the most of queues and threads to regulate the execution of duties in your app, in addition to how one can group these duties collectively. You’ll additionally find out about frequent pitfalls and risks of utilizing concurrency, and how one can keep away from them.

This chapter teaches you how one can use a GCD queue to dump work from the principle thread. You will additionally be taught what a “thread” is.

Within the earlier chapter you realized about how queues work. On this chapter you will broaden that information to learn to submit a number of duties to a queue which have to run collectively as a “group” in an effort to be notified after they have all accomplished. You will additionally learn to wrap an current API in an effort to name it asynchronously.

By now you know the way GCD could make your app a lot sooner. This chapter will present you a number of the risks of concurrency in case you’re not cautious, and how one can keep away from them.

Despite the fact that Grand Central Dispatch offers a lot of the concurrency capabilties you’ll want proper out-of-the-box, generally you’ll need some further customizability. That is the place Operations come into play. This part will train you about Operations, Operation Queues and every little thing in between.

On this chapter you will swap gears and begin studying in regards to the Operations class, which permits for rather more highly effective management over your concurrent duties.

Much like the Dispatch Queues you realized about again in Chapter 3, the Operation class makes use of an OperationQueue to carry out the same perform.

Now you could create an Operation and submit it to a queue, you will learn to make the operation itself asynchronous. Whereas not one thing you will do usually, it is vital to know that it is doable.

The “killer characteristic” of Operations is having the ability to inform the OS that one operation depends on one other and should not being till the dependency has completed.

There are occasions when it’s worthwhile to cease an operation that’s working, or has but to start out. This chapter will train you the ideas that you simply want to concentrate on to assist cancelation.

To wrap up this ebook, this part will probably be devoted to displaying you ways you should use the information you’ve accrued all through this ebook for real-life functions.

On this part, you’ll take a deeper dive into a typical case the place concurrency performs an enormous position — Core Information — in addition to find out about Apple’s Thread Sanitizer, a fantastic device to debug and resolve concurrency points and confusions.

Core Information works nicely with concurrency so long as you retain just a few easy guidelines in thoughts. This chapter will train you how one can be sure that your Core Information app is ready to deal with concurrency correctly.

Information races happen when a number of threads entry the identical reminiscence with out synchronization and no less than one entry is a write. This chapter will train you how one can use Apple’s Thread Sanitizer to detect knowledge races.

Supply hyperlink

More articles


Please enter your comment!
Please enter your name here

Latest article