Top 10 List of Week 07
-
At first, I was still confused about semaphores. It has sem_init, sem_wait, and sem_post. When I got a question related to semaphores at the quiz, I try to guess what it means and found some articles and videos. Check this video if you are still confused about it!
-
Introduction of Deadlock in Operating System
When I try to read more about the deadlock, I found this article by GeeksForGeeks. It said the most common way to handle it is to ignore the problem altogether. It is the approach that both Windows and UNIX take since it is rare. That’s why they let it happen and reboot the system.
-
A race condition occurs when two threads access and modify a shared variable at the same time. It causes the variable to have a random value. To prevent it, we can lock shared variables, so only one thread at a time has access to the shared variable.
-
Producer - Consumer Problem in Multi-Threading
This problem describes two processes, the producer and the consumer, which share a fixed-size buffer. If you’re curious, you can check this video. It explains the problem and the solution clearly.
-
We can use Peterson’s algorithm to synchronize two processes. It uses two variables, a boolean array of size two and an int variable. Read more about the algorithm in this article!
-
The chmod command allows us to change the permissions of a file using either symbolic or numeric mode or a reference file. Check this article for more details.
-
Mutex is a synchronization primitive that grants exclusive access to the shared resource to only one thread. The Mutex class enforces thread identity. Therefore, a mutex can be released only by the thread that acquired it.
-
If you still need more explanation on Mutex, you can check this video. He explains it in detail and in a way that is pretty easy to understand.
-
In Mutex, only one thread can work with the entire buffer at any point in time. While using a semaphore, it can be more. Read more on this article!
-
The banker’s algorithm is a resource allocation and deadlock avoidance algorithm that tests for safety by simulating the allocation for predetermined maximum possible amounts of all resources. Banker’s algorithm is named so because it is used in the banking system to check whether a loan can be sanctioned to a person or not.