Write a tool that simulate mark-and-sweep garbage collection

Assignment Help Database Management System
Reference no: EM131449378

PLC Homework

Overview -

In this homework you will write a tool called simgc that can simulate mark-and-sweep garbage collection on an input reference graph. You will have to parse in that graph, and then simulate mark-and-sweep in a step-by-step fashion on the graph. For each step of mark-and-sweep, you will emit a GraphViz file from your program. GraphViz is a graph description language, and there are tools that can render these files to reasonably nice-looking graphs. You can also render them on the web:

https://www.webgraphviz.com

By emitting these GraphViz files (and then rendering them using the existing GraphViz tools), you can create a sequence of images showing the step-by-step execution of mark-and-sweep on an input graph.

2. Parsing memgraph files

The first part of implementing simgc is to be able to parse in files in memgraph format (a format I am proposing for this assignment). A sample file is graph1.mem. A memgraph file looks like:

1. optional whitespace, then the characters ROOTS: (with the colon).

2. whitespace, then a whitespace-separated list of ids, where an id is any sequence of one or more digits 0 through 9 or lowercase letter. So x, cell, 25, and x1y2 are all legal ids.

3. whitespace, then the characters GRAPH: (with the colon).

4. then a list of edges, where an edge has an id, then whitespace, then the characters ->, then whitespace, and then a whitespace-separated list of ids.

5. then optional whitespace and a semicolon.

See graph1.mem for an example. The idea is that an edge like

a -> b c d ;

Represents three graph edges: from a to b, from a to c, and from a to d.

For this problem, please create a grammar file called memgraph.gr where the name of the grammar (first line of the file) is memgraph and also where the start symbol of the grammar is strt. Compile your grammar using gratr as usual. The simgc.agda file you will modify subsequently assumes that you have done these steps. The parser gratr emits for your memgraph.gr grammar should be able to parse graph1.mem and similar examples.

You will receive full credit for this problem if the parser generated by gratr for your grammar can handle test cases like graph1.mem; we also may test to make sure your grammar is not too liberal in the sense that it accepts files it should not.

3. The garbage collection

Now you can try compiling the simgc.agda file I am providing, which also makes use of a file called mg.agda. Your goal is to write a program that can simulate mark-and-sweep garbage collection on the graph you have parsed in in the previous problem. You should modify the process-strt function of simgc.agda, so that it returns a list of strings. Each string represents a snapshot of the garbage-collection algorithm running on the input graph. The code I am providing in simgc.agda takes care of printing these strings to mem-*.gv files.

For 40 points, you can just show the currently marked nodes and the next node that is to be processed (in either a depth-first or breadth-first traversal of the graph { either is ok). An example for graph1.mem is given in the files mem-*.txt in the hw9 directory (though the code in simgc will print them to mem-*.gv, not .txt). Those files are generated using mg-to-string from the mg.agda file. This requires converting your parse tree to an mg value. In fact, my only official suggestion about how to structure your code is first to convert your parse tree to an mg structure, and then write a traversal function that takes an mg as input and returns a new one as output.

For 60 points, the snapshots should be GraphViz files showing the roots (as arrows from hidden nodes to the actual root nodes) and the graph. The next node to process should be double-circled. Marked nodes should be colored green. See the files mem-*.gv for examples. The files mem-*.jpg show the output you get when running the dot tool (part of the GraphViz package you can install on your computer if you wish) like this:

dot -Tjpg -o mem-0.jpg mem-0.gv

Of course, you have to write a function to print out a data structure (like mg as I am suggesting) in GraphViz format. This is somewhat involved. The last snapshot should show the graph with garbage removed.

Attachment:- Assignment Files.zip

Reference no: EM131449378

Questions Cloud

Cobb-douglas production function : Calculate de marginal product of labor. Find the numerical value of MPL when and. In the equilibrium if we consider that the economy employs 8 workers.
A brief summary of the major issues or problems in the case : A brief summary of the major issues or problems in the case (political, social, cultural, organizational, and ethical issues).
Derive the stochastic linear differential equation : Investigate the stability of the origin for solutions of the stochastic linear differential equation (3.85) if the differentials are interpreted.
Derive the density function of the random variable : Derive the density function of the random variable Z = Y1Y2 management of a fast-food outlet is interested in the joint behavior of the random variables
Write a tool that simulate mark-and-sweep garbage collection : In this homework you will write a tool called simgc that can simulate mark-and-sweep garbage collection on an input reference graph
How to access miami dade databases : Watch: "How to Access Miami Dade Databases". Write a few sentences or a paragraph, integrating a quote, paraphrase, or summary from either of the articles.
In which study does the data support the conclusion : In which study(ies) are the themes of the literature review similar? Different? Who are the authors that you see in common to the literature review.
Problem regarding the argentine economy : What impact would you expect this to have on the Argentine economy?
Evaluates potentially discreditable acts-ethical solutions : Evaluates potentially discreditable acts and provides ethical solutions.

Reviews

len1449378

4/3/2017 5:59:23 AM

The goal of this homework is to implement a basic garbage-collection algorithm in Agda. As usual, the first thing you should do for this homework is copy the les from the hw/hw9 subdirectory of the class repository, to a new hw9 subdirectory of your personal repository, similarly to previous homeworks. As for previous homeworks, you might want to make sure you have correctly submitted your solution via Subversion. Again, just go to the URL for your personal repository using a web browser, log in with your HawkId and password, and you can see what has been submitted. Note that unlike in previous homeworks, I am not going to walk you through a particular way to solve the problem. You will have to come up with a strategy yourself. Note that for purposes of later problems, you may assume that all roots listed in the ROOTS part of a memgraph file are also used in the GRAPH part of the file.

Write a Review

Database Management System Questions & Answers

  Writing down sql query

Write down the SQL code in order to carrying out the following requests. Display all the data in each of the four tables. Do not display the foreign key columns.

  How sql used to retrieve information from a spatial database

What does a spatial database store? How does it store it? How is SQL used to retrieve information from a spatial database? Explain what observer functions are and their role in a spatial database. Provide examples.

  Explain the merits and demerits of dbms-provided security

write a 200- to 300-word short-answer response for the followingdescribe the advantages and disadvantages of

  Drawing a diagram of the data structures

Drawing a diagram of the data structures will help you figure out what you are deallocating as you write your dictionary_free function. This should help you avoid memory leaks.

  Encryption in ensuring confidentiality

Discuss the role of encryption in ensuring confidentiality; use a popular encryption to make your point if needed.

  Explain the different oracle data dictionary views

Explain the different Oracle data dictionary views

  What are some potential problems of poor database design

Discuss some of the ways in which data mining can help a company generate more business. What are some potential problems of poor database design

  Design database by developing a fully attributed data model

Design the database by developing a fully attributed data model. The model should show all tables. Each table should have a primary key and may have foreign keys.

  Use the information and build context data flow diagram

The purpose of the sales and book tracking system is to provide a single central repository of all information about sales leads, books in process, and books for sale. The Sales Department will enter new authors to the system as they gather leads ..

  Create an excel workbook that reports the monthly production

He wants to create an Excel workbook that reports the monthly production at the five sites, including the monthly average, minimum, and maximum production and total production for the previous year.

  What is candidate key and database is a set of one or more

question 1a candidate key isrequired to be unique.used to represent rows in relationships.a candidate to be the primary

  Describe the basic structure of this database

Give an example of a database used (either manual - e.g. a hard copy phone book, or automated/computer based) in your daily life (this can be an example of a database in your home or work), and comment on its usability. Describe the basic structur..

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