Skip to content

SICPy: §3.4.2 concurrency examples need a concurrent_execute primitive (EXPECTED tags disabled) #1263

Description

@martin-henz

Summary

The Python edition (SICPy) of §3.4.2 (Mechanisms for Controlling Concurrency) needs a concurrent_execute primitive — a thread/interleaving simulator — that is not defined anywhere: it is neither provided by scripts/sicp.py nor defined in the book text. As a result, none of the concurrency examples can run under SICP_EDITION=py yarn test.

As a stopgap during the ch3 finetuning pass, the <EXPECTED> tags of the affected snippets have been commented out (<!-- ... -->) so the Python test suite passes. They must be re-enabled once a concurrent_execute primitive exists.

Affected snippets

All in xml_py/chapter3/section4/subsection2.xml, each with <EXPECTED>'all threads terminated'</EXPECTED> disabled:

  • concurrent_execute_example
  • serializer_example
  • serializer_example_2
  • serializer_example_3
  • serializer_example_4
  • make_account_and_serializer
  • serializer
  • mutex
  • test_and_set

What's needed

A concurrent_execute(*thunks) primitive for the Python edition (e.g. in scripts/sicp.py) that runs the supplied thunks under some interleaving and returns 'all threads terminated', plus whatever serializer/mutex/test_and_set support the examples assume. Once available, restore the commented-out <EXPECTED> tags and confirm SICP_EDITION=py yarn test programs_py/chapter3 is green.

Context

Found while finetuning chapter 3 JS→Python (34/147 → 137/147 passing; the remaining non-concurrency failure is a separate JS x/0 = Infinity vs Python ZeroDivisionError divergence in the monte-carlo stream estimate).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions