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

Two models for concurrent programming

Concurrency implies that multiple tasks are happening in parallel to achieve a common goal. Just like communication with a group, we need to communicate and coordinate with the concurrently executing entities.

For example, let us say that we present the previously mentioned word frequency counter via a UI functionality. A user uploads a huge file and clicks the start button, resulting in a long-running MapReduce job. We need to distribute the work among the slaves. To send the workload, we need a way to communicate with them. The following diagram shows the various streams of communications that are required in this system:

If the user changes their mind and aborts the job, we need to communicate the stop message to each concurrent entity, as any further processing is futile.

There are two prominent models for concurrent communications: message passing and shared memory. The preceding diagram shows a message passing model.   

We will first discuss the message passing model, using the celebrated UNIX shell pipeline as an example. Next, we will see the shared memory approach in depth and the problems that are associated with it.            

主站蜘蛛池模板: 赣榆县| 临桂县| 汨罗市| 崇明县| 政和县| 泰州市| 北辰区| 姚安县| 禄丰县| 海口市| 莱西市| 嘉定区| 曲靖市| 楚雄市| 常宁市| 吉隆县| 石城县| 大同市| 伽师县| 庄河市| 彭山县| 彰武县| 武宣县| 洮南市| 偃师市| 黔东| 江西省| 嵩明县| 德惠市| 禹州市| 缙云县| 西林县| 台东市| 靖州| 上虞市| 资溪县| 顺昌县| 宝丰县| 会理县| 汝州市| 青州市|