From ea6d723dbd68fc3fef10f603ae68dd80be3f6155 Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Tue, 17 Sep 2024 11:20:58 +0200 Subject: [PATCH] WIP Added The bankers algorithm --- chp7_deadlock/bankers/main.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 chp7_deadlock/bankers/main.go diff --git a/chp7_deadlock/bankers/main.go b/chp7_deadlock/bankers/main.go new file mode 100644 index 0000000..3207b5d --- /dev/null +++ b/chp7_deadlock/bankers/main.go @@ -0,0 +1,27 @@ +package main + +import "os" + +const ( + FREE int = iota + ALLOCATED int = iota +) + +type Resource interface { + Type() int +} + +type ResourceManager interface { + Available(r Resource) bool + Assign(r Resource, p os.Process) Resource + Release(r Resource, p os.Process) (bool, error) +} + +type bankerResourceManager struct { + available [][]int + total [][]int + allocated [][]int +} + +func main() { +}