From the dictionary of medical science, starvation is a result of severe or total lack of nutrients that are needed for the maintenance of life. Similarly, in computer science, starvation is a problem that is encountered when multiple threads or processes wait for the same resource, which is called a deadlock.
In order to get out from a deadlock, one of the processes or threads should have to give up or roll back so that the other thread or process can use the resource. If this continuously happens and the same process or thread have to give up or roll back each time while letting other processes or threads to use the resource, then the selected process or thread, which rolled back will undergo a situation called starvation. Therefore, in order to get out from a deadlock, starvation is one of the solutions. Therefore, sometimes starvation is called a kind of a livelock. When there are many high priority processes or threads, a lower priority process or thread will always starve in a deadlock.
There can be many starvations such as starving on resources and starving on CPU. There are many common examples on starvation. They are Readers-writers problem and dining philosophers’ problem, which is more famous. There are five silent philosophers sitting at a round table with bowls of spaghetti. Forks are placed between each pair of adjacent philosophers. Each philosopher must alternately think and eat. However, a philosopher can only eat spaghetti when he has both left and right forks.
- answered 2 years ago
- Gul Hafiz