-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add files to Arena lab #77
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Andrei Stan <[email protected]>
Modified `slides.mdpp` according to the new structure and created `slides/` folders for each sub-chapter. Signed-off-by: Andrei Stan <[email protected]>
Corrected some styling issues to make the doc more consistent. Signed-off-by: Andrei Stan <[email protected]>
…ems into restructure-data
…lab visibility on the webpage Signed-off-by: Dragos Coscodan <[email protected]>
Published at https://cs-pub-ro.github.io/operating-systems/77/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without looking at the code yet, the first thing you'll need to do is to squash all these commits into a single one:
$ git rebase -i HEAD~5
This will open your default editor and list the last 5 commits. Replace the word pick
from the beginning of each line with s
from squash, then save and exit.
Another editor window will appear with all 5 commit messages concatenated. Delete them and reword the commit similarly to this one: c58a60b
chapters/data: Restructure content according to updated methodology
Then add a description of your changes below
<don't remove your signature at the end>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work so far. Now you need to add the drills, slides and all other components from the old folder [1] to their corresponding subchapter [2]. You'll be able to remove [1] afterwards. And the arena should be split into the aforementioned subchapters. So every exercise from the arena must be moved to the subchapter that's closest to it (and follow the same folder organisation).
[1] https://github.com/cs-pub-ro/operating-systems/tree/main/content/chapters/data
[2] https://github.com/Dragosh-C/operating-systems/tree/restructure-data/chapters/data
- Move all content to the `chapers/` folder - Separate between `reading/`, `guides/`, `drills/` for arena lab - Modify `config.yaml` to reflect the changes above - Fix broken links and paths Signed-off-by: Dragos Coscodan <[email protected]>
…tems into restructure-data
Published at https://cs-pub-ro.github.io/operating-systems/77/ |
…and modified config.yaml to show the lab with the new structure Signed-off-by: Dragos Coscodan <[email protected]>
Published at https://cs-pub-ro.github.io/operating-systems/77/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content is taking shape nicely. I made some suggestions for the working-with-memory
chapter. After moving the paragraphs I mentioned to the reading/
section, add the following line to each task's README.md: "If you're having difficulties solving this exercise, go through [this](link to the relevant section in reading/) reading material."
@@ -0,0 +1,31 @@ | |||
# Memory Allocation Strategy | |||
|
|||
Navigate to the `memory-alloc/support/` directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigate to the `memory-alloc/support/` directory. | |
Navigate to the `guides/memory-alloc/support/` directory. |
## C | ||
|
||
The C implementation manages the memory manually. | ||
You can observe that all allocations are performed via `malloc` and the memory is freed using `free`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can observe that all allocations are performed via `malloc` and the memory is freed using `free`. | |
You can observe that all allocations are performed via `malloc()` and the memory is freed using `free()`. |
This helps distinguish functions from simple labels, variables or file names.
## D | ||
|
||
The previous 2 examples have showcased extreme situations: fully manual vs fully automatic memory management. | ||
In D, both worlds are combined: variables may be allocated manually on the stack/heap or allocated via the garbage collector (for brevity, `malloc`-based allocation is not presented in this example). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In D, both worlds are combined: variables may be allocated manually on the stack/heap or allocated via the garbage collector (for brevity, `malloc`-based allocation is not presented in this example). | |
In D, both worlds are combined: variables may be allocated manually on the stack/heap or via the garbage collector (for brevity, `malloc()`-based allocation is not presented in this example). |
Taking the address of a local, doing pointer arithmetic, reinterpret casts, calling non-`@safe` functions etc. are not allowed in `@safe` code. | ||
If any of these unsafe features are manually proven to be safe, the `@trusted` keyword may be used to disable the checks but still consider the code `@safe`. | ||
This is to allow writing system code, which by its nature is unsafe. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move all guides one directory up the hierarchy so that it looks like this:
working-with-memory/
|-- guides/
| `-- ...
|-- drills/
| |-- tasks/
| | `-- ...
| `-- questions/
| `-- ...
|-- media/
...
Variables are placed in different sections (`.data`, `.bss`, stack, heap) with read and write permissions; | ||
no execute permissions. | ||
|
||
Let's navigate to the `memory-protection/support/` directory and inspect the `mem_prot.c` source file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's navigate to the `memory-protection/support/` directory and inspect the `mem_prot.c` source file. | |
Let's navigate to the `drills/tasks/memory-protection/support/` directory and inspect the `mem_prot.c` source file. |
|
||
The purpose of this exercise is to provide examples on how memory corruption may occur and what are the safety guards implemented by different programming languages. | ||
|
||
Navigate to the `memory-vuln/support/` directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigate to the `memory-vuln/support/` directory. | |
Navigate to the `guides/memory-vuln/support/` directory. |
Memory contents (both code and data) are separated into sections or zones. | ||
This makes it easier to manage. | ||
More than that, it allows different zones to have different permissions. | ||
This follows the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege) where only required permissions are part of a given section. | ||
|
||
Code is usually placed in a section (`.text`) with read and execute permissions; | ||
no write permissions. | ||
Variables are placed in different sections (`.data`, `.bss`, stack, heap) with read and write permissions; | ||
no execute permissions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move these lines to reading/working-with-memory.md
.
## Practice | ||
Navigate to the `memory-access/support/` directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigate to the `memory-access/support/` directory. | |
Navigate to the `drills/tasks/memory-access/support/` directory. |
chapters/data/working-with-memory/drills/tasks/memory-access/README.md
Outdated
Show resolved
Hide resolved
…logy - Move all guides one directory up the hierarchy - Modify all links to start from the subchapter - Move some lines from drills/tasks/*/README.md in reading/working-with-memory.md - Add new message at the end of each task in README.md Signed-off-by: Dragos Coscodan <[email protected]>
…config.yaml to show the lab with the new structure Signed-off-by: Dragos Coscodan <[email protected]>
Published at https://cs-pub-ro.github.io/operating-systems/77/ |
data/investigate-memory: Add all files to the drills folder and modify config.yaml to show the lab with the new structure Signed-off-by: Dragos Coscodan <[email protected]>
Prerequisite Checklist
Description of changes