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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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