用于线程化的用户级线程 [英] User-level threads for threading

查看:40
本文介绍了用于线程化的用户级线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 Tanenbaum OS 书中提到了以下内容:

From the Tanenbaum OS book it is mentioned the following:

在用户级线程中,如果一个线程开始运行,则该进程中的其他线程将永远不会运行,除非第一个线程自愿放弃 CPU".

"in user level threads, if a thread starts running, no other thread in that process will ever run unless the first thread voluntarily gives up the CPU".

这意味着线程将一个接一个地(顺序地)非并行地运行.那么用户级线程有什么优势呢?

That means threads are going to run one after the other (sequently) not in parallel. So what is the advantage of the user-level threads?

推荐答案

在单进程多线程环境中多任务有两个概念.

There are two concepts of multitasking in a single process multiple thread environment.

  1. 单个线程在进程的时间片内执行.该线程负责其他线程的调度.
  2. 操作系统采用进程线程的调度决策,并可能在不同的内核上并行运行它们.

你说的是方法一.是的,它没有多线程的优势;但它让许多线程/程序一个接一个运行,并为您提供多任务"(几乎).

You are talking about approach 1. Yes It has no advantage of multi-threading; but it let many threads / programs run one by one and give you "multitasking" (virtually).

这篇关于用于线程化的用户级线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆