forked from open-education-hub/operating-systems
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chapter/software-stack: Restructure repo according to updated methodo…
…logy - Move all content to the `chapers/` folder - Separate between `reading/`, `guides/`, `drills/` etc. - Modify `config.yaml` to reflect the changes above - Update `labeler.yml` to the new structure - Fix broken links and paths - Copy the generic `slides.mk` into `chapters/software-stack/Makefile` to make the chapter more self-contained Signed-off-by: Teodor Dutu <[email protected]>
- Loading branch information
Showing
333 changed files
with
14,190 additions
and
1,046 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
RVMD = reveal-md | ||
MDPP = markdown-pp | ||
FFMPEG = ffmpeg | ||
|
||
SLIDES ?= slides.mdpp | ||
SLIDES_OUT ?= slides.md | ||
MEDIA_DIR ?= media | ||
SITE ?= _site | ||
OPEN ?= xdg-open | ||
|
||
.PHONY: all html clean videos | ||
|
||
all: videos html | ||
|
||
html: $(SITE) | ||
|
||
$(SITE): $(SLIDES) | ||
$(MDPP) $< -o $(SLIDES_OUT) | ||
$(RVMD) $(SLIDES_OUT) --static $@ | ||
|
||
videos: | ||
for TARGET in $(TARGETS); do \ | ||
$(FFMPEG) -framerate 0.5 -f image2 -y \ | ||
-i "$(MEDIA_DIR)/$$TARGET/$$TARGET-%d.svg" -vf format=yuv420p $(MEDIA_DIR)/$$TARGET-generated.gif; \ | ||
done | ||
|
||
open: $(SITE) | ||
$(OPEN) $</index.html | ||
|
||
clean: | ||
-rm -f $(MEDIA_DIR)/*-generated.gif | ||
-rm -f *~ | ||
-rm -fr $(SITE) $(SLIDES_OUT) |
21 changes: 21 additions & 0 deletions
21
chapters/software-stack/applications/drills/tasks/app-investigation/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# App Investigation | ||
|
||
Enter the `app-investigation/support/` folder and go through the practice items below. | ||
Select a binary executable application and a scripted application. | ||
|
||
1. Use `ldd` on the two applications. | ||
Notice the resulting messages and explain the results. | ||
|
||
1. Use `ltrace` and `strace` on the two applications. | ||
Follow the library calls and the system calls done by each application. | ||
|
||
1. Check to see whether there are statically-linked application executables in the system. | ||
The `file` command tells if the file passed as argument is a statically-linked executable. | ||
If you can't find one, install the `busybox-static` package. | ||
|
||
1. Look into what [busybox](https://busybox.net/) is and explain why it's custom to have it as statically-linked executable. | ||
|
||
1. Run `ldd`, `nm`, `strace`, `ltrace` on a statically-linked application executable. | ||
Explain the results. | ||
|
||
If you're having difficulties solving this exercise, go through [this](../../../reading/app-investigate.md) reading material. |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ware-stack/lecture/media/applications.svg → ...stack/applications/media/applications.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
37 changes: 37 additions & 0 deletions
37
...ters/software-stack/high-level-languages/drills/tasks/high-level-lang/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# High-Level Languages | ||
|
||
Enter the `high-level-lang/support/` folder and go through the practice items below. | ||
|
||
1. Use `make` to create the `hello` executable from the `hello.go` file (a Go "Hello, World!"-printing program). | ||
Use `ltrace` and `strace` to compute the number of library calls and system calls. | ||
Use `perf` to measure the running time. | ||
|
||
Compare the values with those from the "Hello, World!"-printing programs in C and Python. | ||
|
||
1. Create a "Hello, World!"-printing program in a programming language of your choice (other than C, Python and Go). | ||
Find the values above (library calls, system calls and running time). | ||
|
||
[Quiz](../drills/questions/high-level-lang.md) | ||
|
||
1. Create programs in C, Python and Go that compute the N-th Fibonacci number. | ||
`N` is passed as a command-line argument. | ||
|
||
Use `ltrace` and `strace` to compute the number of library calls and system calls. | ||
Use `perf` to measure the running time. | ||
|
||
Compare the values of the three programs. | ||
|
||
1. Create programs in C, Python and Go that copy a source file into a destination file. | ||
Both files are passed as the two command-line arguments for the program. | ||
Sample run: | ||
|
||
```console | ||
student@so:~$ cp src dest | ||
``` | ||
|
||
Use `ltrace` and `strace` to compute the number of library calls and system calls. | ||
Use `perf` to measure the running time. | ||
Use source files of different sizes. | ||
Compare the outputs of these commands on the three programs. | ||
|
||
If you're having difficulties solving this exercise, go through [this](../../../reading/high-level-lang.md) reading material. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ package main | |
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("Hello, World!"); | ||
fmt.Println("Hello, World!") | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# `malloc()` | ||
|
||
## Question Text | ||
|
||
What system calls are invoked by the `malloc()` library call for Linux libc? (choose 2 answers) | ||
|
||
## Question Answers | ||
|
||
+ `brk` | ||
|
||
- `free` | ||
|
||
- `dup` | ||
|
||
+ `mmap` | ||
|
||
- `copy` | ||
|
||
## Feedback | ||
|
||
Depending on the allocation size, `malloc()` invokes `brk` or `mmap`. |
19 changes: 19 additions & 0 deletions
19
chapters/software-stack/libc/drills/questions/printf-syscall.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# printf() System Call | ||
|
||
## Question Text | ||
|
||
What system call does the `printf()` function invoke? | ||
|
||
## Question Answers | ||
|
||
- `read` | ||
|
||
+ `write` | ||
|
||
- `exec` | ||
|
||
- `exit` | ||
|
||
## Feedback | ||
|
||
`printf()` invokes the `write` system call to print messages to standard output. |
22 changes: 22 additions & 0 deletions
22
chapters/software-stack/libc/drills/questions/printf-vs-write.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# printf() vs write | ||
|
||
## Question Text | ||
|
||
What are features provided by `printf()` when compared to `write`? (choose 2 answers) | ||
|
||
## Question Answers | ||
|
||
+ buffering | ||
|
||
- outputs to standard output | ||
|
||
- may write to file | ||
|
||
+ does output formatting | ||
|
||
- can work with binary data | ||
|
||
## Feedback | ||
|
||
`printf()` can do buffering to reduce the number of system calls. | ||
Also, `printf()`, as it name suggests (the `f` suffix), does output formatting. |
19 changes: 19 additions & 0 deletions
19
chapters/software-stack/libc/drills/questions/strcpy-syscall.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# strcpy() System Call | ||
|
||
## Question Text | ||
|
||
What system call does the `strcpy()` function invoke? | ||
|
||
## Question Answers | ||
|
||
- `cpy` | ||
|
||
- `touch` | ||
|
||
- `memcpy` | ||
|
||
+ no system call | ||
|
||
## Feedback | ||
|
||
`strcpy()` doesn't invoke system calls, because it doesn't require any feature that is only provided by the operating system. |
19 changes: 19 additions & 0 deletions
19
chapters/software-stack/libc/drills/questions/syscall-tool.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Syscall Tool | ||
|
||
## Question Text | ||
|
||
Which of following is **not*- and advantage of using libc for programs? | ||
|
||
## Question Answers | ||
|
||
- increased portability | ||
|
||
+ reduced executable size | ||
|
||
- richer set of features | ||
|
||
- easier development | ||
|
||
## Feedback | ||
|
||
When using libc, because we add a new software component, the size of the resulting executable increases. |
Oops, something went wrong.