Skip to content
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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Dragosh-C
Copy link

@Dragosh-C Dragosh-C commented Sep 13, 2024

Prerequisite Checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Updated relevant documentation (if needed).

Description of changes

  • Integrated drills folder with the files (tasks and questions) into the Arena lab.
  • Modified config.yaml to ensure the lab is displayed correctly on the webpage

Grizzlly and others added 5 commits April 3, 2024 02:08
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]>
…lab visibility on the webpage

Signed-off-by: Dragos Coscodan <[email protected]>
@Dragosh-C Dragosh-C changed the title Restructure data Add files to Arena lab Sep 13, 2024
@teodutu teodutu added the needs-rendering The PR makes changes to the website that need to be rendered label Sep 13, 2024
Copy link

Copy link

@teodutu teodutu left a 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>

@github-actions github-actions bot added area/infra Update to infrastructure / scripts area/questions Update to questions content area/tasks Update to tasks kind/new New content / item labels Sep 14, 2024
Copy link

@teodutu teodutu left a 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

vladiouz and others added 2 commits September 17, 2024 23:12
- 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]>
@teodutu teodutu added needs-rendering The PR makes changes to the website that need to be rendered and removed needs-rendering The PR makes changes to the website that need to be rendered labels Sep 18, 2024
Copy link

…and modified config.yaml to show the lab with the new structure

Signed-off-by: Dragos Coscodan <[email protected]>
@teodutu teodutu added needs-rendering The PR makes changes to the website that need to be rendered and removed needs-rendering The PR makes changes to the website that need to be rendered labels Sep 24, 2024
Copy link

Copy link

@teodutu teodutu left a 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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link

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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Navigate to the `memory-vuln/support/` directory.
Navigate to the `guides/memory-vuln/support/` directory.

Comment on lines 3 to 11
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.
Copy link

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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Navigate to the `memory-access/support/` directory.
Navigate to the `drills/tasks/memory-access/support/` directory.

…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]>
@teodutu teodutu added needs-rendering The PR makes changes to the website that need to be rendered and removed needs-rendering The PR makes changes to the website that need to be rendered labels Sep 29, 2024
Copy link

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/infra Update to infrastructure / scripts area/questions Update to questions content area/tasks Update to tasks kind/new New content / item needs-rendering The PR makes changes to the website that need to be rendered
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants