Just as little experiment, as a part of a larger journey to try to understand how computers work, I started to learn the programming language C on my free time. I have only ever studied Japanese, linguistics and didactics… For a few months now, I have been able to make a program that prints various stuff on the screen using the commonly known function printf. This, of course, didn’t satisfy me at all, since this doesn’t tell me how the displaying of characters on my screen is actually happening. To make a somewhat forced comparison, I’m using a toaster to toast a slice of bread, but I have no idea how the heating strings inside the toaster become hot. In order to understand “the toaster”, I tried to dig up a piece of the source code responsible for making “my bread crispy and delicious”. Well…

Can something be DISHEARTENING and fun at the same time?

  • FrederikNJS ( FrederikNJS@piefed.zip ) 
    link
    fedilink
    English
    arrow-up
    7
    ·
    4 months ago

    This is basically a study in layers of abstraction.

    At the very fundamental layer you just have a semi-conductor… Special sand that can either allow electricity to pass, or block electricity…

    Then when you arrange multiple of these semi conductors in special ways, you get logic gates.

    When you arrange the logic gates in special ways you can make more complex operations that can essentially do math with the electric signals.

    Then you introduce even more of there bits to be able to perform many different instructions, and some form of memory that can store instructions and execute then in sequence.

    With the right set of instructions you now have what is know as a “Turing machine”. Essentially a super basic computer that understands machine code.

    You extend the list of instructions and, and you arrive at Assembly.

    Then you decide to make a simpler more human readable language and write the assembly to translate this language to Assembly, this is basically C with a compiler.

    Then you start building languages with higher and higher levels of abstraction to make them easier for humans to express their intentions with.

    If you want to start at the very bottom layer and try to build some of those abstraction layers yourself to understand what’s going on. I can warmly recommend trying out https://www.nandgame.com/

  • Arghblarg ( Arghblarg@lemmy.ca ) 
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    Don’t give up, OP. It can be very rewarding to know how basic things in the C standard library such as printf() work, at a lower level.

    The hardest concept when I first learned C, so many many years ago, was pointers. But understanding memory access at the low level opens up insights into computer architecture in a very powerful manner.

    Sadly computers these days are very, very complex and modern operating systems and ‘frameworks’ abstract away the inner workings to such a high level that it can be hard to understand. If you really want to learn the fundamentals it might actually be a good (and fun!) exercise to work on a small microcontroller project (such as the Atmel AVR series) or an 8 or 16-bit retro system. If you don’t have real hardware it can be done via emulation.

    Just my opinion, but: don’t study x86 CPU architecture until you’ve looked at others like the 6502, z80 or 68000, or I suppose ARM). Though, they’ll probably ruin you for x86 since it’s the ugliest and most confusing of the bunch, yet ironically won the “CPU wars” years ago.