What does the 1-1 operating system do?

Source: Internet
Author: User

For example, a C program HelloWorld the process of execution.

#include <stdio.h>int main (int Argc,char *argv[]) {puts{("Hello World");     return 0; }

The first step:

User: Tell the operating system to execute Hello World program (how to Tell?) )

It could be command-line execution, double-clicking the icon, and so on.

Step Two:

1, operating system: Find the Hello World program information, check whether the type is an executable file, and through the program header information to determine the location of the code and data in the execution file and calculate the corresponding disk block address (file format?). )

Windows (PE format) Linux (elf format)

2. Operating system: Create a new process and map the Hello World execution file to the process structure, which represents the execution of the Hello World program by the process.

3. Operating system: Set the CPU context for the Hello World program and jump to the beginning of the program (assuming the scheduler selects the Hello World program)

4, the execution of the first instruction of the HelloWorld program, a missing pages exception (fault: is the code to read into the memory, but the code is still on the disk, not read into memory)

5, operating system: Allocate a page of physical memory, and read the code from disk into memory, and then continue to execute the HelloWorld program (may have multiple page faults, will allocate multiple pages of memory, write memory from disk)

Step Three:

1, Hello World process execute puts function (System call), write a string on the monitor

2. Operating system: Find the display device to send the string to, usually the device is controlled by a process, so the operating system will write a string to the process

3, operating system: The process of controlling the device tells the device the window system he wants to display the string, the window system determines that this is a legitimate operation, and then converts the string to the imager, writes the pixels to the device's storage image area

4. Video hardware converts pixels into a set of control data signals that the monitor can receive
The monitor interprets the signal, excites the LCD, and we see "HelloWorld" on the screen.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/BC/wKiom1W8UVuR3yniAALa4X87Sf4533.jpg "title=" What did the operating system do?. jpg "alt=" wkiom1w8uvur3yniaala4x87sf4533.jpg "/>


This article is from the "Shohai" blog, make sure to keep this source http://eveday.blog.51cto.com/10577430/1680775

What does the 1-1 operating system do?

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.