Add logic for allocating resource

Added logic for allocating resources as well as logic for having
resources have priority on systems