Operating system--process

Source: Internet
Author: User

  • Definition of the process
    • Process Control block PCB: role: Used to describe the basic situation of the process and the process of activity, thereby controlling and managing the process.
      • Composition: composed of program segment, data section, PCB
      • Create process: Create PCB in process; Undo process: Undo PCB in progress
    • Process definition: A process in which a program with independent functions runs on a data set, which is an independent unit of the system's resource allocation disk and scheduling.
    • Differences in processes and procedures
      • Concurrency: Process owned, program not.
      • Dynamic: The process is dynamic and the program is static.
      • Independence and Asynchrony.
  • process basic status and Conversions

    •                       2-1  Five Transition of a process state
      ready state-run state: When a process in the ready state is dispatched, the processor resource (dispatch processor Time slice) is obtained, and the process transitions from ready state to run state.

      Run state-ready state: The running process has to give up the processor after the time slice is exhausted, thus converting the process from the running state to the ready state. Also, in a stripped-down operating system, when a higher-priority process is a thread, the scheduling level translates the process being executed into a ready state for higher-priority processes to execute.

      Running status, blocking state: When a process requests the use and allocation of a resource (such as a peripheral) or waits for an event to occur (such as the completion of an I/O operation), it transitions from the running state to the blocking state. The process requests the operating system to provide services in the form of a system call, which is a special form of invoking the operating system kernel procedure by the running user-state program.

      Blocking state-ready state: When a process waits for an event to arrive, such as the end of an I/O operation or the end of an interrupt, the interrupt handler must convert the state of the corresponding process from a blocking state to a ready state.


    • process creation and termination
      • Create a process: Request a blank PCB, fill in information--to assign the process the resources required for the runtime--process to ready, insert ready queue
      • Terminate process: Wait for the operating system to clean up---the PCB zeroing, space return system.


  • Process synchronization
    • Basic concepts:
      • Critical resources: Many hardware resources (printers, tape drives), processes are mutually exclusive to achieve the sharing of such resources.
      • Critical section: Whether it is a hardware critical resource or a software critical resource, a process must access it mutually exclusive. The code that accesses critical resources in each process is called a critical section. (So every time you want to access the critical section's resources, you have to make sure it's not being accessed.)
      • The synchronization mechanism follows the rules: ①: Idle let into ②: Busy is waiting for ③: Limited wait ④: let right wait.
  • Process Communication
    • Process Communication type:
      • Shared memory system: share some data structures or share a store. This is divided into: Shared data structures (producer consumer issues), shared storage (partitioning a piece of memory for sharing, directly managed by the process)
      • Pipeline communication system: shared by a read process and a write process implementation. The sending process feeds data into the pipeline as a character stream, and the receiving process receives data from the pipeline and communicates with the pipeline.
      • Message delivery system: ① Direct communication: Use the OS to send messages directly. ② Indirect communication: the sending and receiving processes are sent and received through an intermediary entity (mailbox). This method does not borrow any shared storage or data structures.
      • Customer-Server System:


  • Thread
    • Threads: As the basic unit of dispatch and dispatch.
    • Comparison of processes and threads
      • The basic unit of dispatch: The process is the basic unit of independent dispatch and allocation, can run independently, the switching cost is big, the thread as the basic unit of dispatch and allocation, can run independently, the switching cost is small, the switching of the process leads to the switch of the thread, and the switch of the same process has no effect on the process. However, switching between threads in different processes can cause the process to switch.
      • Concurrency: Between processes can execute concurrently, multiple threads can execute concurrently, and all threads of a process can execute concurrently.
      • Owning a resource: a process can have resources as a basic unit (PCB) that owns resources in the system, and threads do not own system resources, only those that have sufficient resources to run on their own. Threads allow multiple threads to share all of the resources of the process.
      • The process has a large system overhead, high independence, low thread overhead and poor independence.


  • How threads are implemented
    • Kernel Support Threads: Both the system process and the user process are running under the operating system kernel.
    • User-level threads: implemented in user space, user-level threads are independent of the kernel.

Operating system--process

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.