Live data from Hacker News

How to programmatically find out if computer is on

haiku-os.org

81–90 of 197 posts

Re: How to programmatically find out if computer is on

#81

> is_computer_on() How does this relate to computer being in Halt state, which is quite valid state for servers (there could be even a dedicated Halt button)? Technically computer hardware is ON. I remember that in such state it shows a "carrot" prompt (>>>) from the SRE console. By the way, there is also HCF instruction (Halt and Catch Fire). https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing...

Wouldn't a CPU halt state mean no code is running?

a computer has multiple CPUs. One may be halted while another still running.

Re: How to programmatically find out if computer is on

#82

> is_computer_on() How does this relate to computer being in Halt state, which is quite valid state for servers (there could be even a dedicated Halt button)? Technically computer hardware is ON. I remember that in such state it shows a "carrot" prompt (>>>) from the SRE console. By the way, there is also HCF instruction (Halt and Catch Fire). https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing...

> By the way, there is also HCF instruction (Halt and Catch Fire).

I was somewhat recently scarred for life by this instruction, having just discovered that if you execute HCF on the MIPS-based integrated circuits in Stationeers, the simulated IC... explodes in your face.

Re: How to programmatically find out if computer is on

#83

Earlier quoted context omitted.

Wait. When the machine isn't on, P=NP! So our security systems are (useless | perfect)! I think there might even be other implications...

Nice job - having shown that P is the same as NP factorial will allow us to solve a lot of really hard problems!

Golf clap.

Re: How to programmatically find out if computer is on

#84
post #60

Since the not-on result is 'undefined', a devilish implementer could return 1 for the off case, just to screw with people. (How could this work in theory? Maybe the computer has a separate watchdog controller board which allows the computer to be turned on and off remotely, and that controller acts as a proxy for the API request.)

Only if the watchdog also has a CPU that can run programs when the "real" CPU is off. But then we'd need a is_watchdog_on() to know if that one is powered on, in the case where the wall plug has been pulled.

Re: How to programmatically find out if computer is on

#87
post #4

Where does the code run when the computer is off? Edit: I see the downvotes, yet i still don't know if it's a joke. I was genuinely asking the question.

It looks like you haven't heard of quantum computing

The computer is only on or off when you measure it.

Re: How to programmatically find out if computer is on

#89
While this is a joke, there are some contexts in which it does make sense to ask whether the computer is on. For instance, most laptops have an embedded controller which runs all the time, even when the laptop is powered off, and manages things like battery charging and the power state. Within that embedded controller, an is_computer_on() function could legitimately return "false".

Re: How to programmatically find out if computer is on

#90

> is_computer_on() How does this relate to computer being in Halt state, which is quite valid state for servers (there could be even a dedicated Halt button)? Technically computer hardware is ON. I remember that in such state it shows a "carrot" prompt (>>>) from the SRE console. By the way, there is also HCF instruction (Halt and Catch Fire). https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing...

I’ve wondered what Go APIs involving channels should do when the computer is put to sleep and later on wakes up.
Post reply on HN