Skip to content

Commit ab878c6

Browse files
committed
init commit (90% copy from Anders' exercises)
0 parents  commit ab878c6

File tree

6 files changed

+113
-0
lines changed

6 files changed

+113
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Backup files for emacs
2+
**/*~

Part1/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Part1: Thinking about elevators
2+
---------------------------
3+
4+
Not for handing in, just for thinking about. Talk to other groups, assistants, or even people who have taken the course in previous years.
5+
6+
Brainstorm some techniques you could use to prevent Sverre from being hopelessly stranded, waiting for an elevator that will never arrive. Think about the [worst-case](http://xkcd.com/748/) behaviour of the system.
7+
- What if the software controlling one of the elvators suddeny crashes?
8+
- What if it doesn't crash, but hangs?
9+
- What if a message between machines is lost?
10+
- What if the network cable is suddenly disconnected? Then re-connected?
11+
- What if a user of the system is being a troll?
12+
- What if the elevator car never arrives at its destination?

Part2/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Part2: Version Control
2+
----------------------------------------
3+
4+
If you can read this text you have already taken your first steps in starting to use a version control system.
5+
6+
A version control system is a tool helps a group of people work on the same files in a systematic and safe manner, allowing multiple users to make changes to the same file and merge the changes later. It is also possible to create diverging branches so that multiple independent areas of development can happen in parallel, then have these merged together safely at a later time. Version control systems also keep track of all previous versions of files, so that you can revert any or all changes made since a given date.
7+
8+
In this course we will be using Github Classroom. You will find the assignment texts on Github and will be given private repositories on the TTK4145 organization. This means that, without needing to do anything, teachers and student assistants have access to your code by default. You can create issues that references specific tasks or part of your code while tagging the student assistants to get their attention.
9+
10+
You will not be able to complete this exercise without a very basic practical understanding of git. Unless you're already familiar with git, it's highly recommended to have a look at the following resources before moving on to Part 3 and 4. Don't let the feeling that you have to google everything discourage you, this is perfectly fine, even expected. And don't forget that the student assistants are there to help you.
11+
12+
- Do the [interactive tutorial](https://try.github.io/)
13+
- Play the [Git Game](https://www.git-game.com/)
14+
- [Feature branch workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow)
15+

Part3/README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Part 3: Reasons for concurrency and parallelism
2+
------------------------------------------
3+
4+
To complete this exercise you will have to use git. Create one or several commits that adds answers to the following questions and push it to your groups repository to complete the task.
5+
6+
When answering the questions, remember to use all the resources at your disposal. Asking the internet isn't a form of "cheating", it's a way of learning.
7+
8+
### What is concurrency? What is parallelism? What's the difference?
9+
---
10+
> *Your answer here*
11+
12+
### Why have machines become increasingly multicore in the past decade?
13+
---
14+
> *Your answer here*
15+
16+
### What kinds of problems motivates the need for concurrent execution?
17+
(Or phrased differently: What problems do concurrency help in solving?)
18+
> *Your answer here*
19+
20+
### Does creating concurrent programs make the programmer's life easier? Harder? Maybe both?
21+
(Come back to this after you have worked on part 4 of this exercise)
22+
> *Your answer here*
23+
24+
### What are the differences between processes, threads, green threads, and coroutines?
25+
> *Your answer here*
26+
27+
### Which one of these do `pthread_create()` (C/POSIX), `threading.Thread()` (Python), `go` (Go) create?
28+
> *Your answer here*
29+
30+
### How does pythons Global Interpreter Lock (GIL) influence the way a python Thread behaves?
31+
> *Your answer here*
32+
33+
### With this in mind: What is the workaround for the GIL (Hint: it's another module)?
34+
> *Your answer here*
35+
36+
### What does `func GOMAXPROCS(n int) int` change?
37+
> *Your answer here*

Part4/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Part 4: Finally some code
2+
--------------------
3+
4+
Implement this in C, Python and Go:
5+
6+
7+
global shared int i = 0
8+
9+
main:
10+
spawn thread_1
11+
spawn thread_2
12+
join all threads (wait for them to finish)
13+
print i
14+
15+
thread_1:
16+
do 1_000_000 times:
17+
i++
18+
thread_2:
19+
do 1_000_000 times:
20+
i--
21+
22+
23+
### Delivery
24+
In this exercise you must take advantage of the starter code found in the subdirectories corresponding to the three different programming languages. You must fill out the missing code and make sure your program is working before commiting and pushing the changes to your repository.
25+
26+
At last, you should create a new file called RESULT.md inside this directory explaining what happens and why. Remember to add, commit and push the new file.
27+

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Exercise 1 : Hello World
2+
========================
3+
4+
This exercise does not require that you use the machines at the real-time lab. However, the C code uses POSIX, so you'll need a POSIX-compliant OS, like linux or OSX.
5+
6+
[Go](http://golang.org) has an [interactive "Tour"](http://tour.golang.org/list) you can take. Go's syntax is a bit different, so it may be worth skimming through, or at least using as a quick reference.
7+
8+
## Parts
9+
- [Part 1: Thinking about elevators](./Part1/README.md)
10+
- [Part 2: Set up source control and build tools](./Part2/README.md)
11+
- [Part 3: Reasons for concurrency and parallelism](./Part3/README.md)
12+
- [Part 4: Finally some code](./Part4/README.md)
13+
14+
## Approval
15+
When asking for approval, make sure to prepare the following.
16+
- Part 3:
17+
- The new file with answers filled in (with markdown rendered at github).
18+
- Part 4:
19+
- The newly created file where you discuss the result from this part (with markdown rendered at github).
20+
- The directory containing the code directories (opened in the Github browser).

0 commit comments

Comments
 (0)