Machine Problem 1 in Computer Science 125: Operating Systems
- Generate a random number of resources (1-30). Label them as resource 1, resource 2, … , resource 30
- Generate a random number of users (1-30). Label them as user 1, user 2, … , user 30.
- Also, generate the random resource that a user will need and the length of the time that the user will use the resource (1-30 seconds)
- The program should be able to display the status of the resources, including the user currently using the resource, the time (or time left) that the user needs to use the resource
- The program should also be able to list the users “in waiting” of a resource, if there are any, and when these users will be able to start using the resource.
- Finally, the program should be able to say when the resources will be free of users (meaning, no user needs to use the resource).
- A user can only request for a specific resource once. User cannot request for a resource multiple times.
- User request is to be sorted according to priority (by order number, in increasing order)
- Array List
- Queue
- LinkedList
- Array