Our realization of the Forklang language creates two threads. In some programming languages, fork creates a separate

Question:

Our realization of the Forklang language creates two threads. In some programming languages, fork creates a separate process (i.e., the forked task and the original task do not share memory). In this exercise, you will gradually modify the Forklang interpreter to implement processes.

  • [Heap clone] Extend the heap abstraction with a cloning functionality. The clone of a heap has all the locations that are present in the original heap. For each valid location (i.e., a location that contains a stored value), the value stored in the heap clone is the same as the value stored in the original heap. Is it essential to clone each value stored in the original heap?
  • [Process] Modify the semantics of a fork, such that the two new concurrent subtasks utilize a heap that is a clone of the original heap.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: