Operating System-Thread (4) scheduling activation mechanism (Scheduler Activations) and scheduler Thread

Source: Internet
Author: User

Operating System-Thread (4) scheduling activation mechanism (Scheduler Activations) and scheduler Thread

This article describes the scheduling activation mechanism of threads. The main content is as follows:

I. Introduction to scheduling activation mechanism

The previous article elaborated in detail the implementation of threads in user space and kernel space, each having its own advantages and disadvantages. kernel threads are flexible in all aspects, but they are too slow and performance is not high, requests are often transmitted in the user space and kernel space. So how can we improve the performance while having the flexibility of the kernel space thread. This is what the Scheduler Activations mechanism should do.

The main purpose of this mechanism is to simulate the threads in the kernel space (in terms of flexibility) in the user space, so that when a user thread in a process is blocked (for example, a page exception occurs, the entire process will not be blocked. Other user threads in the process can continue to run (similar to kernel threads ).

When the Scheduler Activations mechanism is enabled, the kernel allocates a certain number of CPUs to each process (it may be virtual. If it is a multi-core system, it may be a real CPU ). In this way, the running-time system of each process can allocate these CPUs to its own thread (user-space threads.

It can be seen that under this mechanism, the process is still single-threaded for the CPU, and the kernel still does not know how many threads the process has. As follows.

Ii. Uplink call (upcall)

The above explains how to implement the scheduling activation mechanism and how to allocate cpu to your thread during runtime. This is done through the uplink call (upcall. In the cpu, the user space is the upper layer, and the kernel is the lower layer. The general call should be the upper layer, and the lower layer should not call the upper layer. upcall refers to the user space called by the kernel.

Upcall is displayed. In addition, compared with the call of the traditional application webui and bll, upcall is nonstandard, But scheduling activation is implemented through upcall.

What did upcall do?

So far, when a user thread in a process is blocked (for example, a page exception occurs), the whole process will not be blocked, other user threads in this process can continue to run (similar to kernel threads ).

When the kernel finds that the previously blocked thread can run, it will also notify the runtime system through upcall, And the runtime system will either run the thread immediately, either put the thread flag ready into the thread table.

Iii. interrupt handling

What should I do when the hardware of a user thread is interrupted?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.