Procedure
- Select the number of processes (P) and number of resources (R) and click the SUBMIT button to initialize the data structures, including the Allocation Matrix, Available Matrix (vector), and Maximum Matrix.
- Enter the calculated values into the Need Matrix using the following formula:
Need matrix = Maximum matrix - Allocation matrix - Click on the CHECK button to verify the need matrix.
- Click on the START button to create the Work and Finish Vectors
- Work Vector: Initialize with the current Available vector.
- Finish Vector: Initialize all entries to false to indicate that no processes have been completed yet.
- Click on the NEXT button to:
- Check if the need of process Pi can be satisfied with the current Work vector using:
Needi <= Work - If true:
- Temporarily allocate resources to process Pi.
- Update the Work vector to include the resources that process Pi will release upon completion.
- Mark process Pi as finished (True) in the Finish vector.
- Continue to the next process by repeating step 5 until all processes are marked as finished (True) or no further processes can be satisfied.
- If false:
- Repeat Step 5 until all processes are marked as finished (True) or no further processes can be satisfied.
- Check if the need of process Pi can be satisfied with the current Work vector using:
- Determine the final result: You will obtain either a safe or unsafe sequence based on the completion status of the processes.