+ 1

Hot to calculate the size of memory to assign given processId and block size in c

I am trying to program a best fit algorithm for assigning a process a size of memory when the method has been given an argument of how much to allocate and the process size, I only know of applying the algorithm when the arguments are arrays. Here is the code int HowMuchToAllocate(int size, int processId){ //return an integer size to assign the process } That is where I am experiencing a problem, Thank You.

21st Mar 2022, 12:53 PM
Timothy Njiru
Timothy Njiru - avatar
1 Réponse
+ 1
Hello Timothy, AFAIK a program (at runtime) can and will request additional resources as it finds necessary, and system (O/S) decides whether the request was to be granted or not. How do we know how much memory a program needs from outside the program itself?
21st Mar 2022, 1:34 PM
Ipang