How to respond to push notification view if app is already running in the background

Check out application:didReceiveRemoteNotification:fetchCompletionHandler: in iOS 7 and later. The method application:didReceiveRemoteNotification: is called if your app is running in the foreground. It also is called if your app is running in the background and the user engages with your push notification (thus making your app active). So, the real question is how to determine if … Read more

Executing multiple functions simultaneously

You are doing it correctly. ๐Ÿ™‚ Try running this silly piece of code: from multiprocessing import Process import sys rocket = 0 def func1(): global rocket print ‘start func1’ while rocket < sys.maxint: rocket += 1 print ‘end func1’ def func2(): global rocket print ‘start func2’ while rocket < sys.maxint: rocket += 1 print ‘end … Read more

Detect if app is running in Slide Over or Split View mode in iOS 9

Just check if your window occupies the whole screen: BOOL isRunningInFullScreen = CGRectEqualToRect([UIApplication sharedApplication].delegate.window.frame, [UIApplication sharedApplication].delegate.window.screen.bounds); If this is false, then you’re running in a split view or a slide over. Here is the code snipped which will automatically maintain this flag irrespective of rotation -(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { // simply create a property of ‘BOOL’ … Read more

What is starvation?

Imagine you’re in a queue to purchase food at a restaurant, for which pregnant women have priority. And there’s just a whole bunch of pregnant women arriving all the time. You’ll soon be starving. ๐Ÿ˜‰ Now imagine you are a low-priority process and the pregnant women are higher priority ones. =)

How does the OS scheduler regain control of CPU?

The OS sets up a hardware timer (Programmable interval timer or PIT) that generates an interrupt every N milliseconds. That interrupt is delivered to the kernel and user-code is interrupted. It works like any other hardware interrupt. For example your disk will force a switch to the kernel when it has completed an IO.

When an iOS application goes to the background, are lengthy tasks paused?

From the documentation: Return from applicationDidEnterBackground(_:) as quickly as possible. Your implementation of this method has approximately five seconds to perform any tasks and return. If the method doesnโ€™t return before time runs out, your app is terminated and purged from memory. If you need additional time to perform any final tasks, request additional execution … Read more

Difference between multitasking, multithreading and multiprocessing? [closed]

Paraphrasing wikipedia: Multiprogramming – A computer running more than one program at a time (like running Excel and Firefox simultaneously) http://en.wikipedia.org/wiki/Multiprogramming Multiprocessing – A computer using more than one CPU at a time http://en.wikipedia.org/wiki/Multiprocessing Multitasking – Tasks sharing a common resource (like 1 CPU) http://en.wikipedia.org/wiki/Computer_multitasking#Multithreading Thus, something like multithreading is an extension of multitasking.