karan satia
karan satia

Reputation: 319

Threads and Queues in iOS - not NSThread

I'd like to get a conceptual understanding of serial/concurrent queues and threads in iOS. I have a solid grasp of the queue data structure and how it's used.

Are threads just, in an unofficial sense, an abstraction of a queue? Meaning they're implemented using queue data structures. Each queue is then an actual thread, but they act as queues in that processes are executed in a first in, first out fashion?

That would stand for serial queues, as those DO indeed follow FIFO, but then concurrent queues are a different ball game. You don't know what processes are executing when, and even though you have them on one queue, they are actually getting fired on different threads wherever there is availability? Meaning that queues can actually contain or refer to multiple threads?

Any help or pointers to resources (not including apple documentation, which I'm currently going through) would be greatly appreciated.

Upvotes: 1

Views: 234

Answers (1)

Ciprian C
Ciprian C

Reputation: 247

Queues are one of the methods to create threads in iOS.

A thread is the current execution of a code. The main thread (Thread 0) is actually the single thread which runs always during the app lifetime. The others, if they are not attached to a NSRunLoop which have something like while(1) { code...}, then they'll finish immediately after the code is executed.

Wikipedia should be your friend: https://en.wikipedia.org/wiki/Thread_(computing)

Upvotes: 0

Related Questions