13

Multitasking in Windows Phone 7: it can be done...kinda

In an interesting twist, it seems that at least for some types of programs written for Windows Phone 7, multitasking or rather, the simulation of multitasking is completely possible.

Over at clr-namespace.com, the author whipped up a stopwatch application which you can start, then "minimize" then return to the app and it appears to have be running the whole time.

Of course in reality, it's not. It's "tombstoning" the application, which is a process by which

...the operating system maintains state information about the application. If the user navigates back to the application, the operating system restarts the application process and passes the state data back to the application, where the user will be able to continue seamlessly from his last interaction point with the application

In this case, the stopwatch does pause, but when restarted it counts back up from the original start time, giving the illusion that it has been "counting" while paused. This all happens without the user even knowing, making it a bit of a kludge, but a good one for this application.

How can this be applied to other programs? We're not really sure but it goes to show with some ingenuity, programmers can get around some of these "limitations".

[clr-namespace via Silverlight Show.net]

0
loading...
0
loading...
0
loading...
0
loading...

Comments

There are 13 comments. Sign in to comment

says:

In some ways this is preferred to full multitasking. Joe 6-pack consumer really doesn't know what applications are running and causing battery drain.

WP7 does need to address the times when multitasking is required. Like streaming media (integration into the media hub) and inteligent notifications that can (by permission) activate an application based on a network or phone event.

says:

It's really not that impressive. The app just saves the time it was started, then while running calculates the duration between the current time and it's start time to show how long it has been running and displays this a couple times a second. (Its basic datetime math)

Basically applications can store a lot of their data, and when the program starts up again wp7 passes that data back to it. It actually doesn't seem far up from the stateless way in which website programming works, at least to me.

says:

*yawn*

That's exactly what even "gool ol'" PalmOS did, and most competitors (at least iOS and Android) still do if an app doesn't use background services (big difference between iOS and Android is: Android apps can use own services, iOS only allows some system services like background music and network queries).

Rico says:

Actually if I remember correctly Palm OS had four or six timers that could run simultaneously at any given time, even in the background.

For Windows Phone 7, multitasking beyond streaming music while browsing the web will be enough for most people. For the rest of us there needs to be access to background services that will download or allow GPS usage or whatever in the background. I really don't care how multitasking is performed as long as it doesn't impair my experience with whatever app is in the foreground as we have with Windows Mobile 6.5.

says:

That can be solved by prioritizing threads. As long as the foreground thread always has a higher CPU priority, most performance problems can be mitigated. Of course, there are other possible resource contentions (memory/storage), but part of the WM6.5 problems were due to all processes being first class citizens, even if they were minimized. If the kernel just bumped the foreground process to ABOVE_NORMAL, that would be greatly mitigated.

A fast CPU helps too, which WP7 will have. Which makes it doubley weird that it has such iPhone-like limited multitasking.

Personally, I think having the default mode of operating being tombstoning is a great idea. What bothers me is that there is no way to set a flag in the manifest to say "hey I need to run the background -- really!"

Since MS is vetting every app through marketplace, they should be able to see who really needs it and kick out those who don't.

says:

Sorry if I am way off the mark but isn't this pretty much how iOS handles a fair proportion of it's task switching?

says:

I can't see what the fuss is about.
It works well, doesn't it?
Ok, then, moving on.
What's next?

says:

You say the timer pauses, but what about this video:
http://www.youtube.com/watch?v=glzBui95tiY

the counter actually continues counting and finishes the job while it's minimzed

says:

This is basic and unimpressive. It doesn't seem to give a notification when it finishes and is not in the foreground.

says:

Considering Videos that are showing actual computations done while the app was backgrounded: this was due to the process not actually being shut down in the technical previews prior to the beta.

Now when your app loses focus it triggers an event to tell u, u have to save your application state. You have 10 seconds to do so before the app gets killed if you're ready or not.

I still believe navigational backgrounding plus a few others will be needed (see iPhone). The idea of not allowing unlimited multitasking is a good one in some ways. Not only does it conserve power - if all music has to go through the Zune Hub, it also means that all music apps are likely to be controlled through the Zune music controls (e.g. ONE way to control music instead of 17 + 1).

says:

I still don't see why WP7 can't give me what I already have on my 2 1/2 year old Moto Q9h WM6.1-go to the Task Manager and switch between 4-5-6 apps/programs I may have open at the same time. 1Ghz CPU's, plenty of RAM/ROM-why can't it be done?

Rico says-"multitasking beyond streaming music while browsing the web will be enough for most people". I hope this is not MS's thinking. As much as WP7 looks like a social networking/multimedia powerhouse OS (with little or no multitasking capability) I still like the PC experience of WM6.1...

says:

Hey guys. In this case,how will work apps such as countdown timers,alarms,instant messaging apps etc.in background? If the system simply stops the process,then forget about ICQ,Gtalk,etc. If the timers will be shut-off in the background,so we will burn-out our saussages in the pot without timer;) So many disadvantages,I'll never accept. Cheers,Tomas.

says:

I'm glad I have WebOS-although there is a battery hit, at least I have the choice to drain my batt faster or not