Linked by Thom Holwerda on Mon 21st May 2012 20:03 UTC
Windows For Microsoft, the traditional desktop is old news. It's on its way out, it's legacy, and the harder they claim the desktop has equal rights, the sillier it becomes. With companies, words are meaningless, it's actions that matter, and here Microsoft's actions tell the real story. The company has announced the product line-up for Visual Studio 11, and the free Express can no longer be used to create desktop applications. Message is clear.
Thread beginning with comment 519005
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[5]: "19th Century Dentist"
by Nelson on Tue 22nd May 2012 15:08 UTC in reply to "RE[4]: "19th Century Dentist""
Nelson
Member since:
2005-11-29


Certainly an app can spawn threads that consume large amounts of CPU time in the background, however it's likely that these threads are just reacting to more events such as network activity or topping up audio buffers. If you have a music player or P2P app, then running it in the background is often exactly what the user wants (who wants to stare at the P2P screen all day?). Can we say a background application is wasting energy when it's doing what the user wants in the background instead of the foreground?


I'm sure the user has a good faith intent, but often this is abused by poorly written programs. Many times I've had to kill tasks of programs which pegged my CPU for no reason.

The Win8 execution model says: "If programA wants to use the Network, it must explicitly state so declaratively, and then when it does, it must behave predictably or be killed."

Background Tasks are limited in CPU usage and memory, and execute for limited amounts of time, so it forces devs to use better practices.

Most programs, realistically, don't need to always be running. The ones that do, there are a bunch of background tasks for them to use.


I think the bigger problem is applications that waste cycles in the background doing non-productive things. One example I'm thinking of now is a game that keeps running even when minimized, but I really don't know if this is a common problem in practice.


I agree, but in my own experience its been more than a few timesI've had to kill tasks.


Well yes, but if the user is playing music or downloading files, he probably doesn't want his device to go to sleep until those tasks are done. I wouldn't classify these things as wasteful when the application is doing what the user wants it to do.


Windows 8 tablets and laptops support ultra low power states in which the network card will wake itself back up when data comes in over the wire. Something that can't be done if an application is polling doing a blocking read.

With Win8 you hand the OS a background task, and you'll have your network data pushed to your app when it comes in, its basically a "Don't call us, we'll call you". In fact, its the only way for Metro apps to maintain a socket connection in the background.

I have to wonder whether shutting everything down in the background (win32s or not) would cause frustration that applications can't do work in the background (like downloading, teleconfrencing, music, etc). If an OS permits these 3rd party background tasks, then I don't see why win32 is worse than alternatives. If it does not, then it should be possible to suspend a win32 application while it is backgrounded.


Its handled like I said above, if you want to learn more you can read up on ControlChannelTrigger for Metro Style Apps.


Not to deny this, but I'm not seeing why this excludes the win32s. Although it may seem that way, I'm not really trying to promote win32s, but I'm not convinced their depreciation was motivated by poor resource utilization. I suspect that resource utilization in desktop apps won't be much different than their metro counterparts. Now I might be all wrong, but I haven't seen anything technical to convince me otherwise.


I think its demonstrably true that Metro Apps use less resources. A great majority of them do not run in the background at all, others use resources moderated by the OS, and there is less resident memory taken up by the apps.

Another point to make is that (for pure Windows RT tablets) is that lower memory consumption by tombstoning background apps can lead to them shipping tablets with less ram and by extension less power draw.

Reply Parent Score: 2

RE[6]: "19th Century Dentist"
by Alfman on Tue 22nd May 2012 17:29 in reply to "RE[5]: "19th Century Dentist""
Alfman Member since:
2011-01-28

Nelson,

"The Win8 execution model says: 'If programA wants to use the Network, it must explicitly state so declaratively, and then when it does, it must behave predictably or be killed.'"

I understand that, but there's no technical reason this kind of meta data couldn't also be applied to win32s, which is just an API. The OS is always free to manage resources like it always has. As an example, the linux kernel can run processes inside cgroups which can monitor process resource usage and apply hard/soft limits whether or not application binaries are aware of them. Adding these features to linux didn't require developers to abandon their APIs and rebuild apps from the ground up. I don't see a technical reason OS resource enforcements in metro cannot be applied against desktop apps if that were a goal.


"Most programs, realistically, don't need to always be running..."

Of course I agree with that, but by far and large I think applications which don't need to be running in the background are *already* not running in the background because the OS isn't sending them any events to handle. And those that are running in the background are doing it because they're doing real work (like an SFTP client transferring files).


"I agree, but in my own experience its been more than a few timesI've had to kill tasks."

I've inadvertently programmed such tasks myself on more than one occasion, but these were quickly discovered, and in principal one could apply the same quotas against both metro and win32 apps such that the performance degradation of endless loops would be the same in either case.


"Windows 8 tablets and laptops support ultra low power states in which the network card will wake itself back up when data comes in over the wire. Something that can't be done if an application is polling doing a blocking read."

Hmm, polling and blocking are totally different approaches. Polling is extremely bad, but I honestly haven't seen too much of that since the days of DOS. Polling has been replaced with various kinds of blocking mechanisms (event passing, asynchronous callbacks, IO threads, ...). In all cases though when a thread is blocked on input it is asleep and not consuming any CPU. The OS chooses when to wake it up to handle new IO events.

"With Win8 you hand the OS a background task, and you'll have your network data pushed to your app when it comes in, its basically a 'Don't call us, we'll call you'."

Then I'll need you to explain how the mechanics are different from a win32 event loop, other than being a different API, since the win32s can also be described as "don't call us, we'll call you".


"I think its demonstrably true that Metro Apps use less resources."

I am skeptical, I'd love a citation for that.


"A great majority of them do not run in the background at all, others use resources moderated by the OS, and there is less resident memory taken up by the apps."

I understand this, but I feel like your insinuating that most win32 apps do run in the background when minimized when I actually think they're blocked on input and are completely asleep. Even if they are not, an OS could always force them to sleep until they're brought back to the foreground as policy demanded.

Again, I'm not trying to undermine the merit in winrt, it may be a wonderful API (apart from certain restrictions...). I just don't know if there's any substance to the argument that win32 inherently wastes more energy.

Edited 2012-05-22 17:41 UTC

Reply Parent Score: 4

RE[7]: "19th Century Dentist"
by Nelson on Wed 23rd May 2012 04:21 in reply to "RE[6]: "19th Century Dentist""
Nelson Member since:
2005-11-29


I understand that, but there's no technical reason this kind of meta data couldn't also be applied to win32s, which is just an API.


Well, you'd run into compat issues with previous Windows desktop apps. Metro benefits from the clean break and can afford a new execution model.

But furthermore, Metro is more than the sum of its parts. Its an entire cohesive thing. You have an execution model, a cross language abi, language projections, etc.


The OS is always free to manage resources like it always has. As an example, the linux kernel can run processes inside cgroups which can monitor process resource usage and apply hard/soft limits whether or not application binaries are aware of them. Adding these features to linux didn't require developers to abandon their APIs and rebuild apps from the ground up. I don't see a technical reason OS resource enforcements in metro cannot be applied against desktop apps if that were a goal.


Well, the end goal isn't to make things harder. Its to enforce these policies, and provide facilities to do things the right way. That's the value prop of WinRT. Yes there are restrictions, but here are ways to play within our sandbox.


Of course I agree with that, but by far and large I think applications which don't need to be running in the background are *already* not running in the background because the OS isn't sending them any events to handle. And those that are running in the background are doing it because they're doing real work (like an SFTP client transferring files).


There's a difference, suspended Metro apps are not scheduled at all. The processor can effectively operate in low power states more frequently.


I've inadvertently programmed such tasks myself on more than one occasion, but these were quickly discovered, and in principal one could apply the same quotas against both metro and win32 apps such that the performance degradation of endless loops would be the same in either case.


win32 apps aren't designed for and don't expect such things, Metro apps are. Metro apps are designed to save state, Win32 apps are not.


Hmm, polling and blocking are totally different approaches. Polling is extremely bad, but I honestly haven't seen too much of that since the days of DOS. Polling has been replaced with various kinds of blocking mechanisms (event passing, asynchronous callbacks, IO threads, ...). In all cases though when a thread is blocked on input it is asleep and not consuming any CPU. The OS chooses when to wake it up to handle new IO events.


My point is that while Win32 applications may or may not use best practices. Metro apps must use best practices.


Then I'll need you to explain how the mechanics are different from a win32 event loop, other than being a different API, since the win32s can also be described as "don't call us, we'll call you".


Newer hardware supports ultra low device states in which you can be suspended, and only be awoken when new data is on the wire. As noted above, the app isn't even scheduled until new data on the transport channel triggers it. The data is then pushed to you.


I am skeptical, I'd love a citation for that.


Its simple, suspended apps are not scheduled, and during low memory situations their memory is reclaimed.
http://blogs.msdn.com/b/b8/archive/2012/04/17/reclaiming-memory-fro...

Reply Parent Score: 2