{"id":21633310,"url":"https://github.com/vivekpatel111/bankers-algorithm","last_synced_at":"2025-10-14T03:50:29.480Z","repository":{"id":264355121,"uuid":"135454332","full_name":"vivekpatel111/bankers-algorithm","owner":"vivekpatel111","description":"Banker’s Algorithm is a deadlock avoidance algorithm.","archived":false,"fork":false,"pushed_at":"2018-05-30T15:07:15.000Z","size":1472,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T23:48:33.258Z","etag":null,"topics":["algorithms","bankers-algorithm","borland-cpp","c-plus-plus","operating-systems","university-project"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vivekpatel111.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-30T14:25:14.000Z","updated_at":"2023-07-08T06:07:32.000Z","dependencies_parsed_at":"2024-11-23T17:33:04.465Z","dependency_job_id":null,"html_url":"https://github.com/vivekpatel111/bankers-algorithm","commit_stats":null,"previous_names":["vivekpatel111/bankers-algorithm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivekpatel111%2Fbankers-algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivekpatel111%2Fbankers-algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivekpatel111%2Fbankers-algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivekpatel111%2Fbankers-algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vivekpatel111","download_url":"https://codeload.github.com/vivekpatel111/bankers-algorithm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244313827,"owners_count":20433011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","bankers-algorithm","borland-cpp","c-plus-plus","operating-systems","university-project"],"created_at":"2024-11-25T03:00:58.988Z","updated_at":"2025-10-14T03:50:24.455Z","avatar_url":"https://github.com/vivekpatel111.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :bank: Banker's Algorithm :books:\n\nBanker’s Algorithm, which is a deadlock avoidance algorithm. It is called the Banker’s Algorithm, because it could be used by a bank to make sure that money is allocated in such a way that all customer needs are met. When a new process enters the system, it declares the maximum number of instances that are needed. This number cannot exceed the total number of resources in the system. If the process can be accommodated based upon the needs of the system, then resources are allocated, otherwise the process must wait. The algorithm is actually made up of two separate algorithms: the safety algorithm and the resource allocation algorithm.\n\n*This program is tested using Borland C++ Compiler.*\n\n## File Structure\n| File Name | Description |\n| --- | --- |\n| BANKER.CPP | main application |\n| CLASS.CPP | banker class declaration |\n| DEFINE.CPP | banker class definitions |\n| GRAPHICS.CPP | graphics related functions |\n\n## Data Structures\nThe following data structures are needed:\n\n`no_of_process` represents the number of processes and `no_of_resource` represents the number of resource types.\n\n1. Available\n    1. A vector (array) of available resources of each type\n    2. If `available[j] = k`, then `k` instances of `R`\u003csub\u003ej\u003c/sub\u003e are available.\n\n2. Max\n    1. A `n` `no_of_process` by `no_of_resource` matrix\n    2. Defines maximum demand for each process\n    3. `maximum[i][j] = k`, then process `P`\u003csub\u003ei\u003c/sub\u003e may request at most `k` instances of resource `R`\u003csub\u003ej\u003c/sub\u003e.\n\n3. Allocation\n    1. A `n` `no_of_process` by `no_of_resource` matrix\n    2.Defines number of resources of each type currently allocated to each process\n    3. `allocation[i][j]=k`, then process `P`\u003csub\u003ei\u003c/sub\u003e is currently allocated `k` instances of `R`\u003csub\u003ej\u003c/sub\u003e.\n\n4. Need\n    1. A `n` `no_of_process` by `no_of_resource` matrix\n    2. Indicates remaining resource need of each process\n    3. If `need[i][j] = k`, then process `P`\u003csub\u003ei\u003c/sub\u003e needs `k` more instances of `R`\u003csub\u003ej\u003c/sub\u003e.\n    4. `need[i][j] = maximum[i][j] - allocation[i][j]`\n\n## Screenshots\n### Application\n\u003e Main Application Window\n\n![Main Application Window](screenshots/main-screen.png \"Main Application Window\")\n\n### Algorithm\n\n\u003e Safe Sequence Check\n\n![Safe Sequence Check](screenshots/safe-sequence-check.png \"Safe Sequence Check\")\n\n\u003e Safe Sequence Result\n\n![Safe Sequence Result](screenshots/safe-sequence-result.png \"Safe Sequence Result\")\n\n\u003e Algorithm Inprogress\n\n![Algorithm Inprogress](screenshots/inprogress.png \"Algorithm Inprogress\")\n\n\u003e Current State\n\n![Current State](screenshots/current-state.png \"Current State\")\n\n### Extra Flows\n\u003e Input Validation\n\n![Input Validation](screenshots/input-validation.png \"Input Validation\")\n\n\u003e Memory Deallocation\n\n![Memory Deallocation](screenshots/memory-deallocation.png \"Memory Deallocation\")","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivekpatel111%2Fbankers-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvivekpatel111%2Fbankers-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivekpatel111%2Fbankers-algorithm/lists"}