Lab Report Banker in Nepal Kathmandu –Free Word Template Download with AI
Institution: Department of Computer Science, University Representative in Nepal Kathmandu
Date: October 26, 2023
Laboratory Instructor: Prof. Rajesh Shrestha
Title of Experiment: Operating Systems Resource Management: Implementing the Banker Algorithm for Safe State Detection in Nepal Kathmandu
In the realm of Operating Systems (OS), resource allocation is a critical function. Deadlocks occur when two or more processes are unable to proceed because each is waiting for the other to release a resource. The Banker Algorithm serves as a deadlock avoidance mechanism. It requires that each process declare the maximum number of resources it may need. Before allocating resources, the algorithm checks if there exists an ordering of processes (a safe sequence) such that each process can obtain its needed resources and complete execution.
The context for this specific implementation is Nepal Kathmandu. As the economic and administrative hub of Nepal, Kathmandu faces unique challenges in resource management, particularly regarding limited infrastructure, power distribution, and digital banking services. This lab simulates a scenario where a central "Bank" (representing the OS or a critical service provider in Nepal Kathmandu) must allocate limited resources (such as server bandwidth for digital wallets like eSewa or Khalti during peak hours) among various competing processes (users or banking transactions). This adaptation highlights the practical relevance of theoretical computer science concepts in local infrastructure management.
The Banker Algorithm operates using several data structures:
- Avaliable Vector: Represents the number of available resources for each resource type.
- The maximum demand of each process. Allocation Matrix: Strong>The currently allocated resources to each process. li2. Need Matrix: Strong>The remaining resource needs of each process, calculated as Max - Allocation. ul>
- Check Request against Need: If Requesti[j] > Need[i][j], an error condition is triggered, as the process has exceeded its declared maximum claim. Check Request Against Available: Strong>If Requesti[j] > Available[j], the process must wait as resources are not yet free. li>
- Temporary Allocation: The system pretends to allocate the requested resources by modifying the state:
Avaliable = Avaliable - Request[i]
Allocation[i] = Allocation[i] + Request[j]Need [i ]= Need [i ]-Request code> li3. Safety Algorithm: Strong>The system invokes the safety algorithm to determine if the new state is safe. If yes, the resources are permanently allocated; otherwise, they are rolled back and the process waits. li> ol> This experiment was conducted using a Python-based simulation environment on standard laboratory computers provided by the university in Nepal Kathmandu. The simulation models a system with 5 processes (P0 to P4) and 3 resource types (Type A, Type B, and Type C), representing distinct digital banking services.
4.1 Scenario Definition for Nepal Kathmandu Context
To contextualize the Banker Algorithm, we defined the resources as follows:
- Type A (Processor Time): Strong>Analogous to CPU cycles required for transaction verification. li2. Type B (Memory/Database Access): Strong>Analogous to database concurrency limits in Nepali banking servers. li>
- Type C (Network Bandwidth): Analogous to internet connectivity, which can be variable in certain areas of Nepal Kathmandu. li> ul3.
The initial state of the system was defined with the following Available resources: [3, 3, 2]. The Allocation and Max matrices were initialized to represent heavy traffic during a typical financial peak hour in Nepal Kathmandu.
5.1 Initial State
Process Avaliable [A,B,C] tr2.Max [A,B,C ] Th> li3. Allocation [A,B,C] th> tr2. Tr > P0 td2. Td > 7,5,3 0,1,0 P1 3, 2,
td3.9,
,8
td4. Tr >P2 td2. Td > 6, br/> 2,0,0 TD> TR5. P3 TD> 15,
10
/7 TD>D 3, P4 4, br/> 2,1,0 TD> TR6. Tablep>The Need Matrix was calculated as Max - Allocation. p> The simulation began with Process P1 requesting resources [1, 0, strong >]. The system checked if this request exceeded the Need matrix for P1. It did not. Then, it checked if the request could be satisfied by Available resources [3, 3, 2]. It could. p> The system temporarily allocated the resources and ran the Safety Algorithm. A safe sequence was found: <P1, P3, br/>P4,
/p0,/li>P2>. This confirmed that Nepal Kathmandu's simulated banking server could handle this request without entering a deadlock state.Subsequent requests were made by other processes. For example, when P2 requested [0, 2, strong >], the system again applied the Banker Algorithm. In one instance, granting this request would have left the system in an unsafe state (where no process could finish). Consequently, P2 was forced to wait. This demonstrates the algorithm's core function: refusing potentially dangerous requests to preserve system integrity.
The implementation of the Banker Algorithm in this lab provides valuable insights into resource management within Nepal Kathmandu strong>. In a real-world application, this algorithm could be utilized by the Nepal Rastra Bank or commercial banks to manage server load during high-transaction periods, such as tax filing seasons or festival-related shopping spikes.
The limitation of the Banker Algorithm is that it requires processes to declare maximum needs upfront. In Nepal Kathmandu strong>, dynamic user behavior might make accurate declaration difficult. However, for fixed-structure tasks like batch processing or automated banking settlements, this approach ensures stability.
Furthermore, the analogy of "Banker" is particularly apt for Nepal's financial sector. Just as a physical banker must ensure they have enough cash to meet withdrawal demands without going bankrupt (deadlock), an OS banker must ensure there are enough resources to meet process demands without freezing the system. The lab results showed that strict adherence to safety checks prevents total system failure, a crucial lesson for IT infrastructure development in developing economies like Nepal.
This laboratory experiment successfully implemented and analyzed the Banker Algorithm for deadlock avoidance. By adapting the theoretical framework to a scenario relevant to Nepal Kathmandu strong>, we demonstrated how abstract OS concepts have practical applications in local technology sectors. The results confirmed that the algorithm effectively identifies safe sequences of resource allocation, thereby preventing deadlocks.
The study highlights that while the Banker Algorithm strong > imposes constraints (requiring maximum resource declaration), these constraints are necessary for maintaining system reliability. For Nepal Kathmandu strong>, as it continues to digitize its economy and infrastructure, implementing such robust resource management strategies in backend systems will be vital for ensuring seamless digital banking services and preventing critical system failures.
- Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to Algorithms strong>. MIT Press. li>
- Tanenbaum,A.S.,&Van Steen,M.(2017).Distributed Systems: Principles and Paradigms Strong>. Pearson Education. li>
- Nepal Rastra Bank. (2023). Annual Report on Digital Payment Systems in Nepal Kathmandu strong>. li> ol>
This report was prepared as part of the Operating Systems Laboratory coursework at the University in Nepal Kathmandu.
⬇️ Download as DOCX Edit online as DOCXCreate your own Word template with our GoGPT AI prompt:
GoGPT - Tanenbaum,A.S.,&Van Steen,M.(2017).Distributed Systems: Principles and Paradigms Strong>. Pearson Education. li>
- Type C (Network Bandwidth): Analogous to internet connectivity, which can be variable in certain areas of Nepal Kathmandu. li> ul3.
- Type A (Processor Time): Strong>Analogous to CPU cycles required for transaction verification. li2. Type B (Memory/Database Access): Strong>Analogous to database concurrency limits in Nepali banking servers. li>
If a request for resources arrives from a process Pi, the algorithm executes the following steps:
