Hacker News new | ask | show | jobs
by catdog 47 days ago
Looking at the amount of RAM phones have nowadays I don't know if this is an issue, desktop Linux runs fine with those amounts. Also Android is not really memory efficient so they needed this workaround.
2 comments

I currently have 35 apps "open" on my iPhone, most of which are probably React Native or similar.

Other times I'm sure I've hit 60-70.

Because of iOS's app management feature, most of the apps are actually dead, but if I go back and open any of them, they will open and load on the screen on which I left them.

Android does this too.

Desktop Linux cannot.

Can I open 60-70 or even 35 Electron apps simultaneously on 8GB of RAM on Linux?

And no, I do not want to to back to closing apps, that is simply an inferior experience.

> they will open and load on the screen on which I left them.

You can't be serious. Browsers can't even remember the most trivial of things - a tiny html page, retaining reading position, forcing a reload. Of course many apps are no better (though some do try, just like on the desktop) And it's especially worse with user input that just gets lost

> And no, I do not w to to back to closing apps, that is simply an inferior experience.

Ctrl+Q to close and a shortcut to open or is a faster and more convenient than swiping around. As is typing an app's name on a real keyboard. Tapping "desktop" icon is arguably better, though, that a mouse click

Of course some apps implement this better or worse, but for an app that doesn't implement this, booting me to the home page (which is just one tap away from where I was) is still miles better than hogging ram.

I don't want to close apps, I don't want to manage my computer's resources.

It should just work and it should just work well.

> It should just work and it should just work well.

That's just magical thinking (thought I totally agree with the sentiment, it should, and Linux should also be better), it doesn't, you're still doing the management, just using a different set of gestures.

For example, knowing about this poor "incredible engineering" I sometimes have to reopen the app in the middle of using another app not to lose my input/position there, especially when I need some basic cooperative behavior like copy paste in multiple steps, where I need to make sure no steps are lost. The primitive iOS system can't guarantee that! And in some instances I'd take the overall sluggishness due to RAM waste over this because then I'd still manage to complete the task, albeit slower, instead of having to redo the work (and in some old apps I could even save intermediate progress to those ancient things called files that Apple despises)

> which is just one tap away from where I was

Except it isn't. If you've scrolled to X% of the document, there is no 1 tap to get back there! And if it took you 5 taps to open that sub-page sub-group it the app setting, then getting from the hope page will take the same 5 taps + some time wasted remembering where you want to go to. And if you lose your input in the input field, same thing, 1 tap won't magically recover it.

And if you're temporarily in a place without (good) network conneciton, you might never get there in any number of taps becaus the page won't load.

Btw, if it's fine to lose user data, than Linux can OOM your apps for you just fine without any extra management on your side. Sure, its current state of app management is not as good as on mobile, it does lack some "engineering" in this regard, though not sure what's so magical about more careful killing of apps

> it's fine to lose user data, than Linux can OOM your apps for you just fine

That's the point. Android and iOS have cooperative applications by design. They implement an interface and apps will save their state on command and restore it on next run quickly.

You can't get it back properly without the apps being cooperative to a degree

> apps will save their state on command and restore it on next run quickly.

Except they don't, including apps created by the OS owners! Only some apps do, just like some desktop apps autosave.

> You can't get it back properly without the apps being cooperative to a degree

Exactly! Just like on any desktop OS!

Ok, but this is just a case of some apps not implementing this properly.

For example Adobe Acrobat does remember exact position in the document, so do first party Apple apps and many others.

Some apps don't.

On Linux no app CAN implement this because the protocols do not exist.

> so do first party Apple apps

Again, what I've started with - this is simply false. App Store, the first party gateway to all apps, doesn't. It loses the app page you're in all the time and can't even remember your search query. Safari doesn't

> On Linux no app CAN implement this because the protocols do not exist.

What do you mean, what stops an app from saving position and restoring it in the absence of some magical protocol? How have some apps done in since before the phones existed?

It's in unix. SIGSTOP and SIGCONT + swap.
And GPU buffers? And in-flight network requests? And notification handling? And D-Bus presence? And watchdogs? And other held resources like pids and fds?
If you want to checkpoint/resume applications arbitrarily, as AOSP does, you have to virtualize all of those resources anyway. Check out the CRIU patchset (since merged to mainline) which can even resume applications seamlessly across hosts, without any VM being involved.
These are things that would be easy to solve in Linux.

What is difficult is e.g. supporting the undocumented photo/video camera and other essential parts of the hardware that lack documentation.

This gets brought up several times in this discussion. Hardware with drivers, firmware and device trees exist, see e.g. Fairphone. It even works with open source camera apps (e.g. done in /e/OS). The problem is not (only) the hardware, it is that the Linux desktop stack is wholly unoptimized for phones. And the fact that Meego/Maemo/etc. are now almost two decades ago shows that it is not 'would be easy to solve'. Heck, Linux laptops, which have been available since forever still have far worse battery life than Windows or macOS.

You need a stack that is designed from first principles for phones. Luckily we have one that is open source (AOSP).

Yeah it's solved. It's called android + a normal userspace that can tell apps to suspend and apps are cooperative and do so before getting stopped.

It's not a technical problem, it's a social one (for the apps/programs)

You haven't tried to run a Linux on Mobile distro on your phone and compared the battery life to Android, have you?

Spoiler: I have :-)

Depending on the phone they'd struggle to go in a low power state when the screen is off or can't access other power saving features because the manufacturers keep everything under wraps.