"Modern Operating System" Reading Notes 2

Reprinted from: https://blog.csdn.net/ingwfj/article/details/52332615


Picked up the book "Modern Operating System" again, read it carefully, and recorded a few more experiences.

The functions or responsibilities of the operating system: manage resources downward and provide service interfaces upward. OS as middle layer software. The main contents involved in the operating system are processes and threads, file systems, deadlocks, memory management, I/O management, etc.

Processes and threads involve concepts, distinctions, categories, etc. A process is a running program with input, output and status, and is a dynamic rather than just static program. The process involves the life cycle of its running, blocking and ready. In fact, many programs have life cycles, such as the life cycle of objects in many frameworks of java, such as the life cycle of objects in spring, and the life cycle of requests in structs. The important concept in the process is the process table, which is stored in the memory. Its unit is the process table entry, that is, the entry. When you see the entry, you think of the entry inner class in the collection class in java. The inner class of java is highly praised by many people and at the same time Criticized by other people, in fact, the process table is the reference of all processes in memory and those that are no longer in memory. It saves the state data of the process. To be honest, the table seems to be really powerful, and it will be seen in many places. To the wide application and great power of tables, for example, the base layer of the database is a relational database. The new NoSQL type breaks some traditions. For example, in the network, tables also play a role in storing data in a format. In real life, tables are also important. of. For threads, there are two aspects that interest me very much, one is the threading model in user space and the threading model in kernel space, different models are applied to different actual operating systems. The other is the communication and synchronization mutual exclusion mechanism between processes, involving concepts such as interrupt mechanism, busy waiting, primitives, producer-consumer model, PV operation, mutex, monitor, barrier and so on. There are also processes that need scheduling algorithms for scheduling, because memory resources are limited and in order to maximize operating efficiency and maximize the use of CPU, there are many scheduling algorithms, such as first come first serve algorithm, shortest job priority, shortest remaining time priority, lottery scheduling Wait. The Dining Philosophers Problem and the Reader-Writer Problem are also well documented. There is also the difference between mutual exclusion and synchronization of processes, blocking and non-blocking, synchronization and asynchrony, I have been looking for a long time to understand.

The difference between process blocking and non-blocking: http://www.zhihu.com/question/19732473

Mutual exclusion and synchronization of processes: http://blog.chinaunix.net/uid-26748613-id-3201137.html

Process synchronization and asynchrony: http://blog.sina.com.cn/s/blog_8c0c9acd0101cp3u.html

In terms of memory management, it involves issues such as virtual memory mechanism, MMU, TLB, paging and segmentation mechanism, and page replacement algorithm. I have deeply realized two points from this chapter: First, the problem is full of contradictions, and there is often no final answer. The most important process of analysis is to propose a plan to analyze the aspects involved, its advantages and disadvantages, and there are There are many solutions but no perfect solution, just like there is no silver bullet. Contradiction in philosophy is a core and the basis of some of its theoretical support. In reality, contradictions occur all the time; second, in operating systems, processes/threads are abstractions of actual CPUs, and address spaces are related to physical memory. Abstraction, file is an abstraction of physical memory, and I/O stream is an abstraction of hardware input and output devices. Abstraction and simulation have always been my core understanding of computers, networks, operating systems, languages, etc. After abstraction, I need to add, delete, modify, check, manage, optimize algorithms, etc. The entire operating system is about these things.

The file system involves disk, disk management, file system storage mode, cache and so on. The file system is connected to the data structure to learn the knowledge of data structures such as B-tree, B+ tree, B* tree.

I/O processing, including interrupt processing system, device driver, device-independent I/O software, user-level I/O software and other software content and I/O hardware such as DMA, device driver, device control, etc. A big feeling is that there are address registers, count registers, and control registers in the DMA controller. DMA can access the bus independently, can perform storage, can perform control, and cannot perform calculations. Isn't this equivalent to a reduced version of the CPU? He does offload some of the CPU's work so that the CPU can do other work to increase its utilization. Interrupt plays a key role in this. The interrupt controller belongs to the knowledge of computer system structure, but it plays the role of interrupt acceptance, queuing, and shielding.

Deadlock should be the most exciting aspect, because there are many algorithms in it. In order to avoid deadlock, set safe state and non-safe state, use multi-dimensional trajectory route algorithm, use banker's algorithm, and create a method to break deadlock situation, of course, the book admits that there is no way to avoid deadlock, because the process is dynamic, The required resources are unpredictable, and the availability of resources is uncertain. I prefer algorithm research, so it's exciting.


In a word, the operating system is a management software. It is very similar to a company. The employees of the company are hardware resources, and the system of the company is this system, but what is the system for? In order to effectively allocate personnel, in order to improve efficiency. The same is true for the operating system, in order to manage resources, to maximize efficiency, and to provide interfaces for application software. It is a platform, the foundation of software, and an advanced concept.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324845674&siteId=291194637