GoGPT GoSearch New DOC New XLS New PPT

OffiDocs favicon

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

The primary objective of this laboratory experiment is to understand, implement, and analyze the Banker Algorithm, a deadlock avoidance algorithm originally proposed by Edsger W. Dijkstra. The simulation specifically adapts the theoretical model to reflect resource allocation scenarios relevant to Nepal Kathmandu. By mapping operating system concepts such as processes and resources to real-world entities in the capital city, this lab aims to demonstrate how a banking system can prevent deadlock by ensuring that resource requests are granted only if they lead to a safe state.

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:The currently allocated resources to each process.Need Matrix: The remaining resource needs of each process, calculated as Max - Allocation.

    If a request for resources arrives from a process Pi, the algorithm executes the following steps:

    1. Check Request against Need: If Requesti[j] > Need[i][j], an error condition is triggered, as the process has exceeded its declared maximum claim.
    2. Check Request Against Available: If Requesti[j] > Available[j], the process must wait as resources are not yet free.
    3. 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 Safety Algorithm: 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.

      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): Analogous to CPU cycles required for transaction verification.Type B (Memory/Database Access): Analogous to database concurrency limits in Nepali banking servers.
      • Type C (Network Bandwidth): Analogous to internet connectivity, which can be variable in certain areas of Nepal Kathmandu.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

        Max [A,B,C ] Allocation [A,B,C]
        ProcessAvaliable [A,B,C]P07,5,30,1,0
        P13,9,
        ,8
        P2 6,2,0,0P315,
        10
        /7D 3,
        P44,2,1,0The Need Matrix was calculated as Max - Allocation. The simulation began with Process P1 requesting resources [1, 0,]. 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.

        The system temporarily allocated the resources and ran the Safety Algorithm. A safe sequence was found: <P1, P3,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,], 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. 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, 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, 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 imposes constraints (requiring maximum resource declaration), these constraints are necessary for maintaining system reliability. For Nepal Kathmandu, 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.

        1. Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to Algorithms. MIT Press.
        2. Tanenbaum,A.S.,&Van Steen,M.(2017).Distributed Systems: Principles and Paradigms. Pearson Education.
        3. Nepal Rastra Bank. (2023). Annual Report on Digital Payment Systems in Nepal Kathmandu.

          This report was prepared as part of the Operating Systems Laboratory coursework at the University in Nepal Kathmandu.

          ⬇️ Download as DOCX Edit online as DOCX

          Create your own Word template with our GoGPT AI prompt:

          GoGPT