操作系统(Operating System)4

线程与进程(Process & Threads)

-Process  is an infrastructure in which execution takes place  (address space + resources)

-Thread  is a program component executing within a process context – each thread has its own execution stack

Each thread has:
    an execution state运行状态
    an execution stack
    saved thread context 
    some static storage for local variables
    access to the memory and resources of its process
简单来说就是,首先要有个对应的状态,然后要有执行栈,然后可以在非运行状态保存当前内容以便再次运行,然后可以存贮一些信息,可以被处理器运行
线程的好处:
    创建新的线程(Thread)比进程(Process)用时少
    终止Thread比Process更快
    在两个Thread之间交替更块
    thread之间交流更高效

 User-Level Threads(ULT)
     所有的线程都由应用处理好了

     劣势:
         当一个ULT锁定了系统调用时,所有的在相同进程中的线程都将被锁定
         不能利用多线程的优势

Kernel-Level Threads(KLT)
    例如:Windows & Linux
    所有工作由kernel完成(项目中没有线程管理)
    优势:
    劣势:
Combined Approaches
    例如: SUN Solaris

**Parallel Execution 平行处理**

Applications That Benefit
    Multithreaded native applications
        characterized by having a small number of highly threaded processes

    Multiprocess applications

        characterized by the presence of many single-threaded processes
    Java applications

    Multiinstance applications

        multiple instances of the application in parallel


Hyper-threading
是inter的噫哥主要的处理同时多线程(simultaneous multithreading SMT)一项技术,可以提高x86微处理器的性能。

Hyper-threading = logical core

对于每一个物理存在的处理器,操作系统的地址时两个虚拟的或是逻辑核心,在可能的情况下分享工作量  

For each processor core that is physically present, the operating system addresses two virtual or logical cores, and shares the workload between them when possible. The main function of hyper-threading is to increase the number of independent instructions in the pipeline; it takes advantage of superscalar architecture, in which multiple instructions operate on separate data in parallel. With HTT, one physical core appears as two processors to the operating system, which can use each core to schedule two processes at once. In addition, two or more processes can use the same resources: if resources for one process are not available, then another process can continue if its resources are available.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值