I graduated from civil engineering 2 years ago, but I have been working as a programmer for 2 years.
While two years as a programmer, I was tough because I didn't have any knowledge about basic computer science.
However, now I can describe some basic principles like program, variable, Object-Oriented Programming also something else.
So I wanna post this article for a non-computer-science major or junior programmer. I'm confident it will be helpful enough.
What is the Program? And What is the Programming?
All We're programming. But It's not easy to describe what the program is.
Although We can build a cool application, we have to know things that we do correctly.
The program means allocating value or command in memory
For example, if you execute some program and it allocates values 1, 2, and command add to memory, We can call it program.
I talk that memory includes values and commands, if the program is executed, commands in memory will be run sequentially.
And if any command does not exist, the program will be terminated.
The commands list execute through CPU's element like ALU(Arithmetic Logic Unit), Data-Unit, and Control Unit. All commands go to ALU to process, and values go to data-unit. Generally, ALU executes with values in the data unit. After executing commands, return a result to memory again.
Here is a simple flow.
This flow consists of loading, instruction fetch, execute. Loading means the works that allocate the commands and values, and Instruction fetch means the works that move the commands to each unit. And it is called "Von Neumann architecture."
In conclusion, the program is to loop the above procedure.
Compile Program and Script program Runtime.
In Computer Program, There are two different types as a Compile program and a script program.
Each Program has each process like here.
Compile Program Lifecycle.
1. Language Code: Lint Time
Point of time to discover errors before compiling.
2. Machine Language: Compile Time
3. File
4. Load
The work uploaded a file on memory. Generally, It's a program from here. All programs must wait to execute and be sure to load on the main memory.
5. Run: Run Time
6. Terminate
Script Program Lifecycle.
1. Language Code: Lint Time
2. File
3. Load
4. Machine Language
5. Run: Run Time
The script program loads memory without compile and translates machine language every loads
6. Terminate
This is the difference in the overall process. But there are more differences between compile and script about runtime.
The below image describes the runtime for compile programs.
Compile programs runtime
Essential Definition Loading
There is the process to load the most fundamental variables and functions for running programs.
V-table Mapping
In this process, when variable names writing codes actually get a memory, make a mapping table for between virtual memories and physical memory.
Run
In this time, run the program using variable spaces and basic definitions.
Runtime Definition Loading
In this process, While the program is running, it can load other definitions. For example, It can define more classes or methods in runtime. So the program can do load necessary definitions, and later, the others would do the lazy load. This process isn't all compile programs.
It's done.
And Let's see script program runtime.
Script programs runtime
While the compile language has a variety of processes, the script language repeats only two processes.
In static time, A program loads based functions, classes, and others to memory. And in runtime, the program uses it.
For example, When In static time, main function loaded, and run it in run time. If it contains jquery during execution, the program changes static time again. It shows it can be divided relatively by dependent load on runtime.
Finally
So far, we have seen how our code behaves by the program.
Commands and variables load on the memory, and the CPU should run commands on memory. There are two types of runtime. Each runtime is executed in another way. If there are no commands, the program will be finished. That's it. I wanna that It's helpful for you.