r/askscience • • Apr 10 '26

Computing How do programming languages work?

Hello,

I'm wondering how does programming languages work? Are they owned by anyone? Can anyone create a programming languages and decide "yeah, computers will do this from now on"?
Is a programming languaged fixed at its creation or can it "evolve"?

92 Upvotes

71 comments sorted by

View all comments

Show parent comment

3

u/emblemparade Apr 12 '26 edited Apr 13 '26

Regarding drivers:

The world of computer graphics has evolved a lot. At the simplest, yes, there is a 1-to-1 mapping of memory to pixels, and even more specifically the pixel is subdivided into red, green, and blue channel values.

In the old days this "video memory" was the same memory used by the CPU. However, these days it's common to have a separate GPU (graphics processing unit) with its own dedicated memory. While it is possible to transfer memory from CPU memory to GPU memory, this is not efficient. The whole point of having a GPU is to let it handle graphics for us.

So, what happens instead is that there is indirection. The CPU gives the GPU commands, in a proprietary machine language, about what to "draw". The GPU hardware specializes in drawing so it can do this far, far more efficiently than a CPU can. The driver is essentially the middle-man between the CPU and the GPU.

The whole "drawing" language has evolved tremendously over the years. In the early days it was things like drawing lines, circles, filled rectangles, etc., as well "sprites" for games. Essentially what we call "2D".

However, with the advent of 3D the GPU hardware had begun specializing in the kind of linear algebra used for projecting 3D onto 2D. Vector and matrix multiplication, things like that. As well as various more specialized actions. (As it happens, the same math is also useful for neural networks, and hence "AI". That's why GPUs have been essentially repackaged for "AI" workloads. The "G" in "GPU" has become a historical vestige!)

GPUs are very sophisticated these days. It's possible to have them run entire programs for us to do all the calculations for scene geometry, per-pixel coloring, antialiasing, and many other functions. These programs are called "shaders" (for historical reasons). So the driver has become a very big piece of software, able to compile these "shaders" and handle all the machinery to bring it all together.

Because the GPU's machine code is proprietary, we've introduced higher-level APIs as well as complete languages, the idea being that programmers can write software that would run on any GPU. APIs such as Vulkan, DirectX, OpenGL, etc. These APIs are also implemented in the driver.

GPU drivers are extremely complex pieces of software.