|
1 | 1 | { |
2 | | - "resource_limits" : { |
3 | | - // Allow the submission to run for 10 seconds. |
4 | | - "RLIMIT_CPU" : 10, |
5 | | - // Allow up to 20 additional processes launched by the student code. |
6 | | - "RLIMIT_NPROC" : 20 |
7 | | - }, |
| 2 | + "resource_limits" : { |
| 3 | + // Allow the submission to run for 10 seconds. |
| 4 | + "RLIMIT_CPU" : 10, |
| 5 | + // Allow up to 20 additional processes launched by the student code. |
| 6 | + "RLIMIT_NPROC" : 20 |
| 7 | + }, |
8 | 8 |
|
9 | | - // Allow the student code to use IPC and multiprocessing system calls. |
10 | | - "allow_system_calls" : [ |
11 | | - // This allows us to use ipc, pipe, semop, shmat, shmtcl, ... |
12 | | - "ALLOW_SYSTEM_CALL_CATEGORY_COMMUNICATIONS_AND_NETWORKING_INTERPROCESS_COMMUNICATION", |
13 | | - // This allows us to use clone, execve, fork, set_tid_address, vfork |
14 | | - "ALLOW_SYSTEM_CALL_CATEGORY_PROCESS_CONTROL_NEW_PROCESS_THREAD" |
15 | | - ], |
| 9 | + // Allow the student code to use IPC and multiprocessing system calls. |
| 10 | + "allow_system_calls" : [ |
| 11 | + // This allows us to use ipc, pipe, semop, shmat, shmtcl, ... |
| 12 | + "ALLOW_SYSTEM_CALL_CATEGORY_COMMUNICATIONS_AND_NETWORKING_INTERPROCESS_COMMUNICATION", |
| 13 | + // This allows us to use clone, execve, fork, set_tid_address, vfork |
| 14 | + "ALLOW_SYSTEM_CALL_CATEGORY_PROCESS_CONTROL_NEW_PROCESS_THREAD" |
| 15 | + ], |
16 | 16 |
|
17 | | - "testcases" : [ |
18 | | - { |
19 | | - "type" : "Compilation", |
20 | | - "title" : "C - Compilation", |
21 | | - "command" : "/usr/bin/gcc -Wall -o a.out *.c", |
22 | | - "executable_name" : "a.out", |
23 | | - "points" : 2 |
24 | | - }, |
25 | | - { |
26 | | - "title" : "C - Execution", |
27 | | - "command" : "./a.out 10", |
28 | | - "points" : 4, |
29 | | - "validation" : [ |
| 17 | + "testcases" : [ |
| 18 | + { |
| 19 | + "type" : "Compilation", |
| 20 | + "title" : "Compilation", |
| 21 | + "command" : "/usr/bin/gcc -Wall -o a.out *.c", |
| 22 | + "executable_name" : "a.out", |
| 23 | + "points" : 2 |
| 24 | + }, |
| 25 | + |
| 26 | + // Launch 10 new threads. |
| 27 | + // This should work whether they are in parallel or serial. |
| 28 | + { |
| 29 | + "title" : "./a.out 10", |
| 30 | + "command" : "./a.out 10", |
| 31 | + "points" : 4, |
| 32 | + "validation" : [ |
| 33 | + { |
| 34 | + "method" : "searchToken", |
| 35 | + "data" : [ "ALL DONE! 10 successful forks" ], |
| 36 | + "actual_file" : "STDOUT.txt", |
| 37 | + "description" : "Standard Output (STDOUT)", |
| 38 | + "deduction" : 1.0 |
| 39 | + } |
| 40 | + ] |
| 41 | + }, |
| 42 | + |
| 43 | + // Launch 30 new threads. |
| 44 | + // This should work in serial, but will not work in parallel |
| 45 | + // because of the restricted resource limits. |
30 | 46 | { |
31 | | - "method" : "searchToken", |
32 | | - "data" : [ "ALL DONE! 10 successful forks" ], |
33 | | - "actual_file" : "STDOUT.txt", |
34 | | - "description" : "Standard Output (STDOUT)", |
35 | | - "deduction" : 1.0 |
36 | | - } |
37 | | - ] |
38 | | - } |
39 | | - ] |
| 47 | + "title" : "./a.out 30", |
| 48 | + "command" : "./a.out 30", |
| 49 | + "points" : 4, |
| 50 | + "validation" : [ |
| 51 | + { |
| 52 | + "method" : "searchToken", |
| 53 | + "data" : [ "ALL DONE! 30 successful forks" ], |
| 54 | + "actual_file" : "STDOUT.txt", |
| 55 | + "description" : "Standard Output (STDOUT)", |
| 56 | + "deduction" : 1.0 |
| 57 | + } |
| 58 | + ] |
| 59 | + } |
| 60 | + ] |
40 | 61 | } |
0 commit comments