The main functions of the operating system

The main functions of the operating system

1. Process management

Process is the basic unit of program resource allocation and independent operation. Based on the process, multiple programs can be executed concurrently, but the scheduling overhead of the process is large. Therefore, a thread is introduced. A thread is a smaller unit than a process and basically does not own system resources. .

The so-called resources refer to the computing resources of the CPU, the temporary storage resources of the memory, and other IO resources.

Process implementation concurrency means that a thread is created for each program

  1. Under hardware conditions, computing programs and IO programs can be parallelized
  2. The principle of "multi-channel batch system", multiple programs are loaded in the memory, when program A enters slow IO, the system scheduler B uses the CPU to achieve concurrency at such intervals

Usually, the process is regarded as the basic unit of resource allocation, and the thread is regarded as the basic unit of independent operation and independent scheduling.

The process management of the operating system refers to the management of processes and threads.

  • create and destroy
  • Sharing and synchronization of resources
  • interprocess communication
  • schedule

2. Memory management

1. Memory allocation

Allocate memory space for a process, including reclamation functions.

2. Memory protection

Program A can only run in its own memory and cannot access program B's memory data.

3. Address mapping

To load multiple programs into memory, some addresses are calculated relative to the starting address, that is, the logical address, and it is necessary to map the logical address and the physical address.

4. Memory expansion

With the help of virtual storage technology, the memory capacity can be logically expanded. You can start the program by loading only a part of the program and data. If you need the rest, you can read it from the disk. When the memory is not enough, the system can transfer some unused programs and data to the disk.

3. Equipment management

Device management refers to managing all peripheral devices of the computer and processing IO requests of processes.

1. Buffer management

The high speed of the CPU and the low speed of IO are a contradiction of the computer itself. The program runs extremely fast in the CPU, but once IO is required, the overall speed will be slowed down, and the utilization rate of the CPU will be reduced.

So the OS sets up buffers in memory.

2. Equipment allocation

For the IO request of the process, the operating system needs to set up data structures such as the device control table and the controller control table to manage device resources.

3. Equipment handling

Device handlers are also known as device drivers.

Its basic task is to implement the communication between the CPU and the device controller.

When the program is running in the CPU, if IO is required, the CPU sends an IO request to the driver, the driver checks the validity of the request, parameters, etc., and checks whether the device is available, and then sends an IO command to the device controller to start the device to complete the specified. IO operations. The device controller can also issue an interrupt request to the driver, at which time the driver will call the corresponding interrupt handler.

4. File Management

Refers to the storage, reading and writing of files.

Guess you like

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