官术网_书友最值得收藏!

Threading and process creation

Executing multiple tasks simultaneously can be accomplished by asking the operating system to create additional threads (or even new processes). This is a common task in system programming, and there are numerous system calls to get the job done.

A process is a unit of execution that has a set of resources assigned to it (for example, memory, file descriptors, and so on.) Each application is made up of at least one process, but they can contain more than one (for example, a shell is an application that is specifically designed to run several child processes).

Each process is scheduled by the operating system to execute for a limited amount of time before the next process is given access to the CPU, and this cycle continues as needed.

Threads are like processes, but they share the same resources as other threads of the same process. Threads provide an application with an opportunity to create tasks that are capable of executing in parallel, without the need for inter-process communication methods. In Chapter 12, Learning to Program POSIX and C++ Threads, we will learn how to program threads using both POSIX and C++ APIs. 

主站蜘蛛池模板: 泰来县| 抚顺市| 临海市| 云和县| 杂多县| 萨嘎县| 喜德县| 安陆市| 宜阳县| 吉林市| 乐业县| 南陵县| 合川市| 许昌县| 南和县| 德保县| 澄江县| 桐乡市| 西吉县| 穆棱市| 汉寿县| 红河县| 佛教| 灌云县| 浦北县| 同德县| 奎屯市| 楚雄市| 筠连县| 尼玛县| 姚安县| 汉源县| 扶绥县| 绿春县| 安宁市| 武胜县| 隆回县| 治县。| 通许县| 福鼎市| 嘉荫县|