What a PLC is, for people arriving from software
An industrial computer with an unusual execution model, and the constraints that explain every design decision in it.
By the LADX engineering team
Short answer
A programmable logic controller is an industrial computer that runs one program in an endless loop, reading inputs and writing outputs on a fixed cycle, with no operating system scheduling in the way. It is built for determinism and for twenty years of uninterrupted operation, which explains almost every difference from a general-purpose computer.
If you arrive from software, the strange part is not the languages. It is the execution model.
One program, forever
There is no process list. One program runs, in a loop, from the moment the controller is switched to RUN until it is switched out. Read inputs, solve, write outputs, repeat.
No scheduler decides when it runs. Nothing preempts it. The loop is the whole system.
Why determinism is the point
A general-purpose computer optimises for average throughput. A controller optimises for predictable worst case, because a machine that is usually fast enough is a machine that occasionally is not, and occasionally is where the injuries are.
Twenty years, not three
A controller specified today may still be running in 2046. That shapes everything: available spares, backward compatibility, conservative firmware, and a strong preference for boring technology.
This is also why the industry moves slowly, which looks like inertia from outside and is mostly a rational response to the cost of being wrong.
What surprises software engineers most
There are no threads, memory is often statically allocated, recursion is frequently prohibited, and dynamic allocation is avoided entirely. All of these are deliberate: each one removes a source of non-determinism.
Sources and further reading
- Programmable logic controller (Wikipedia)en.wikipedia.org
- Real-time computing and determinism (Wikipedia)en.wikipedia.org
Common questions
- What makes a PLC different from a normal computer?
- Determinism and lifespan. A PLC runs one program on a fixed cycle with no operating system deciding when it gets CPU time, so the timing is predictable. It is also built to run for decades in heat, vibration and electrical noise, with I/O rated for industrial voltages.
- Do PLCs have an operating system?
- They have firmware that manages the scan cycle, I/O and communications, but not a general-purpose operating system with a scheduler competing for CPU. That absence is the point: nothing preempts the control program, so its timing can be relied on.
Keep reading
- Fundamentals
PLC or microcontroller: what actually decides it
An Arduino can switch a relay for a fraction of the price, and the reasons to buy a PLC anyway are mostly not technical.
- Practice
PLC interview questions and answers: what interviewers listen for
Twenty-five PLC interview questions grouped by level, each with a model answer, the reasoning the interviewer is listening for, and the answer that loses marks.
- Fundamentals
How a virtual PLC works: inside one scan
The mechanism of a software PLC, from the input image to the watchdog: the scan clock, catch-up in a throttled browser tab, tasks, RETAIN, warm and cold restart, and fault codes, with the real numbers from the LADV runtime.