轻量化工艺是什么意思?
线程是轻量级进程,这意味着什么?
Threads are light weight processes, what does it mean?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
线程是轻量级进程,这意味着什么?
Threads are light weight processes, what does it mean?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
根据维基百科的定义,一些资源(例如内存)可以在线程之间共享。
希望对你有帮助。
According to Wikipedia's definition some resources like memory can be shared between threads.
Hope this will help you.
这意味着在许多操作系统中创建和维护进程是一项相对较大的工作量,主要是因为每个进程都有自己的地址空间。 进程内的线程共享它们的地址空间,因此创建大量短期线程比创建相同数量的进程占用的资源要少得多。
例如,早期基于 CGI 的 Web 应用程序会让 Web 服务器创建一个单独的进程来处理每个请求。 但这样的应用程序无法处理太多负载,每秒几十个请求就会让它们不堪重负(这是在 90 年代末,在速度慢得多的硬件上也是如此)。 使用线程处理单个请求的 Web 应用程序(例如基于 Java Servlet 的 Web 应用程序)的可扩展性要高得多 - 即使在那时,在相对较慢的 JVM 上运行的 Servlet 应用程序也很容易胜过用 C 编写的传统 CGI 应用程序,因为进程创建开销超过了C 的速度优势。
在 Wikipedia< 上了解更多相关信息< /a>.
It means that creating and maintaining a process is a relatively large amount of work in many operating systems, primarily because each process has its own address space. Threads within a process share their address space, and therefore creating lots of short-lived threads is much less resource-intensive than creating an equal number of processes would be.
For example, early CGI-based web applications would have the web server create a separate process to handle each request. But such applications couldn't handle much load, a few dozen requests per second would overwhelm them (this being in the late 90s, on much slower hardware as well). Web applications that use threads to handle individual requests, such as those based on Java Servlets, are much more scalable - Even back then, Servlet apps running on comparatively slow JVMs were easily outperforming traditional CGI apps written in C, because the process creation overhead outweighted the speed advantages of C.
Read more about this on Wikipedia.
在 POSIX 的早期版本(以及 Solaris - 作为 Java 的母体平台)中,这是一种启动线程的方法。
In early version of POSIX (and Solaris - as motherland platform of Java) it was a way to start thread.
从操作系统的角度来看,它们不是进程,因为它们没有自己的内存空间,因此在创建它们的应用程序的内存空间内运行。
打个不太恰当的比喻,可以将计算机视为一个邻居,将每个独立的房屋视为一个进程,每个房屋都有管道、电话、电力、邮箱等的开销。线程更像是房屋内的房间 - 开销很小除了房屋内消耗的空间(即过程)之外,每个空间都可能用于特定的任务或活动。
They are not processes from an OS standpoint as they do not have their own memory space and therefore run within the memory space of the application that creates them.
For a somewhat bad analogy, think of a computer as a neighborhood, each individual house as a process where each house comes with the overhead of plumbing, phone, electric, mailbox, etc. Threads would be more like rooms within the house - little overhead except for the space the consume within the house (i.e. process), with the possibility of each being used for a specific task or activity.
这意味着它们缺乏成熟的系统进程的一些功能,因此也缺乏一些开销。
It means they lack some of the features, and therefore some of the overhead, of being full-fledged system processes.