Question

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...

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:

  1. source code of your program

  2. screen captures of vmstat output

  3. swap memory usage. ie.

    Swap

    si: Amount of memory swapped in from disk (/s).

    so: Amount of memory swapped to disk (/s).

  4. I have a limited time please any help this assigment language c code with field is ubuntu(terminal)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

Add a comment
Know the answer?
Add Answer to:
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...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT