Skip to content

Commit d43b71d

Browse files
authored
Merge branch 'cs-pub-ro:main' into private
2 parents 36cb008 + 1e70cea commit d43b71d

File tree

115 files changed

+1239
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1239
-333
lines changed

.checkpatch.ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Ignore directories containing third-party files
22
chapters/compute/synchronization/drills/tasks/threadsafe-data-struct/support
33
content/assignments/async-web-server/src/http-parser
4+
content/assignments/elf-loader/tests

.github/workflows/lab-archive.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ jobs:
3737
exit 0
3838
fi
3939
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
43+
ls -A *.zip > zip-list
44+
git add *.zip
45+
git stash
46+
4047
# Create or switch to lab-archives branch
4148
if git ls-remote --exit-code origin lab-archives; then
4249
git fetch origin lab-archives
@@ -46,15 +53,12 @@ jobs:
4653
git rm -rf .
4754
fi
4855
56+
# Remove old archives
57+
for f in $(cat zip-list); do rm "$f"; git rm "$f"; done
58+
git commit -m "Remove outdated lab archives for commit $GITHUB_SHA"
59+
4960
# Copy new zips into branch root
61+
git stash pop
5062
git add *.zip
51-
52-
# Only commit if there are changes
53-
if ! git diff --cached --quiet; then
54-
git config user.name "github-actions[bot]"
55-
git config user.email "github-actions[bot]@users.noreply.github.com"
56-
git commit -m "Update lab archives for commit $GITHUB_SHA"
57-
git push origin lab-archives
58-
else
59-
echo "No changes to commit."
60-
fi
63+
git commit -m "Update lab archives for commit $GITHUB_SHA"
64+
git push origin lab-archives

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*.war
1616
*.nar
1717
*.ear
18-
*.zip
1918
*.tar.gz
2019
*.rar
2120

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The contents of the lab are located in the [lab archive](https://github.com/cs-pub-ro/operating-systems/raw/refs/heads/lab-archives/Lab_6_Multiprocess_and_Multithread.zip) and in the [GitHub repository](https://github.com/cs-pub-ro/operating-systems).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The contents of the lab are located in the [lab archive](https://github.com/cs-pub-ro/operating-systems/raw/refs/heads/lab-archives/Lab_8_Synchronization.zip) and in the [GitHub repository](https://github.com/cs-pub-ro/operating-systems).

chapters/compute/processes/drills/tasks/create-process/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Create Process
22

3-
Enter the `chapters/compute/processes/drills/tasks/create-process/` directory, run `make skels`, open the `support/src` folder and go through the practice items below.
3+
Enter the `create-process/` directory (or `chapters/compute/processes/drills/tasks/create-process/` if you are working directly in the repository).
4+
Run `make` and then enter `support/` folder and go through the practice items below.
45

56
Use the `tests/checker.sh` script to check your solutions.
67

78
```bash
8-
./checker.sh
9+
./tests/checker.sh
910
exit_code22 ...................... passed ... 50
1011
second_fork ...................... passed ... 50
1112
100 / 100

chapters/compute/processes/drills/tasks/sleepy/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
## Higher level - Python
44

5-
Enter the `chapters/compute/processes/drills/tasks/sleepy` directory, run `make skels`, open the `support/src` folder and go through the practice items below.
5+
Enter the `sleepy/` directory (or `chapters/compute/processes/drills/tasks/sleepy` if you are working directly in the repository).
6+
Run `make` and then enter `support/` folder and go through the practice items below.
67

78
Use the `tests/checker.sh` script to check your solutions.
89

910
```bash
10-
./checker.sh
11+
./tests/checker.sh
1112
sleepy_creator ...................... passed ... 30
1213
sleepy_creator_wait ................. passed ... 30
1314
sleepy_creator_c .................... passed ... 40

chapters/compute/processes/drills/tasks/wait-for-me-processes/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Wait for Me
22

3-
Enter the `chapters/compute/processes/drills/tasks/wait-for-me-processes/` directory, run `make skels`, open the `support/src` folder and go through the practice items below.
3+
Enter the `wait-for-me/` directory (or `chapters/compute/processes/drills/tasks/wait-for-me/` if you are working directly in the repository).
4+
Run `make` and then enter `support/` folder and go through the practice items below.
45

56
Use the `tests/checker.sh` script to check your solutions.
67

@@ -10,7 +11,7 @@ wait_for_me_processes ...................... passed ... 100
1011
```
1112

1213
1. Run the code in `wait_for_me_processes.py` (e.g: `python3 wait_for_me_processes.py`).
13-
The parent process creates one child that writes and message to the given file.
14+
The parent process creates one child that writes a message to the given file.
1415
Then the parent reads that message.
1516
Simple enough, right?
1617
But running the code raises a `FileNotFoundError`.

chapters/compute/processes/reading/processes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ student@os:~$ file /usr/bin/ls
1414
```
1515

1616
When you run it, the `ls` binary stored **on the disk** at `/usr/bin/ls` is read by another application called the **loader**.
17-
The loader spawns a **process** by copying some of the contents `/usr/bin/ls` in memory (such as the `.text`, `.rodata` and `.data` sections).
17+
The loader spawns a **process** by copying some contents of `/usr/bin/ls` into memory (for example the `.text`, `.rodata` and `.data` sections).
1818
Using `strace`, we can see the [`execve`](https://man7.org/linux/man-pages/man2/execve.2.html) system call:
1919

2020
```console

chapters/compute/synchronization/drills/tasks/apache2-simulator-condition/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ There are a few rules though, such as:
2222
- The consumer must not retrieve data if the buffer is empty.
2323
- The producer and the consumer can't access the shared buffer at the same time.
2424

25-
Now enter `chapters/compute/synchronization/drills/tasks/apache2-simulator-condition/` and run `make skels`.
26-
Look at the code in `chapters/compute/synchronization/drills/tasks/apache2-simulator/support/src/producer_consumer.py`.
25+
Now enter the `apache2-simulator-condition/` directory of the extracted archive (or `chapters/compute/synchronization/drills/tasks/apache2-simulator-condition/` if you are working directly in the repository) and run `make skels`.
26+
Look at the code in `support/src/producer_consumer.py`.
2727
We have one producer and one consumer for simplicity.
2828
Observe that the producer calls `notify()` once there is data available, and the consumer calls `notify()`, when data is read.
2929
Notice that this call is preceded by an `acquire()` call, and succeeded by a `release()` call.
@@ -58,7 +58,7 @@ Neat!
5858
So now we have both synchronization **and** signalling.
5959
This is what conditions are for, ultimately.
6060

61-
Open `chapters/compute/synchronization/drills/tasks/apache2-simulator/support/src/apache2_simulator_condition.py` and follow the TODOs.
61+
Open the `apache2-simulator-condition/` directory of the extracted archive (or `chapters/compute/synchronization/drills/tasks/apache2-simulator-condition/` if you are working directly in the repository), then go to `support/src/apache2_simulator_condition.py` and follow the TODOs.
6262
The code is similar to `apache2_simulator_semaphore.py`, but this time we use condition variables as shown in `producer_consumer.py`.
6363

6464
[Quiz](../../../drills/questions/notify-only-with-mutex.md)

0 commit comments

Comments
 (0)