---
# System prepended metadata

title: SyK 14

---

# SyK 14

## Zadanie 1
![](https://i.imgur.com/Y301fOX.png)

## Zadanie 2
![](https://i.imgur.com/6IraO1D.png)
```c
acquire()  {
    while(test_and_set(&lock) == true) {}
}
release() {
    lock = false;
}

wait(S) {
    while(true) {        
        acquire(lock_S);
        if (S > 0){
            S--;
            release(lock_S);
            break;
        }
        release(lock_S);
    }
}

signal(S) {
    acquire(lock_S);
    S++;
    release(lock_S);
}

```
## Zadanie 3
![](https://i.imgur.com/CtDPtbf.png)

