ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU-(2020-2021)-1 > student homework > 2018329621186陈魏扬 >
homework-8 Version 0
👤 Author: by 1756894282qqcom 2020-12-15 05:38:29




  1. Boolean Found;





  2. Work = Available; Finish[1..n] = false;





  3. while(true){





  4. //不断的找可执行进程





  5. Found = false;





  6. for(i=1; i<=n; i++){





  7. if(Finish[i]==false && Need[i]<=Work){





  8. Work = Work + Allocation[i];//把放出去的贷款也当做自己的资产





  9. Finish[i] = true;





  10. Found = true;





  11. }





  12. }





  13. if(Found==false)break;





  14. }





  15. for(i=1;i<=n;i++)





  16. if(Finish[i]==false)return “deadlock”; //如果有进程是完不成的,那么就是有死锁


    Security sequence refers to the process of the current application of resources out of a sequence, to ensure that the allocation of resources according to this sequence to complete the process, there will be no "soy sauce and vinegar" embarrassing problems.
    We assume that there are processes P1, P2,..... PN
    Then the security sequence requirements meet: PI (1 < = I < = n) required resources < = remaining resources + allocated to PJ (1 < = J < I) resources
    Why are there resources that have been allocated to the right of the equal sign? Think about the problem of bankers. The resources allocated are like the second developer. If people can pay back the money, we have to take this into account.


Please login to reply. Login

Reversion History

Loading...
No reversions found.