Operating system 01_ processes and threads

Source: Internet
Author: User

Processes and Threads
  1. Concurrency and parallelism
    Parallelism is where multiple events occur at the same time, and concurrency occurs during the same interval.
  2. Basic features of the operating system
    • 并发Program Concurrency execution
    • 共享Two ways of mutually exclusive sharing and simultaneous access
    • 虚拟Time Division Multiplexing Technology and Space Division multiplexing technology
    • 异步Process asynchronous execution, stop and go move forward, time slice
  3. What is a process?
    A program is an ordered set of instructions and data, and a process is a process entity (program segment, data segment, PCB) that executes on the processing machine. A process is an independent unit of system resource allocation and scheduling.
    The process is introduced for concurrent execution of programs to improve resource utilization and system throughput.
  4. What is a thread?
    Threads are the basic unit of Independent dispatch, independent operation, and Dispatch. Threads are lightweight processes, threads only have a small amount of resources (TCB, etc.), do not own system resources, and are multi-threaded to share the resources of the process.
    Threading is introduced to reduce the space-time overhead of concurrent execution of programs (primarily in creation, revocation, and process switching), making the OS more concurrent.
  5. The characteristics of the process (the difference from the program)
    • 动态性A process is a process of execution, which is created, dispatched, executed, revoked, and dies out. The program is static, and if the PCB is not built for it, the program is meaningless.
    • 并发性Multiple process entities are in memory and can run concurrently over a period of time. Programs that do not have a PCB set up cannot be executed concurrently.
    • 独立性Process entities can run independently, acquire resources independently, and accept schedules independently. Programs that do not have a PCB set up cannot run independently.
    • 异步性Processes are run independently and asynchronously, so the program can execute concurrently, and to ensure reproducible results, you need to configure the process synchronization mechanism.
  6. Status of the process
    • 就绪(Ready)The process has acquired the necessary resources other than the CPU to be queued by policy
    • 执行(Running)Process gets CPU, program executes
    • 阻塞(Block)The process is not able to continue due to events such as I/O requests, resulting in blocking, which requires scheduling, joining the blocking process to the blocking queue, and assigning the processor to the process in the ready queue
    • 创建Process request PCB, initialize PCB, processor allocate resources for process, finally transfer process to ready state and join ready queue
    • 终止process during execution due to normal or abnormal need to end, the OS after processing the PCB clear 0 and the PCB space return system.
  7. Process synchronization Mode
    • Hardware synchronization mode, such as off interrupt, swap instruction, test-and-set instruction
    • Semaphore mechanism
    • Pipe process mechanism
  8. Classic Process Sync Issues
    Producer-Consumer issues

Operating system 01_ processes and threads

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.