The computer is composed of hardware software, hardware equivalent to the body and software equivalent to the soul, the two are complementary. Software is divided into system software and application software their relationship with the hardware is the application software is located in the outermost layer, the center is the hardware, the system software is located in the middle.
There are many types of system software, but the two most important are the operating system and the compiler program.
Operating system functions: 1. Handling basic input and output operations 2. Allocating memory and external memory 3. Providing shared resources for multiple applications compiling system is to translate the high-level language (Java, C, etc.) into the machine language that the hardware can recognize to help us connect with the computer
Hardware is composed of input, output (IO device), memory, arithmetic, controller five parts of which the operator, the controller is inside the processor is the core of the computer, the entire computer executes the instructions are controlled by it
The memory stores the data and instructions to be processed, the input, and the output is responsible for the input and output information. The five components are connected by the bus, which connects the entire system to the electronic pipe to transmit the data.
We do this by executing a HELLO.C program to understand how a computer runs a program.
First, the HELLO.C source program is:
#include <stdio.h>
int main () {
printf ("Hello, world\n");
}
It is through the keyboard this IO device input this program and through the ASCII standard to convert the letter into a single-byte integer representation of the word characters in the disk. The translation is then translated into a binary number that the machine can recognize by compiling the program. Go through the preprocessor and start with the # command
Read the system header file stdio.h insert it into the text to get the C program with the extension of the file I
After the compiler to translate it into assembly language it is the text representation of machine code, through the assembly language human can observe the machine code in close range, then generate HELLO.I source program.
The source program that generates HELLO.O after the assembler translates into machine instructions
Finally, the printf function is called through the linker, which is a function in the standard C library, which has been precompiled so that the PRINT.O is merged directly into the HELLO.O program and eventually the target program Hello it can be executed in memory
Hello is still in the disk by running Hello when the file is copied into main memory and then the processor can call it to generate "Hello,world \ n" placed in the register file. The final copy is copied from the register to and output on the screen.
From the execution process to see that the system spends most of the time moving files, and in the process of moving files on the disk to main memory on both sides read speed is not the same main memory read file speed is 100w times the disk, and register is 100 times times the main memory. And the fast equipment can not be consumed in the long wait process so there is
The cached concept of fast devices can be ignored when a slow device transmits files to the cache after a certain amount of data is taken directly from the cache, during which time it can do its own thing
As if the hello file is running at the same time that the computer is just a program service, it is running with other programs running, except that the computer runs through the process, so that only one process runs per CPU time. When you switch to another process, the system
Keep track of its context status and switch back to maintain this context so that you can perform tasks that are not finished (I wrote it for the first time, so I didn't write well)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service