错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Functional Programming and Concurrency

  • Michael Bruno Lochemem

摘要

A lot has happened since the advent of modern computing in the previous century. In the last 30 years or so, commodity hardware has ostensibly become more robust, while software quality has not exactly improved commensurately. With hardware scaling fast approaching a real terrestrial limit, there is an added incentive to write software as potently as possible. When factoring the arduousness of memory access, particularly I/O at levels that most PHP developers directly interact with—RAM, disk, and network—the impetus for making software more performant only strengthens. In practice today, most attempts at pushing the boundaries of what is achievable with modern hardware, while overcoming the technical inefficiencies of memory access, center around the concept of concurrency—a mechanism for enabling the simultaneous execution of units of program code. Regardless of whether the path to achieving concurrency is one that features multithreading, multiprocessing, or, generally, the interleaving of I/O in an event loop, all options available to PHP users, there exists a role for Functional Programming to play. In this chapter, this role will be spotlighted in discussions regarding multithreading approaches with re-entrant functions, composing parallel executions with Communicating Sequential Processes (CSP), multiprocessing with signals, and message brokerage.