Good example of livelock?

后端 未结 11 1980
后悔当初
后悔当初 2021-01-29 18:44

I understand what livelock is, but I was wondering if anyone had a good code-based example of it? And by code-based, I do not mean \"two people trying to get p

11条回答
  •  臣服心动
    2021-01-29 19:04

    Consider a UNIX system having 50 process slots.

    Ten programs are running, each of which having to create 6 (sub)processes.

    After each process has created 4 processes, the 10 original processes and the 40 new processes have exhausted the table. Each of the 10 original processes now sits in an endless loop forking and failing – which is aptly the situation of a livelock. The probability of this happening is very little but it could happen.

提交回复
热议问题