Changes between Version 2 and Version 3 of Challenge
- Timestamp:
- 03/11/19 15:59:37 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Challenge
v2 v3 8 8 Be sure to include the appropriate headers. 9 9 10 Boolean type: `_Bool`. Values: 0 and 1. 11 (Same as C11). 10 12 11 13 12 Semaphore operations: … … 17 16 (`#define` ...) 18 17 18 19 `_Bool`:: The Boolean type. Values: 0 and 1. This is the same as C11. 20 19 21 `$proc`:: 20 22 the process type. A value of this type refers to a process. 21 23 22 24 `$spawn stmt`:: 23 creates a new process executing the statement. Returns a value of type `$proc`24 referencing the new process.25 creates a new process executing the statement. Returns a value of type `$proc` 26 referencing the new process. 25 27 26 28 `$wait($proc p)`:: 27 blocks until process p terminates29 blocks until process p terminates 28 30 29 31 `$parfor (int i:a..b) stmt`:: 30 32 spawns threads, one for each i in the range a..b, each executing `stmt`. 31 Waits for them to terminate.33 Waits for them to terminate. 32 34 33 35 `$assert(expr)`:: 34 An assertion. This is treated exactly the same as C's `assert`, except with35 the latter you must include `assert.h`. CIVL-C has a richer assertion36 language that C---e.g., you can use quantifiers.36 An assertion. This is treated exactly the same as C's `assert`, except with 37 the latter you must include `assert.h`. CIVL-C has a richer assertion 38 language that C---e.g., you can use quantifiers. 37 39 38 `$forall` and `$exists`::39 Mean what you think. Here are some examples to show the syntax:40 `$forall` and `$exists`:: 41 Mean what you think. Here are some examples to show the syntax: 40 42 * `$forall (double x | x>1) x>0` -- for all doubles x that are greater than 1, x is greater than 0 41 43 * `$forall (int i | a<=i && i<=b) p(i)` -- for all i between a and b (inclusive), p(i) holds … … 94 96 concurrently in separate threads. Used to avoid deadlocks that could 95 97 result if all processes do MPI_Send; MPI_Recv. 96
