Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread-based TCP sockets #20

Merged
merged 9 commits into from
Nov 12, 2024
Merged

Conversation

konstantine4096
Copy link
Contributor

The main objective of this PR is to implement a robust version of an Athena TCP server that can accept incoming requests of size up to 4 GB and handle those using native MLton threads instead of forking a separate process. Forking has a distinct disadvantage: it is inherently stateless (since the child process gets its own replica of the global state), so it's not possible to satisfy a client request with side effects (say, a definition, which updates the global environment, or an assertion, which updates the global assumption base), as the side effects will take place on the state of the child process and will vanish when that process completes.

The new implementation has an improved readAll function. Assuming that the client encodes the length of the payload into the first 4 bytes of its request, the server is guaranteed to read the entire payload properly in a loop.

A sample Python client is also checked in for convenience.

This PR also includes:

(1) A new version of mlton_main.sml that allows for more flexible ways of calling Athena; and
(2) Two scripts, make_athena_binary_for_linux and make_athena_binary_for_mac, that can be used to
manually compile Athena binaries from the sources.

konstantine4096 and others added 9 commits November 11, 2024 20:26
…implement readAll as done in the tactics branch
… readAllSimple version that does not use length encoding
…est_to_server function (to be used with the server's readAll), as well as a send_request_to_server_simple function that can be used with the server's readAllSimple function.
…w TCP server implementation using native MLton threads, and new TCP client implementations in Python
@konstantine4096 konstantine4096 merged commit c7b5654 into master Nov 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant