Welcome![Sign In][Sign Up]
Location:
Downloads WEB Code JSP/Java
Title: 多线程调度——哲学家就餐 Download
  • Category:
  • Java Develop
  • Tags:
  • File Size:
  • 66kb
  • Update:
  • 2017-12-19
  • Downloads:
  • 0 Times
  • Uploaded by:
  • 范一二
 Description: Use the JAVA thread to solve the problem of the philosopher's eating. When a philosopher thread performs the way of chopsticks, the program will determine which two chopsticks he needs to use according to the name of the thread, and identify which chopsticks are odd numbers, and try to get the two chopsticks according to the order of odd and even later. If the two chopsticks are not being used (i.e. the corresponding array element value of false), the philosopher has made this thread can be two chopsticks, otherwise it will execute wait in the competition after the failure of chopsticks () into the operation of an instance of the Chopsticks class to wait until the other thread, put down the chopsticks when philosophers after dinner (notifyAll) in its wake. When a philosopher thread puts down the chopsticks, the program sets the value of the array elements corresponding to the dropped chopsticks into false, and wakes up the other threads in the waiting area with notifyAll ().
 Downloaders recently: [More information of uploader 范一二]
 To Search:
File list (Check if you may need any files):
FilenameSizeDate
哲学家就餐.docx 69724 2017-12-12
哲学家问题.txt 2483 2017-12-12

CodeBus www.codebus.net