write a small program which allocates memory until no memory is available. Run this program in a terminal window. Open a second terminal window and invoke vmstat tool to observe memory statistics. Write a report which will include:
source code of your program
screen captures of vmstat output
swap memory usage. ie.
Swap
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
I have a limited time please any help this assigment language c code with field is ubuntu(terminal)
Answer:
//C program to allocate a memory until no memory is available.
//Allocates memory from swap area when no memory is available.
#include<stdio.h>
//Header file for malloc ( method used to dynamically allocate a single large block of memory with the specified size)
#include<malloc.h>
int main(){
//Declare a pointer to store address of memory allocated
int *memory_allocator;
//while loop will be executed infinite time
while(1){
/Allocate a memory every time loop executes ,memory will be allocated until no memory is available
memory_allocator=(int *)malloc(sizeof(int));
}
return 0;
}
Visit following google drive link for screenshots.I have attach System moniter screenshots and also vmstat output screenshots and text file contains output of a vmstat command.
drive link: https://drive.google.com/open?id=1eDDxazso9lkItS0cwrXRtXm7_-0BDwxB
write a small program which allocates memory until no memory is available. Run this program in a terminal window. Open a second terminal window and invoke vmstat tool to observe memory statistics. Wri...