The use of multi threading technology in iOS development
Process and string
To utilize numerous strings, most importantly need to comprehend these 2 ideas of process and string. Here I just said once.
The purported procedure relating to the application is a program, is in charge of the memory for applications to utilize, however the procedure isn't performing assignments (guidelines). A procedure contains no less than one string, the string is the stream of program execution.
- The iOS program is begun, to make a procedure in the meantime, will begin a string, the string is known as the fundamental string
- Each process in the framework has its own autonomous virtual memory space, and different strings inside a similar procedure is shared process memory space
- Every time a string is made, it costs a specific measure of memory and CPU time
- When numerous strings of similar assets when the need to focus on string security issues
Application and consideration matters of multi string
The tedious, surveying or simultaneous request higher assignments to different strings to execute, and by the principle string is in charge of refreshing the interface will make the application more familiar, client encounter better, for example, organize ask for, playing the amusement mood melodies.
- Thread isn't over the top
– The principle string stack size of iOS is 1M
– From the start of the second strings are 512KB
– These qualities can't be changed by the compiler switches or string API work
Note: the refresh of the UI interface, intelligent occasion amongst interface and the client must be prepared in the fundamental string.
The multi string innovation of iOS
The strategy for multi string 1.NSObject exemplification of NSThread (comparing to a NSThread protest a string)
- To open a foundation string to play out the errand
- (void)performSelectorI
Background:(SEL)aSelector withObject:(id)arg
- Method the principle string notice in a foundation string to play out the errand
– (void)performSelectorOnMai
Thread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait;
- Get the string data
[NSThread currentThread];
- Thread to rest
[NSThread sleepForTimeInterval:1.0f];
Incite:
– The performSelectorI
Background technique is executed in the principle string, and the strategy selector determined is in a foundation string
– Although the utilization of performSelectorI
Background technique call errand can refresh the UI interface, however in the real improvement, identified with the UI interface of the refresh operation, or to utilize the performSelectorOnMai
Thread strategy, stuck in an unfortunate situatio
Note:
- Memory administration is essential for the multi string
- Objective-C can be utilized with @autoreleasepool memory assets when required, and asset recuperation
- Each string needs the @autoreleasepool, or there may be a memory spill
2.NSThread
- Create a string strategy:
1.+ (void)detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)argument;
2.- (id)initWithTarget:(id)target selector:(SEL)selector object:(id)argument;
- Explanation of parameters:
– selector: Methods of string execution, there can be just a single parameter, can't restore an esteem
– focus on: The protest selector message transmission
– contention: Transmission to the main parameter target, can likewise be nil
3.NSOperation/NSOperatio
Queue
- Two subclasses of NSOperation
1.NSInvocatio
Operation
2.NSBlockOperation
- Working standard:
1 utilizing the NSOperation bundle to play out an activity
The 2 will make great NSOperation protest in NSOperatio
Queue
3 begin the Operatio
Queue to begin another string to play out the operation in the line
- Matters requiring consideration:
1 when utilizing various strings as a rule requires the quantity of simultaneous strings of control, on the grounds that the strings expends framework assets, running an excessive number of strings, the framework will back off
The quantity of strings utilizing the accompanying technique can control 2 simultaneous:
- (void)setMaxConcurrentOperatio
Count:(NSInteger)cnt;
3 utilizing addDependency to set up the conditions between operations, the request of execution set operatio
The above system reliance, just an and B operations have been executed, will execute C.
4.GCD
- GCD line:
1 worldwide line: all additional to the rundown of errands are executed simultaneously (may open a multi string)
dispatch_queue_t line = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
2 serial line: all add to the serial line of errands are executed consecutively (may just open a string)
dispatch_queue_t line = dispatch_queue_create("myQueue", DISPATCH_QUEUE_SERIAL);
3 the recorded: all additional to the rundown of errands are executed on the principle string
dispatch_get_main_queue();
- Asynchronous operation
– The dispatch_async mission in the other string, will open another string
– Asynchronous strategy can't decide the execution request of errands
•
- Synchronous operation
– Dispatch_sync when the present string to execute an errand, another string isn't open
– Synchronous operation and line free
– Synchronization technique will be executed in succession, the request of execution can choose the errand
– Update the interface of UI, it is best to utilize synchronization technique
Note: synchronous or nonconcurrent, contingent upon the technique name (does not influence the impact of segment, the worldwide line, serial line).
Visit http://infocampus.co.in/ios-training-in-bangalore.html
Further reading
Further Reading
Article
Why We Stay Stuck (Even After Reading 20 Self-Help Books)
How Coaching Turns Knowledge Into Change Walk into any bookstore or scroll through your favorite podcast feed, and youâll see the same thing: endless tips, strategies, and âlife hacksâ promising transformation.rnWe devour them. We highlight paragraphs. We even try to practice what weâve learned. But somehow, the big shifts never stick. Weeks later, the old patterns creep back in.rnSo why does it happen? Why do so many smart, motivated people keep getting stuck â eve
October 6, 2025
Article
The Basics of Abrasive Wheels: What Everyone Should Know
grinding and cutting a variety of materials across numerous industries. Understanding their construction, types and safety precautions is mandatory for anyone working with these powerful tools. This article will explore the basics of abrasive wheels, offering insights into their components, maintenance and legal requirements to ensure both effective and safe usage. Exploring the Basics of Abrasive Wheels Abrasive wheels are critical tools in various industrial applications, f
March 6, 2025
Article
Uncensored Hidden Wiki: The Gateway to the Dark Web
The internet we use daily, known as the surface web, represents only a fraction of the entire digital landscape. Beneath this visible layer lies the deep web and the dark web, where anonymity, privacy, and unrestricted information exchange thrive. Among the most well-known directories for accessing dark web content is the Uncensored Hidden Wiki . This article delves into the history, significance, risks, and access methods of the Uncensored Hidden Wiki, providing a comprehens
January 31, 2025
Article
Discover Piano Classes Near You in Toronto
If you're searching for exceptional piano classes near you, there are several excellent options in Toronto to consider. For those eager to learn the piano, finding a school or instructor that offers expert guidance, comprehensive lesson plans, and a supportive environment is key. Catering to both beginners and advanced players, many schools in the Toronto area provide tailored lessons to help students achieve their musical aspirations. What to Look for in Piano Lessons When
January 1, 2025