Reklama

The core of the system. Privileged mode and user mode

Mechanisms and policies

In OS, you first need to identify a set of fundamental features, that provide its components; these basic features constitute the mechanism (mechanism). On the other hand, you must make a decision regarding the use of above possibilities; such decisions determine the policy (policy). So, the mechanism shows, which is implemented by the component, and policy — how to use it. When the implementation of mechanism and policies respond to different components (mechanism separate from policy), simplified development of the system and increases its flexibility. Components, implementing mechanism, should be available information about the cause and purpose of its use; all, what you need from them, — to perform the intended work. For such component use the term "free from politics" (policy-free). Components, responsible for policy, must operate free from her components as building blocks, for information is available about the implementation details of the mechanism.

 An example of the separation of mechanism from policy is the management data input / output. The basic mechanisms of access to peripheral device drivers implement. Policy on the use of these mechanisms specifies the software, performs I / o.

The core of the system. Privileged mode and user mode

The basic components of the OS, responsible for critical it functions, usually found in pam’s memory and are executed in privileged mode, is called the kernel of the operating system (operating system kernel). The existing approaches to the design of the architecture of the OS take different approaches to core functionality. The most important functions of the OS, which usually lay at the core of, include interrupt handling, the office pam’s memory, control I / o. The reliability and performance of core sets higher requirements.

The main characteristic of a kernel is, it runs in privileged mode. Consider the features of this mode. To ensure effective resource management comp’s computer OS must have certain privileges in respect of applications. Need, to the application program did not interfere in the work of Los, and at the same time, the OS must be able to intervene in any program, for example to switch the CPU or rozw’s'asana of the conflict in the struggle for resources. For the implementation of such privileges need hardware support: the processor must support at least two modes of operation - preferred (protected mode, the kernel-mode, kernel mode) and user mode (user mode). In user mode invalid command, which are critical for the operation of the system (task switching, turning to pam’memory for the given limits, device access I / o, etc).

Consider, how are different modes of the processor during the interaction between the kernel and applications. After loading the kernel switches the CPU into privileged mode and has full control over the computer’'yuterom. Each application starts and runs in user mode, where it has no access to kernel and other programs. When you need to perform an action, implemented in the kernel, the application makes a system call (system call). The kernel intercepts it, switches the CPU into privileged mode, performs the action, switches the processor back to user mode and returns the result of applying.

The system call is slower than a function call, implemented in user mode, due to the fact that twice the processor switches between modes. To improve performance in some part of the OS functionality implemented in user mode, so to access it, the system calls are not needed..

Reklama