Skip to content

Commit 7dc5fb0

Browse files
committed
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]>
1 parent b83d348 commit 7dc5fb0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

content/assignments/parallel-firewall/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The purpose of this assignment is to:
3232

3333
The support code consists of the directories:
3434

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`.
3636
You will have to implement the missing parts marked as `TODO`
3737

3838
- `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
5454

5555
Implement the `consumer` related functions marked with `TODO` in the `src/consumer.c` file.
5656

57+
**The number of consumer threads will be passed as a the 3rd command line argument**
58+
5759
### Ring Buffers
5860

5961
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
8284
The actual format can be found in the serial implementation (at `src/serial.c`).
8385

8486
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+
8589
We would like the logs to be sorted by the packet timestamp, the order that they came in from the producer.
8690
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`
8792

8893
The logs must be written to the file in ascending order during packet processing.
8994
**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
138143

139144
- Threads must yield the cpu when waiting for empty/full buffers i.e. not doing `busy waiting`.
140145
- 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.
141147

142148
### Grades
143149

content/assignments/parallel-firewall/src/firewall.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int main(int argc, char **argv)
6868
/* start publishing data */
6969
publish_data(&ring_buffer, argv[1]);
7070

71-
/* TODO: wait for child processes to finish execution*/
71+
/* TODO: wait for child threads to finish execution*/
7272
(void) threads;
7373

7474
free(thread_ids);

0 commit comments

Comments
 (0)