Our concurrency model includes facilities for creating a collection of tasks and mutually exclusive access to memory
Question:
Our concurrency model includes facilities for creating a collection of tasks and mutually exclusive access to memory locations.
These facilities can be used to model synchronization between two tasks, typically known as join. For example, consider join, an expression that allows a current task to wait for another task specified by the join expression. This can be easily modeled by assigning a lock to each task. Then, a task t waiting for another task t’ to finish can be modeled as trying to acquire a lock l’, at the join point in task t, which is acquired at the beginning of the task t’ and released at the end of the task t’. Write an example program in Forklang that illustrates this pattern for two and three tasks created using the fork expression.
Step by Step Answer:
An Experiential Introduction To Principles Of Programming Languages
ISBN: 9780262045452
1st Edition
Authors: Hridesh Rajan