PHP thread, process, concurrency, parallel understanding ____php

Source: Internet
Author: User

Excerpts from (with deletions and modifications):
http://chenpeng.info/html/3021
A process is a functional unit of the operating system that allocates resources and schedules, a process that has one or more threads, and a thread is an independent unit of operation of the operating system. You can usually think of a software corresponding to a process, parallel refers to a number of software running together, actually time-sharing, concurrency is a software in the runtime to the calculation of multiple CPUs at the same time to calculate, is really the same time together things happen.
A more figurative way of understanding:
Http://www.ruanyifeng.com/blog/2013/04/processes_and_threads.html

PHP-FPM uses a multiple-process model.
HHVM it chooses a multithreaded model.

For a service, such as a Web service, the main consideration is its concurrency, the number of requests that can be processed within a unit of time. Parallel computing is to improve the concurrency capability. Apart from Nginx or Apache, PHP's parallel processing capability can be improved by using a multiple-process model or a multithreaded model. In the simplest case, PHP provides a single process single-threaded way to provide services, each time the processing of a request, if the request processing speed fast enough, a second time concurrency can be considered strong, but this is a waste of resources, so often according to the CPU, memory, network situation to set up many processes, Multithreading or multiple servers to improve concurrency capabilities.

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.