1
Watch
2
Star
0
Fork
0
Issue

Operating System supports both kernel and user mode. Kernel mode allows unrestricted access to all machine resources, including all MPU instructions, and User mode operation sets limits on instruction use and typically disallows direct access to machine resources. The emerging trend is HSA(Heterogenous System Architecuture), Apple Silicon and AMD leading the ways in the road.

mikechen66
mikechen66
pushedAt 3 months ago

mikechen66/Operating-Systems

Operating System

Overview

An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for varieties of programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also include accounting software for cost allocation of processor time, mass storage, printing, and other resources.

For hardware functions such as input and output and memory allocation, the operating system acts as an intermediary between programs and the computer hardware, although the application code is usually executed directly by the hardware and frequently makes system calls to an OS function or is interrupted by it. Operating systems are found on many devices that contain a computer – from cellular phones and video game consoles to web servers and supercomputers.

The dominant general-purpose desktop operating system is Microsoft Windows with a market share of around 76.45%. macOS by Apple is in second place (17.72%), and the varieties of Linux are collectively in third place (1.73%). In the mobile sector including smartphones and tablets, Android's share is up to 72% in the year 2020. Linux, the most successful Unix-like system, are dominant in the server and supercomputing sectors. Other specialized classes of operating systems (special-purpose operating systems),such as embedded and real-time systems, exist for many applications. Security-focused operating systems also exist. Some operating systems have low system requirements (e.g. light-weight Linux distribution). Others may have higher system requirements.

Mode

Modern computers support multiple modes of operation. CPUs with this capability offer at least two modes: user mode and kernel mode. In general terms, kernel mode operation allows unrestricted access to all machine resources, including all MPU instructions. User mode operation sets limits on instruction use and typically disallows direct access to machine resources. CPUs might have other modes similar to user mode as well, such as the virtual modes in order to emulate older processor types, such as 16-bit processors on a 32-bit processors on a 64-bit one.

Kernel Mode

At power-on or reset, the system begins in kernel mode. Once an operating system kernel has been loaded and started, the boundary between user mode and kernel mode can be established. Kernel mode is used by the kernel for low level tasks that need unrestricted access to hardware, such as controlling how memory is accessed, and communicating with devices such as disk drives and video display devices.

The system starts in kernel mode when it boots and after the operating system is loaded, it executes applications in user mode. There are some privileged instructions that can only be executed in kernel mode. These are interrupt instructions, input output management etc. If the privileged instructions are executed in user mode, it is illegal and a trap is generated. The mode bit is set to 0 in the kernel mode. It is changed from 0 to 1 when switching from kernel mode to user mode.

User Mode

User mode is used for almost everything applicable. Application programs, such as word processors and database managers, operate within user mode, and can only access machine resources by turning control over to the kernel, a process which causes a switch to supervisor mode. The software interrupt causes the processor to switch from user mode to supervisor mode and begin executing code that allows the kernel to take control.

In user mode, programs usually have access to a restricted set of processor instructions, and generally cannot execute any instructions that could potentially cause disruption to the system's operation. In supervisor mode, instruction execution restrictions are typically removed, allowing the kernel unrestricted access to all machine resources.

The term "user mode resource" generally refers to one or more CPU registers, which contain information that the running program isn't allowed to alter. Attempts to alter these resources generally causes a switch to kernel mode, where the operating system can deal with the illegal operation the program was attempting, for example, by forcibly terminating ("killing") the program.

ucloud ads