Regions and memory management

Assignment Help Basic Computer Science
Reference no: EM13963456

Regions and Memory Management

There are a wide variety of algorithms to chose from when implementing garbage collection for a speci?c language. In this problem, we examine one algorithm for ?nding garbage in pure Lisp (Lisp without side effects) based on the concept of regions. Generally speaking, a region is a section of the program text. To make things simple, we consider each function as a separate region. Region-based collection reclaims garbage each time program execution leaves a region. Because we are treating functions as regions in this problems, our version of region-based collection will try to ?nd garbage each time a program returns from a function call.

(a) Here is a simple idea for region-based garbage collection:

When a function exits, free all the memory that was allocated during execu- tion of the function.

However, this is not correct as some memory locations that are freed may still be accessible to the program. Explain the ?aw by describing a program that could possibly access a previously freed piece of memory. You do not need to write more than four or ?ve sentences; just explain the aspects of an example program that are relevant to the   question.

(b) Fix the method in part (a) to work correctly. It is not necessary for your method to ?nd all garbage, but the locations that are freed should really be garbage. Your answer should be in the following form:

When a function exits, free all memory allocated by the function except....

Justify your answer. (Hint: Your statement should not be more than a sentence or two. Your justi?cation should be a short paragraph.)

(c) Now assume that you have an correctly functioning region-based garbage col- lector. Does your region-based collector have any advantages or disadvantages over a simple mark-and-sweep collector?

(d) Could a region-based collector like the one described in this problem work for impure Lisp? If you think the problem is more complicated for impure Lisp, brie?y explain why. You may consider the problem for C instead of for impure Lisp if you like, but do not give an answer that depends on speci?c properties of C such as pointer arithmetic. The point of this question is to ex- plore the relationship between side effects and a simple form of region-based collection.

Reference no: EM13963456

Questions Cloud

How many photons are incident on surface breast tissue : The entrance exposure during a mammography examination is 100mR. Suppose the photon bean consists of photons each of energy 20 keV. How many photons are incident on a 1 cm^2 surface of breast tissue?
What is the average molar specific heat in this range : The molar specific heat of many materials at low temperatures is found to obey the Debye law C_v = A[T/theta]^3 where A is a constant equal to 1.94 x 10^3 Jmol^-1K^-1 and with the Debye temperature theta taking different values for different mater..
Selling an old a car : John called you late on Friday afternoon with a simple question. He is considering selling an old a car and wants to know what the tax implications will be.
Richard is an employee of the dun construction corp : Richard is an employee of the Dun Construction Corp. While delivering materials to a con- struction site, he carelessly backs Dun's truck into a pas- senger vehicle driven by Green. This is Richard's second accident in six months. When the company ow..
Regions and memory management : There are a wide variety of algorithms to chose from when implementing garbage collection for a speci?c language. In this problem, we examine one algorithm for ?nding garbage in pure Lisp (Lisp without side effects) based on the concept of regions..
Find the frequency at which photon density is a maximum : In lecture we derived a distribution, uf(f)df, for the energy density in cavity radiation as a flurction of frequency. If hf is the energy of a photon, modify this distribution to find a distribution nfdf of photon density as a function of frequenc..
Heat capacity is an intensive quantity extensive quantity : The heat capacity is defined as the amount of energy required to change the temperature of an object. The specific heat capacity is defined as the amount of energy required to change the temperature of an object per mole of the substance.
Complete the home painting : Imagine that your neighbor contracts with a local house painter to have his house painted on Saturday. The contract calls for the painter to begin painting the home on Saturday at 8:00 a.m. and complete the home painting
Single-step income statement into a multiple-step : single-step income statement into a multiple-step income statement for the month ended October 31, 2015. Income Statement For the year ended October

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Create a fully unbalanced bst

I need to create a program written in Java. It needs to create a fully unbalanced BST. It must have 26 levels. It must demonstrate the insertion of elements into the BST.

  Is this problem solvable or unsolvable prove

Assume that the network is a complete graph of n>2 participants. The termination and validity requirements are the same as explained in the class. However, the agreement requirement is weakened to say: "If any process decides 1 then there are at leas..

  Competency standards of the relevant occupational category

That such application meets the competency standards of the relevant occupational category - Please state your target where you are applying

  Create usable human-computer interfaces

Argue that interface usability ultimately determines whether or not a human-computer interface is successful. So, in an essay type format define the terms "human-computer interface", "human-computer interaction", "interaction design", and "usa..

  How would you describe the process of certification

How would you describe the process of certificatio Explain your thoughts regarding the process of accreditation. Is it a formality, or will it guarantee that PVSS will actually correct the remediation finding? Would this opinion regarding accreditati..

  Which property of the matrix multiplication is demonstrated

Define a matrix A = [12 16 4;23 1 21;9 10 1] and B = [2 7 14;3 11 2;-9 10 12]. Perform matrix multiplication A*B, and call this D. Find the transpose of A, and call this E. Find the transpose of B, and call this F. Find the transpose of D, and call t..

  Message exchange patterns in soap

Let two main types of message exchange patterns in SOAP (and operation types in WSDL): (1) request-response and (2) one-way.

  Create a worksheet that computes membership costs

Create a worksheet that calculates membership costs for Buff and Tuff Gym. You will create functions that determine costs based on a condition, lookup membership rates and fees, and calculate monthly payments. You will also create functions that ..

  Describe a scenario in which a network sniffer is warranted

Describe a scenario in which a network sniffer is warranted

  The corresponding sql query

You will use the Employee and Department tables you created previously. Create, run, and test SQL queries to display each set of information below. Save a copy of your queries in a Microsoft Word document. Include a screen shot of the output immediat..

  What feature in windows vista provides a permission dialog

What feature in Windows Vista provides a permission dialog for Standard Users to enter administrator credentials to accomplish various tasks reserved for the latter group

  Compute the stress and strain in a steel rod of diameter

In "C", Write a main function and the following to compute the stress and strain in a steel rod of Diameter (D) inches and length (L) subject to the compression loads P of 10,000 to 1,000,000 pounds in increments of 100,000 pounds. The modulus of ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd