zoukankan      html  css  js  c++  java
  • Implicit and Explicit Multithreading MULTITHREADING AND CHIP MULTIPROCESSORS

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION

    The concept of thread used in discussing multithreaded processors may or may not
    be the same as the concept of software threads in a multiprogrammed operating
    system. It will be useful to define terms briefly:
    • Process: An instance of a program running on a computer. A process embod-
    ies two key characteristics:
    — Resource ownership: A process includes a virtual address space to hold the
    process image; the process image is the collection of program, data, stack,
    and attributes that define the process. From time to time, a process may
    be allocated control or ownership of resources, such as main memory, I/O
    channels, I/O devices, and files.
    — Scheduling/execution: The execution of a process follows an execution
    path (trace) through one or more programs. This execution may be inter-
    leaved with that of other processes. Thus, a process has an execution state
    (Running, Ready, etc.) and a dispatching priority and is the entity that is
    scheduled and dispatched by the operating system.

    • Process switch: An operation that switches the processor from one process to
    another, by saving all the process control data, registers, and other information
    for the first and replacing them with the process information for the second.

    • Thread: A dispatchable unit of work within a process. It includes a processor
    context (which includes the program counter and stack pointer) and its own data
    area for a stack (to enable subroutine branching). A thread executes sequen-
    tially and is interruptible so that the processor can turn to another thread.
    • Thread switch: The act of switching processor control from one thread to an-
    other within the same process. Typically, this type of switch is much less costly
    than a process switch.

    Thus, a thread is concerned with scheduling and execution, whereas a process
    is concerned with both scheduling/execution and resource ownership. The multi-
    ple threads within a process share the same resources. This is why a thread switch
    is much less time consuming than a process switch. Traditional operating systems,
    such as earlier versions of UNIX, did not support threads. Most modern operating
    systems, such as Linux, other versions of UNIX, and Windows, do support thread.
    A distinction is made between user-level threads, which are visible to the applica-
    tion program, and kernel-level threads, which are visible only to the operating sys-
    tem. Both of these may be referred to as explicit threads, defined in software.
    All of the commercial processors and most of the experimental processors so
    far have used explicit multithreading. These systems concurrently execute instruc-
    tions from different explicit threads, either by interleaving instructions from dif-
    ferent threads on shared pipelines or by parallel execution on parallel pipelines.
    Implicit multithreading refers to the concurrent execution of multiple threads
    extracted from a single sequential program. These implicit threads may be defined
    either statically by the compiler or dynamically by the hardware. In the remainder
    of this section we consider explicit multithreading.

    2
    The term context switch is often found in OS literature and textbooks. Unfortunately, although most of
    the literature uses this term to mean what is here called a process switch, other sources use it to mean a
    thread switch. To avoid ambiguity, the term is not used in this book.

  • 相关阅读:
    并查集 [Total Eclipse]
    2020 Multi-University Training Contest 2 [The Oculus]
    2020牛客暑期多校训练营(第三场)G Operating on a Graph
    杭电多校第一场 [Fibonacci Sum]
    Codeforces Round #658 (Div. 2) E. Mastermind
    二次剩余
    SpringBlade 后端项目 部署 2.0-boot
    SpringBlade 前端项目 部署 Saber
    前端 天气插件
    SpringBlade 打包
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6253762.html
Copyright © 2011-2022 走看看