D7net Mini Sh3LL v1
Current File : //usr/share/doc/libselinux1/../libgpm2/../sosreport/../libksba8/../maria/examples/resource.pn |
typedef unsigned (1..5) process;
typedef enum { a, b, c } resource;
typedef unsigned (0..10) amount;
typedef struct { process p; resource r; amount a; } allocation;
place available resource: 3#a, 2#b, 2#c;
place allocated (#process*#resource) allocation:
{1,a,0},{1,b,1},{1,c,0},
{2,a,2},{2,b,0},{2,c,0},
{3,a,3},{3,b,0},{3,c,2},
{4,a,2},{4,b,1},{4,c,1},
{5,a,0},{5,b,0},{5,c,2};
place need (#process*#resource) allocation:
{1,a,7},{1,b,4},{1,c,3},
{2,a,1},{2,b,2},{2,c,2},
{3,a,6},{3,b,0},{3,c,0},
{4,a,0},{4,b,1},{4,c,1},
{5,a,4},{5,b,3},{5,c,1};
place freeing resource;
trans allocate
in {
place available: r;
place need: { p, r, need };
place allocated: { p, r, allocated };
}
out {
place need: { p, r, |need };
place allocated: { p, r, is amount (allocated + 1) };
}
gate need != 0;
trans free
in {
place allocated: resource r: { p, r, .need };
place need: resource r: { p, r, 0 };
}
out {
place allocated: resource r: { p, r, 0 };
place need: place need;
place freeing: resource r: is amount .need#r;
};
trans return
in {
place freeing: r;
}
out {
place available: r;
};
AnonSec - 2021 | Recode By D7net