How can software make physical changes happen?

595 views

I’ve been thinking a lot about software and how it affects hardware. How is it that software, that runs on code, or some computer language, can affect the physical properties of the computer? For example what has to happen for a phone to physically shut down after pressing the shutdown button on a touch screen? Or how can it be that by pressing a button in a software, a physical movement can be made on an object? Going deeper, how can it be that a button press, or a touch can affect the state of the transistors?
This reminds me of the problem of consciousness, where in a computer a software is like the mind and that cannot phisically connect to the body.

In: 3

13 Answers

Anonymous 0 Comments

Caveat, this is massively oversimplified.

So, the misunderstanding is that you’re assuming software doesn’t have a physical representation. It absolutely does. Software on your computer sits in your storage device (HDD or SSD). If it’s an HDD, each bit is stored as a tiny area that is either magnetized to demagnetized to store a 1 or 0. If it’s an SSD, there are little floating gate transistors that store the 0 or 1.

When that gets loaded into memory, like ram, the 0/1s are read from the physical properties on the disk and copied to the physical properties of memory, which can be made with capacitors. The charged/uncharged state of the capacitor can represent the 0 and 1.

When your processor accesses the memory, it can create a signal where one set of wires directs where to look in memory, and another set of wires have the resulting data copied onto them. We now have a bunch of physical wires that have a voltage on them representing the data that the CPU can use (~5v for 1, ~0v for 0).

Through the use of logic gates, the CPU can create electric signals on various wires to send electric signals to other parts of the hardware. These control signals are usually specific to the hardware in question, which is why there are usually drivers you install, or firmware on the device. A driver is basically a special program that gives the operating system a way to translate the conceptual thing it wants to do (“what data is at address 50?”) and turn that into a set of voltages on those wires (“put 00110010 on wires 1-8, because on this chip wires 1-8 are the memory address wires”).

So, to take it back to your question:

* You click your mouse

* That sends a signal to the motherboard, down the wire. Note that this could also be Bluetooth.

* Your operating system detects the new event, reads it and determines it’s a mouse click event. It’s now basically in “memory” / “software”. At this point, this is just changing 0/1s in memory.

* The operating system now sends that event to the software you’re running to handle.

* The software sees the click, and runs code in memory to see that the cursor (whose position is also in memory) was over a button.

* The software runs its response to being clicked. Your example talks about hardware, so in this case it finds the driver for your hardware and runs that code.

* The driver gets the signal, and determines that on your chipset, it needs to set a set of wires to certain values.

* Your motherboard directs that signal to the attached device, because the drivers/firmware know which ones to write to. It’s now back in hardware land.

* The device receives the electric signal. That signal can be fed to a device that does something from the digital signal. A PWM, for example, can use a digital signal (which is just a bunch of 0s and 1s in order) to control a motor.

It’s kind of crazy that it works as well as it does, and it’s no mystery how software acts cursed so often. Look at how stupidly complicated it is.

You are viewing 1 out of 13 answers, click here to view all answers.