Projects

THC Projects

THC

THC is a language that adds a few interesting features to C for performing asynchronous IO without the need for threads or stack-ripping event handlers.

  • async {s} - Execution proceeds into s. If s blocks (e.g. on IO), execution proceeds at the statements following the async statement. When the blocking operation in s finishes, execution may return to that point if it becomes blocked somewhere else. async statements must be syntactically enclosed in a do..finish statement.
  • do {s} finish - Blocks until execution has reached the end of all async statements in s.
  • cancel - Causes all cancelable, blocking operations within the enclosing do..finish statement to abort and return a value indicating cancellation.

Projects

  1. Static Analysis of THC to find programming errors
  2. Normally, THC programs run sequentially. That is, only one operation is executed at any time. However, if it can be determined that async statements that may-happen-in-parallel won't touch the same unsynchronized locations (e.g. shared locations not protected by a lock or atomic section), then the two async statements may safely be run concurrently in separate threads. This project would entail implementing this feature.
  3. Consider a webserver written in THC. A webserver may block in several places while serving a single request. The order in which the THC runtime reschedules async statements when blocking operations in them finish will affect the time it takes requests to be served. This project involves investigating ways to ensure fair allocation of server resources to clients making requests to a server written in THC.

Projects