Ask DBMS Expert


Home >> DBMS

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:

http://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

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M92258118

Have any Question?


Related Questions in DBMS

Data mining assignment -in this assignment you are asked to

Data Mining Assignment - In this assignment you are asked to explore the use of neural networks for classification and numeric prediction. You are also asked to carry out a data mining investigation on a real-world data ...

Sql query assignment -for this assignment you are to write

SQL Query Assignment - For this assignment you are to write your answers in a word document. This assignment is in three parts: Part A (reporting queries), Part B (query performance), Part C (query design). For this assi ...

The groceries datasetimagine 10000 receipts sitting on your

The groceries Dataset Imagine 10000 receipts sitting on your table. Each receipt represents a transaction with items that were purchased. The receipt is a representation of stuff that went into a customer's basket. That ...

You are in a real estate business renting apartments to

You are in a real estate business renting apartments to customers. Your job is to define an appropriate schema using SQL DDL in MySQL. The relations are Property(Id, Address, NumberOfUnits), Unit(ApartmentNumber, Propert ...

Objectivethe objective of this lab is to be familiar with a

OBJECTIVE: The objective of this lab is to be familiar with a process in big data modeling. You're required to produce three big data models using the MS PowerPoint software. This tool is available on UMUC Virtual Deskto ...

The relation memberstudentid organizationid roleid stores

The relation Member(StudentId, OrganizationId, RoleId) stores the membership information of student joining organization. For example, ('S1', 'O2', 'R3') indicates that student with Id 'S1' joined the organization with i ...

Relational database exerciseyou have been assigned to a new

Relational Database Exercise: You have been assigned to a new development team. A client is requesting a relational database system to manage their present store with the anticipation of adding more stores in the future. ...

Relational database design a given the following business

Relational Database Design A) Given the following business rules, identify entity types, attributes (at least two attributes for each entity, including the primary key) and relationships, and then draw an Entity-Relation ...

We can represent a data set as a collection of object nodes

We can represent a data set as a collection of object nodes and a collection of attribute nodes, where there is a link between each object and each attribute, and where the weight of that link is the value of the object ...

Data model development and implementationpurpose of the

Data model development and implementation Purpose of the assessment (with ULO Mapping) The purpose of this assignment is to develop data models and map Database System into a standard development environment to gain unde ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As