Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create 5 small awk programs: count_allocs.awk Script should handle tests like: awk -f count_allocs.awk ../malloc-out.txt > temp.txt diff -w temp.txt test1.txt > diffs.txt freesize.awk Script

Create 5 small awk programs:

  1. count_allocs.awk
    1. Script should handle tests like:
      1. awk -f count_allocs.awk ../malloc-out.txt > temp.txt
      2. diff -w temp.txt test1.txt > diffs.txt
  2. freesize.awk
    1. Script should handle tests like:
      1. awk -f freesize.awk ../malloc-out.txt | head -100 | awk '{sum += $1}END{print sum}' > temp.txt
      2. awk -f freesize.awk ../malloc-out.txt | wc -l >> temp.txt
  3. list_sizes.awk
    1. Script should handle tests like:
      1. awk -f list_sizes.awk ../malloc-out.txt | head -20 | tail -1 > temp.txt
      2. diff -w temp.txt test1.txt > diffs.txt
  4. num_bytes.awk
    1. Script should handle tests like:
      1. awk -f num_bytes.awk ../malloc-out.txt | head -100 | awk '{sum += $1}END{print sum}' > temp.txt
      2. diff -w temp.txt test1.txt > diffs.txt
  5. succ_reqs.awk
    1. Script should handle tests like:
      1. awk -f succ_reqs.awk ../malloc-out.txt | head -10 | tail -1 > temp.txt
      2. diff -w temp.txt test1.txt > diffs.txt
  • Write these awk programs and submit them as described below. Note: the five programs will be tested on simulator output: malloc.txt.

Heres some of malloc.txt simulator output that will be tested with each of the five scripts:

ptr[403] = Alloc(3) returned 1001 (searched 45 elements)

Free List [ Size 44 ]: [ addr:1000 sz:1 ] [ addr:1004 sz:1 ] [ addr:1005 sz:1 ][ addr:1016 sz:5 ] [ addr:1021 sz:1 ] [ addr:1022 sz:5 ] [ addr:1027 sz:1 ] [ adr:1035 sz:1 ] [ addr:1036 sz:1 ] [ addr:1037 sz:2 ] [ addr:1039 sz:1 ] [ addr:106 sz:2 ] [ addr:1048 sz:3 ] [ addr:1051 sz:6 ] [ addr:1057 sz:1 ] [ addr:1058 sz1 ] [ addr:1069 sz:2 ] [ addr:1071 sz:6 ] [ addr:1077 sz:2 ] [ addr:1079 sz:1 ] addr:1095 sz:1 ] [ addr:1096 sz:1 ] [ addr:1097 sz:1 ] [ addr:1098 sz:2 ]

Free(ptr[403]) returned 0

Free List [ Size 45 ]: [ addr:1000 sz:1 ] [ addr:1001 sz:3 ] [ addr:1004 sz:1 ][ addr:1012 sz:4 ] [ addr:1016 sz:5 ] [ addr:1021 sz:1 ] [ addr:1022 sz:5 ] [ adr:1031 sz:4 ] [ addr:1035 sz:1 ] [ addr:1036 sz:1 ] [ addr:1037 sz:2 ] [ addr:105 sz:1 ] [ addr:1046 sz:2 ] [ addr:1048 sz:3 ] [ addr:1051 sz:6 ] [ addr:1057 sz7 ] [ addr:1068 sz:1 ] [ addr:1069 sz:2 ] [ addr:1071 sz:6 ] [ addr:1077 sz:2 ] addr:1088 sz:7 ] [ addr:1095 sz:1 ] [ addr:1096 sz:1 ] [ addr:1097 sz:1 ] [ add

ptr[404] = Alloc(4) returned 1012 (searched 45 elements)

Free List [ Size 44 ]: [ addr:1000 sz:1 ] [ addr:1001 sz:3 ] [ addr:1004 sz:1 ][ addr:1016 sz:5 ] [ addr:1021 sz:1 ] [ addr:1022 sz:5 ] [ addr:1027 sz:1 ] [ adr:1035 sz:1 ] [ addr:1036 sz:1 ] [ addr:1037 sz:2 ] [ addr:1039 sz:1 ] [ addr:106 sz:2 ] [ addr:1048 sz:3 ] [ addr:1051 sz:6 ] [ addr:1057 sz:1 ] [ addr:1058 sz1 ] [ addr:1069 sz:2 ] [ addr:1071 sz:6 ] [ addr:1077 sz:2 ] [ addr:1079 sz:1 ] addr:1095 sz:1 ] [ addr:1096 sz:1 ] [ addr:1097 sz:1 ] [ addr:1098 sz:2 ]

.

.

.

ptr[405] = Alloc(3) returned 1001 (searched 44 elements)

Free List [ Size 43 ]: [ addr:1000 sz:1 ] [ addr:1004 sz:1 ] [ addr:1005 sz:1 ][ addr:1021 sz:1 ] [ addr:1022 sz:5 ] [ addr:1027 sz:1 ] [ addr:1028 sz:1 ] [ adr:1036 sz:1 ] [ addr:1037 sz:2 ] [ addr:1039 sz:1 ] [ addr:1040 sz:1 ] [ addr:108 sz:3 ] [ addr:1051 sz:6 ] [ addr:1057 sz:1 ] [ addr:1058 sz:1 ] [ addr:1059 sz2 ] [ addr:1071 sz:6 ] [ addr:1077 sz:2 ] [ addr:1079 sz:1 ] [ addr:1080 sz:1 ] addr:1096 sz:1 ] [ addr:1097 sz:1 ] [ addr:1098 sz:2 ]

DIRECTIONS:

  • The idea is that the operating system keeps track of memory that it can provide to processes. The processes make Alloc() calls to allocate memory, and Free() calls to release memory. For example, a process calls Alloc(5) to get 5 bytes of memory.
  • The operating system keeps track of free memory in a list, called the free list. The free list contains chunks of free memory. Each line above that starts with Free List is showing the number of elements in the free list, followed by details about each element. Each element represents a chunk of available memory, with values giving the beginning address of the chunk, and the number of bytes in the chunk.
  • In the first Free List line above, the free list has 3 elements. The first element of the list shows 1 byte available at address 1000; the second elements shows 2 bytes available at address 1006, etc.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

is particularly relevant to these issues.)

Answered: 1 week ago

Question

Differentiate the function. r(z) = 2-8 - 21/2 r'(z) =

Answered: 1 week ago

Question

3. How has Starbucks changed since its early days?

Answered: 1 week ago