Question
write an awk script list_sizes.awk that prints the size of every element in the free list, in order, after each Free or Alloc operation. Your
write an awk script list_sizes.awk that prints the size of every element in the free list, in order, after each Free or Alloc operation. Your program should act like this:
$ awk -f list_sizes.awk malloc-out.txt | head
99
1 99
1 92
1 7 92
1 2 92
1 2 84
1 2 8 84
1 5 2 8 84
5 2 8 84
2 8 84
Hint: you can use printf and loops in awk programs. In both cases the syntax is similar to C. Here is an example of an awk program with a loop:
{ n = $1
for (i=0; i < n; i++) {
printf(%s , $(2+i))
}
}
This program assigns the value in field 1 to variable n, then prints fields 2, 3, 4 up to field 2 + n - 1.
I can provide malloc-out.txt if needed!!!!!!
malloc-out.txt:
https://drive.google.com/file/d/17WMZ9mwG_Wr2YtOwdnFfLo9gGBLHM6HL/view
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started