---
# System prepended metadata

title: Assignment 1

---

<!-- Call the assignment `CS450_aXXX_nhn33.pdf` where `XXX` is the assignment number -->

:::info
**CS 450**

Noah Nuebling
:::

# Assignment 1

## Question 1

Possible program outputs:

```
Starting1
Exiting1
Starting2
Exiting2
```

```
Starting2
Exiting2
Starting1
Exiting1
```

```
Starting1
Starting2
Exiting1
Exiting2
```

## Question 2

Possible program outputs:

```
5
12
```

```
12
5
```

## Question 3

Possible program outputs:

```
Sum: 5
```

```
Sum: 3
```

```
Sum: 8
```

## Question 4

Possible program outputs:

```
2
5
```

```
3
5
```

## Question 5

Possible program outputs:

```
2
5
```

```
3
5
```

```
3
2
```

```
2
3
```

The following cases might occur if `sum` is overriden by thread `B` (race condition) before thread `A` can print `sum`:

![](https://i.imgur.com/HWtBzBi.jpg)


```
3
3
```

```
2
2
```

