Process thread Process Migration

Source: Internet
Author: User

Process

  • A process is an entity that exists independently in the system. It can have its own independent resources, such as files and device descriptors. Other processes cannot access these resources without being permitted by the process itself. This is very different from the thread.
  • The difference between a process and a program is that a program is only a set of static commands, and a process is a set of commands that are active in the system.
  • The concept of time is added to the process. Processes have their own lifecycles and different states. These concepts are not available in programs.
  • Several processes can be concurrently executed on a single processor.
  • The environment in which a process runs is called the context. The context of a process consists of the Process Control Block (PCB), text segment, and data segment) and user stacks. The body segment stores the executable code of the process, and the data segment stores the static data structure generated in the process; PCB includes the process ID, status, priority, and approximate distribution of data in the body and data segments.
  • A chain table structure called Process Table associates all the PCB blocks in the system.
  • Each time the system accesses a process, the kernel searches for the corresponding process PCB Blocks Based on the PID in the Process Table (the specific search process is implemented through a PID hash table ), find the corresponding code segment and data segment through the PCB block and perform the operation.

Thread

  • A thread is an entity contained in a process. It has its own running clues to complete certain tasks, and can share the shared variables and some environments with other threads to complete the tasks to be completed by the process.
  • Threads have higher performance than processes. This is because threads in the same process share the same virtual space.
  • Environments shared by threads include process code segments and public data of processes (using the shared data, threads can easily communicate with each other) process open file descriptor, signal processor, current directory of the Process, process user ID and process group ID.
  • Each thread has its own thread ID, which is unique in this process. The process uses this to identify the thread.
  • Since threads run concurrently, each thread has its own different running clues. When switching from one thread to another, the status of the registers set of the original thread must be saved, so that the thread can be restored when it is switched over again.
  • Stack is required to ensure independent running of threads.
  • A thread function can call a function, and the called function can be nested in layers. Therefore, a thread must have its own function stack so that function calls can be executed normally without the influence of other threads.
  • Because a thread needs to be scheduled as a process, a parameter must be available for scheduling. this parameter is the priority of the thread.

Process Migration

  • Process Migration is a technology that transfers processes between processing nodes. It can also be considered as a process re-positioning.

Process Migration steps:

  • [Step 1] ask whether the target processor can accept the migration process;
  • [Step 2] After receiving a positive response from the target processor, create a recovery process on the target processor;
  • [Step 3] interrupt the running program of the migration process;
  • [Step 4] collect migration process statuses on the source processing machine;
  • [Step 5] transfer the migration process status to the target processor;
  • [Step 6] the recovery process on the target processing machine is responsible for restoring the status of the migration process and recreating the process instance;
  • [STEP 7] notify other processes in the system of the new location of the migration process, and re-establish the communication connection before the Migration interruption;
  • [Step 8] the migration process resumes operation on the target node;
  • [Step 9] the use of a forwarding mechanism (or the nature of a single system image) ensures that processes can be transparently executed on remote processors.

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.