Add the rest of university notes
This commit is contained in:
366 files changed
+9844
-110
No files matched your search
@@ -43,7 +43,7 @@ The process/thread that acquires the lock must **release the lock** - in contras
|
||||
| Context switches can be **avoided**. | Calls to `acquire()` result in **busy waiting**. Shocking performance on single CPU systems. |
|
||||
| Efficient on multi-core systems when locks are **held for a short time**. | A thread can waste it's entire time slice busy waiting. |
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ Semaphores within the **same process** can be declared as **global variables** o
|
||||
> * `sem_wait()` - decrements the value of the semaphore.
|
||||
> * `sem_post()` - increments the values of the semaphore.
|
||||
|
||||

|
||||

|
||||
|
||||
Synchronising code does result in a **performance penalty**
|
||||
|
||||
@@ -198,7 +198,7 @@ The simplest version of this problem has **one producer**, **one consumer** and
|
||||
* `sync` **synchronises** access to the **buffer** (counter) which is initialised to 1.
|
||||
* `delay_consumer` ensures that the **consumer** goes to **sleep** when there are no items available, initialised to 0.
|
||||
|
||||

|
||||

|
||||
|
||||
It is obvious that any manipulations of count will have to be **synchronised**.
|
||||
|
||||
@@ -231,4 +231,4 @@ A different variant of the problem has `n` consumers and `m` producers and a fix
|
||||
|
||||
The `empty` and `full` are **counting semaphores** and represent **resources**.
|
||||
|
||||

|
||||

|
||||
Reference in new issue
Block a user