How to understand the operating system? (Operator System)

1. What is an operating system

Preconceived, the operating system is a management software

The operating system is divided into two parts

  • The operating system itself mainly does some work such as process management, memory management, file management, and driver management . This core part is called the kernel.
  • user interface, the way a computer interacts with a user

2. The layered structure of the operating system

insert image description here

  • The underlying hardware is connected by a bus using a von Neumann organizational structure

  • To match all the hardware with the operating system, there needs to be a corresponding driver.
    For example, when the mouse we use, when the mouse is plugged into the computer, it may take a second or two. During this time period, the driver required by the mouse is loaded.

  • In the middle, the operating system plays a linking role.
    With the operating system, it can help users manage the following hardware and software resources, and provide users with a good (safe, stable, and efficient) operation link.

The users here do not actually refer to the vast number of ordinary users. The various software used by ordinary users does not use the operating system in the true sense. These software are all developed by programmers. Therefore, programmers must have a good development environment in order to develop various excellent software on this basis.

  • However, the operating system does not trust any users (including developers), but in order to provide services to users, it provides the user with an interface to obtain internal data. This method becomes a system call, and all access to the operating system can only be done through system calls .

    • Do banks trust users? The answer is no trust. Armed escorts, monitoring without dead ends, and safes are used when transporting currency. These must ensure the safety of the bank
    • But if the bank is completely closed, how to provide users with deposit and withdrawal services?
    • Therefore, a small window is opened at the counter. When depositing and withdrawing money, the small window of the counter is used to provide services for users.
    • The same is true for the corresponding operating system. Users are not trusted to prevent users from maliciously tampering with data, so users will not be allowed to directly access the data in it. However, in order not to hinder the provision of services for users, some interfaces are provided for users to call and access. This not only ensures the security of the operating system, but also provides users with services that meet their needs.
  • System calls are not so easy for users, so there is shella shell, a command line interface provided by the operating system for users to interact with the operating system. It is a command interpreter that can interpret and execute commands entered by the user, and communicate with the operating system (it can be understood as a matchmaker).

In addition shell, the operating system also has some libraries, which encapsulate the system call interface (C standard library, math library, network library), which is more convenient for users to call

3. How to manage the operating system

For example:

In a university, who are the administrators? Without a doubt - Principal

So who is the manager? student

But is it the principal who picks up our students every time? That's not true, maybe you won't see the principal once or twice in four years of university

Then we can't even see the manager, and we can still be managed, which shows that the manager and the managed do not necessarily need to meet

So how did the principal manage us without meeting? In fact, the principal only needs to get the data of our students to know, such as the grades of the students, whether they have violated the school discipline and rules, whether they have been commended, etc., and can understand all aspects of the students, so as to manage the students. Sometimes we organize interviews and sit in a conference room to chat, but is this a real chat? In essence, the data is still obtained through chat: how are you doing recently, whether you have any difficulties in learning, whether you have any opinions, etc., these are all information obtained through chat

Therefore, as long as managers can manage the information, they can make decisions through the information, so as to achieve the management of people.

The manager and the managed do not meet, so how to get the data? This is generally through the counselor to obtain the data of students of various majors

Are the counselors here considered managers? The difference between the manager and the managed is that one makes decisions and the other executes decisions

And counselors only implement the principal's decision-making, and do more at the executive level, so they are not managers in the true sense

In this system, the principal is equivalent to the operating system, the counselor is equivalent to the driver, and the students are equivalent to hardware and software resources. The operating system
manages by obtaining the status data of the hardware, which is collected by the driver and then handed over to the operating system.

Manager (decision-making)——principal——operating system
Executor————counselor——
driver Managed————student——software and hardware resources

But in a university with tens of thousands of students, the counselors aggregate the data to the principal. Faced with a large amount of data, it is definitely difficult for the principal to analyze the data.

Assuming that the principal understands technology, now describe the various information of the students: college, student number, name, gender, major, grades, etc.

struct student
{
    
    
	char faculty[];	//	院系
	char stu_num[];	//	学号
	char name[];	//	姓名
	char gender[];	//	性别
	char major[];	//	专业
	char garde[];	//	成绩
	struct sturdent* next;
};

In this way, we get structure nodes describing student information one by one, so as to get the student information linked list, and manage the linked list structure well. If you want to find the best score, you only need to call the supporting method of counting scores. This turns the management work of students into adding, deleting, modifying and checking the linked list

The same is true for the operating system. Managing any hardware and software resource objects can eventually be converted into adding, deleting, checking, and modifying a certain data structure.

Although the principal can process these data, he can also issue instructions to the counselor. For example, if a student violates the school rules and needs to be expelled, then he can tell the counselor that one of your students has been expelled, and then the counselor will notify the student. The principal only needs to delete the student’s information from the linked list;

The above-mentioned processes are to describe the objects first, and then organize them . This runs through the entire programming process. C++/Java/PythonThese high-level languages ​​are all object-oriented programming. To write a student information management system, you must first define a class, and then use a certain data structure to organize these objects. It’s just that most of these languages ​​​​have already completed this process for us, for C++example stl.

Let’s sum it up through these: six words – describe first, organize

  1. The manager and the managed do not necessarily have to interact
  2. To manage, just get the data
  3. Describe the data and then organize it (add, delete, check and modify the data structure)
  4. The operating system describes software and hardware devices one by one, and each device has a corresponding structure, which adopts a certain data structure organization according to its attributes, so there are bound to be a large number of data structures in the operating system

This is the end of this article, the code text is not easy, please support me a lot! !

Guess you like

Origin blog.csdn.net/weixin_67401157/article/details/131751166