You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assignments/parallel-firewall: Clarify statement and support code
Clarify the CLI arguments accepted by the `firewall` binary.
Rephrase support code comment from `processes` -> `threads`.
Signed-off-by: Andrei Stan <[email protected]>
Copy file name to clipboardexpand all lines: content/assignments/parallel-firewall/README.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ The purpose of this assignment is to:
32
32
33
33
The support code consists of the directories:
34
34
35
-
-`src/` contains the skeleton for the parallelized firewall and the already implemented serial code.
35
+
-`src/` contains the skeleton for the parallelized firewall and the already implemented serial code in `src/serial.c`.
36
36
You will have to implement the missing parts marked as `TODO`
37
37
38
38
-`utils/` contains utility files used for debugging and logging.
@@ -54,6 +54,8 @@ When there are new packets that need to be handled, the `consumer` threads must
54
54
55
55
Implement the `consumer` related functions marked with `TODO` in the `src/consumer.c` file.
56
56
57
+
**The number of consumer threads will be passed as a the 3rd command line argument**
58
+
57
59
### Ring Buffers
58
60
59
61
A ring buffer (or a circular buffer) is a data structure that stores its elements in a circular fixed size array.
@@ -82,8 +84,11 @@ The output of the firewall will be a log file with the rows containing the firew
82
84
The actual format can be found in the serial implementation (at `src/serial.c`).
83
85
84
86
When processing the packets in parallel the threads will finish up the work in a non deterministic order.
87
+
The packet processing functions are already implemented in `src/packet.c`
88
+
85
89
We would like the logs to be sorted by the packet timestamp, the order that they came in from the producer.
86
90
Thus, the `consumers` should insert the packet information to the log file such as the result is ordered by timestamp.
91
+
The printing format can be found in `./src/serial.c`
87
92
88
93
The logs must be written to the file in ascending order during packet processing.
89
94
**Sorting the log file after the consumer threads have finished processing is not considered a valid synchronization mechanism and points will be deducted.**
@@ -138,6 +143,7 @@ When using `grade.sh` you will get a maximum of 90/100 points for general correc
138
143
139
144
- Threads must yield the cpu when waiting for empty/full buffers i.e. not doing `busy waiting`.
140
145
- The logs must be written as they are processed and not after the processing is done, in ascending order by the timestamp.
146
+
- The number of running threads must be at least `num_consumer + 1`, where num_consumers is the 3rd command line argument to the `firewall` binary.
0 commit comments