Write a program to simulate a dynamic memory subsystem. The program should have function(s) which accept(s) input in the form of pid, allocate, size in bytes, pid, free, address, and pid, resize, address, new size. *** If the requests are valid and adequate space is available, 1) and 3) should return the address of the space granted; otherwise, they should return 0. *** request of the form 2) should return 0 for valid requests and -1 for invalid ones. Create a test trace for at least 5 processes (5 unique pids). Clearly comment your code
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |