Detect Operating System

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Detect Operating System

Post by FourthWorld » Fri Apr 24, 2020 3:58 pm

richmond62 wrote:
Fri Apr 24, 2020 12:16 pm
What comes out of this "jolly love-in" is that LiveCode can pick up information from other software (i.e.the operating system) but
NOT from the hardware.
Yes, that was also among the takeaways from the earlier thread on this.
Mind you, if a 32-bit system runs on a machine, who gives a flying "ffffffffffffff" about the processor as,
presumably, 32-bit LiveCode standalones will run on that machine.
^ this.

The original question that started this thread was about differentiating application behavior based on platform. The platform function satisfies that request.

Later in the thread, you'd asked about the processor, satisfied by the processor function.

Both real-world needs presented here have been satisfied by one-word functions already in the engine.


This leaves us only with the theoretical edge case of an application running in an emulated environment but needs to know the architecture of the host. For that shell calls have been presented.

Where shell calls may not be useful, or may be difficult to arrive at, may ultimately be a philosophical question:

Emulation comes in many forms. What if the emulation of an architecture takes place in a container, such as a VM or a Docker instance?

It may be interesting to know the architecture of the host, but the architecture reported by LC is the architecture it's running under, so I can't consider the processor function remiss in reporting what it's using.

And what if you have an emulation running in a container that's running in a VM that's running in a physical machine?

Once we start down the road of guessing which layer may be of interest in any given scenario, the challenge of attempting to report things outside the layer affecting a given LC app becomes ever murkier.

In those rare cases, rather than change the existing processor function, a new function may be a better idea.

And even then, in our modern container-driven world, we'd have to accept that some of that information may not be available. After all, if an app can reach outside of the container it's running in, the container hasn't done a complete job of providing containment.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

tperry2x
Posts: 23
Joined: Wed Apr 22, 2020 9:58 pm

Re: Detect Operating System

Post by tperry2x » Fri Apr 24, 2020 6:38 pm

True, but let's say tomorrow the major chip manufacturers announce they are going to make a 128bit processor (unlikely, because they are all at home). Like what happens with a 64 bit chip currently, where 32bit software would run - the same would be true with the 128bit system. Older 64bit software would probably run seamlessly, even though livecode would return a 64 bit value for processor. The shell would return a 128bit as it would take the arguments from a lower level.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Detect Operating System

Post by FourthWorld » Fri Apr 24, 2020 6:57 pm

tperry2x wrote:
Fri Apr 24, 2020 6:38 pm
True, but let's say tomorrow the major chip manufacturers announce they are going to make a 128bit processor (unlikely, because they are all at home).
It would take more time just to design the system than it took the 1919 pandemic to complete its cycle, and after that would begin the also-long process of tooling out fabrication. And with that long multi-year ramp-up time, as I'd written above, there's plenty of time for the LC folks to add one string to the engine.
Like what happens with a 64 bit chip currently, where 32bit software would run - the same would be true with the 128bit system. Older 64bit software would probably run seamlessly, even though livecode would return a 64 bit value for processor. The shell would return a 128bit as it would take the arguments from a lower level.
Would it? Depends on the shell call, and how complete the containment is.

What if one level up is what you're looking for? Or what if one level up is what I'm looking for, and you're looking two levels up, and Bogs is interested in the hardware?

And should we even be using a VM that allows processes within it to probe the host system? What is the value of a container that provides weak containment?

We could bike-shed all day on this, but let's look for the most practical solution for the task at hand:

What application are you writing that needs to know not the processor instruction set your app is dependent on, but that of its emulation host?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Detect Operating System

Post by richmond62 » Fri Apr 24, 2020 6:58 pm

tperry2x wrote:
Fri Apr 24, 2020 6:38 pm
(unlikely, because they are all at home).
Well, we all are, and that's why we're amusing ourselves thinking up possible future scenarios, as, let's face it,
when the Corona-virus has wiped out 99% of us we'll have no electricity to run our computers with anyway.

However, it is possible, that once we get out-and-about, some 'pain' is going to feel an urge to push 128-bit processors
because they haven't worked out that the "ever onwards, ever upwards, non-stop economic and technological growth"
may NOT necessarily be the best way for us to go . . .

. . . at which point we can sally forth from our siege-mentalities we're all inhabiting at the moment and, like it or
not, be dragged back into the race . . .

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Detect Operating System

Post by FourthWorld » Fri Apr 24, 2020 7:05 pm

For fun:

This is a portable data center build inside a shipping container (they're kinda cool and although I have no need at all for this I really want one for Christmas):
datacenter-solutions-Containerized-datacenter-truck-inside.gif
With multiple racks of CPUs orchestrated with Kubernetes to manage VMs housing Docker instances, it's containers within containers within containers within a container. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Detect Operating System

Post by FourthWorld » Fri Apr 24, 2020 7:17 pm

richmond62 wrote:
Fri Apr 24, 2020 6:58 pm
However, it is possible, that once we get out-and-about, some 'pain' is going to feel an urge to push 128-bit processors
because they haven't worked out that the "ever onwards, ever upwards, non-stop economic and technological growth"
may NOT necessarily be the best way for us to go . . .
Aside from ARM emerging as a good choice for mobile, the only other major shift we've seen in consumer microchip instruction sets was when AMD introduced 64-bit addressing in 2003.

Given 32-bit's limitation of 4 GB of addressable RAM, the benefits of 64-bit are clear: able to address 16.8 million terabytes, we should be set for a while on that front. :)

For large-scale computing it's far more practical today to run a cluster of 64-bit machines than to undertake the expense of making a whole new architecture, and you get to use existing ecosystem tooling and apps to do it.

I suspect any shift in instruction sets worth pursuing with either be downward, below ARM, into nano space, or upward into quantum. Both seem likely to give us several years of breathing room before they find their way to consumer use.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply