Operating System Basic Concepts

  Command interpreter: Some operating systems include a command interpreter in their kernel section. Treat the command interpreter as a special program that is executed when a task starts or when the user logs in for the first time (time-sharing system).

  System call: Provides an effective service interface provided by the operating system. These interfaces are usually written in C or C++, although, of course, low-level tasks (such as hardware that must be accessed) may be provided in the form of assembly language instructions.

  An API is a series of functions intended for application programmers, including the parameters passed to each function and the values ​​they return as desired by the programmer. There are three APIs commonly used by application programmers: the Win32 API for Windows systems, the POSIX API for POSIX systems (including almost all versions of UNIX, Linux, and Mac OS X), and the Java API for designing programs that run on the Java virtual machine API.

One of the benefits of API programming is program portability. An application programmer who designs a program with an API expects his program to be compiled and executed on any system that supports the same API (despite the fact that different systems often use its difficult). Besides, the actual system calls are more detail-oriented and difficult for an application programmer than the API. However, there is often a strong connection between calling a function in an API and its associated kernel system call.

  There are three ways to pass parameters to the operating system: The simplest is to pass parameters through registers. Sometimes, however, there are more parameters than registers. At this time, these parameters are usually stored in memory blocks and tables, and the address of the block is passed through registers. Linux and Solaris take this approach.
  Parameters can also be put or pushed on the stack by the program and popped by the operating system. Some operating systems use the block or stack method because these methods do not limit the number or length of parameters passed.
 
  Microprocessors can provide a CPU mode called single-step, which executes a trap after each instruction runs. This trap is typically used by debuggers.
 
  File system: If a directory structure is used to organize files within a file system, the same operation is required for directories. In addition, whether it is a file or a directory, it needs to be able to determine its properties, or set its properties. File attributes include file name, file type, protection mode, accounting information, etc.

  Device management: Different resources controlled by the operating system can be treated as devices, some of which are physical devices and others as abstract or virtual devices. If the system has multiple users, then the user must request the device to be able to use it. After using the device, the user needs to release it.
  There are also operating systems that allow unmanaged device access, with the danger of potential device contention and possible deadlocks.

  Information maintenance: Many system calls are simply used to pass information between the user program and the operating system. In addition, the operating system maintains information about all processes, and some system calls can access this information. In general, there are also system calls used to set process information.

  Communication: There are two communication models: message passing model and shared memory model.
  Message Passing Model: Communicating processes exchange messages by exchanging messages with each other. Messages can be exchanged between processes, either directly or indirectly through a common mailbox.
  Shared memory model: Processes use the shared memory create and shared memory attach system calls to gain access to memory regions owned by other processes.

  Relocation: Relocation is the process of transforming the logical address space of the program into the actual physical address space in the memory, that is, the process of modifying the instructions and data in the target program when loading. It is the basis for realizing multiple programs running simultaneously in memory. There are two types of relocation, dynamic relocation and static relocation.
 
  Mechanism: how to work
  Strategy: what will be done
 
  OS Structure:
  Simple Structure: Smaller, simple, and feature-limited systems (MS-DOS) that don't distinguish well between interface and feature hierarchies.
  UNIX Layering: All parts above the physical hardware and below the system call interface act as the kernel. The kernel makes system calls to provide file system, CPU scheduling, memory management and other operating system functions. A lot of functions are combined in this layer. But this monolithic structure makes UNIX hard to enhance.
  There are many methods for system modularization. One is the layered method, that is, the operating system is divided into several layers. The bottom layer is the hardware, and the top layer is the user interface.
  The operating system layer can be implemented as an abstract object that includes data and operations to manipulate that data.
  The main advantage of the layered approach is the simplicity of construction and debugging. Each layer can only utilize the functions and services of the lower layers. This approach simplifies debugging and system verification. Debugging determines at which level the error occurs. Each layer hides the existence of certain data structures, operations and hardware from higher layers.
  The main difficulty with layering involves the detailed definition of layers, since a layer can only use the lower layers below it.
  The last problem is that it is slightly less efficient compared to other methods.
  Microkernel: Mach operating system, which uses microkernel technology to modularize the kernel. This approach removes all non-essential parts from the kernel, usually a microkernel includes minimal process and memory management and communication functions.
  The main function of the microkernel is to enable communication between client programs and various services running on user controls.
  One of the benefits of a microkernel is that it is easy to extend the operating system. All new services can be added in user control, so no kernel modification is required. Due to the small core, it is easy to port from one hardware platform design to another hardware platform design. Since the vast majority of services run as users rather than as kernel processes, microkernels also provide better security and reliability.
  However, the microkernel must endure the degradation of system performance due to the increased overhead of system functions.
  Modules: Object-oriented programming techniques to generate modular kernels. Such a design allows the kernel to provide core services and also implement specific functions dynamically. For example, specific hardware device and bus drivers can be loaded into the kernel, and support for various file systems can be added as loadable modules. This approach is similar to a microkernel, where core modules only have core functionality and information about how other modules are loaded and communicated. But this approach is more efficient because modules do not need to invoke message passing to communicate.

reference《Operating System Concepts》

Guess you like

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