Operating System notes: Threads

Source: Internet
Author: User

4th Chapter: Threading
    • What is it?

      Basic unit used by CPU
    • Composition

      Thread ID, program counter, register collection, stack
Multithreading Benefits
    • High degree of responsiveness
    • Resource sharing
    • Economic
    • Utilization of multi-processor architectures
Multithreaded models provide methods that are supported by threads:
    • User thread
    • Kernel threads
Three types of models
Model Concept features
Many-to-one Mapping many user threads to a kernel thread A thread is blocked, the process is blocked, and cannot be run concurrently on multiple processors
One Map each user thread to a kernel thread One thread is blocked, another thread can run, can run concurrently on multiple processors, and resource overhead is high
Many-to-many Multiplexing to the same number or fewer kernel threads Combine the advantages of both
Cancellation of the thread
    • Asynchronous cancellation: A thread terminates immediately
    • Deferred cancellation: Allows threads to terminate in an orderly manner

Cancel Point

Signal Processing mode:
    • The signal is generated by the occurrence of a particular event.
    • The resulting signal to be sent to the process
    • Once sent, the signal must be processed
Question:
    1. Describe the actions taken by the line libraries in the process of user-level process context switching?

    2. What parts of the following programs are shared by threads in multithreaded programs? A. Deposit Value B. Heap memory c. global variable D. Stack memory

      A threaded thread is shared with heap memory and global variables, but each thread has its own value for storage and stack memory

Operating System notes: Threads

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.