Programming Thread

Viewing single post

Started by the-pi-guy, Mar 13, 2016, 10:39 PM

previous topic - next topic

the-pi-guy

It's really crazy all the things that an OS does.  

Basically every time period, the OS basically does a "context switch", the OS gets reloaded into the computer many, many times a second.  
Learning about the program counter in a few different classes.  Like the computer stores what line of code it is reading.  

It just feels so weird to think about with how nice OS's are, that basically every second, every program stops running for a very tiny portion of time, gets switched to something else, and back again before anyone notices.  

This semester seems like a lot of obvious things that still seem weird to think about.  Like it's obvious the OS has to work that way, but then it seems crazy at the same time.  

Another thing that is obvious, but just seems so counter to experience, is that programming languages vary from compiler and OS.  

Usually you work in 1 compiler, 1 OS, so you don't notice these things all the time.  
But it's just weird sometimes how little things can completely wreck your program on someone else's computer.  (Obvious.)  

Like this:
for(int i=0; i<20; i++)

Works perfectly fine on my computer at home on a Linux OS.  It doesn't work on the school computers.  Instead this does:
int i;
for(i=0; i<20; i++)