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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!