{"id":217644,"date":"2018-09-15T23:00:12","date_gmt":"2018-09-15T23:00:12","guid":{"rendered":"http:\/\/localhost\/wordpress\/index.php\/2018\/09\/15\/gsp-215-week-6-ilab-virtual-memory\/"},"modified":"2018-10-24T08:39:09","modified_gmt":"2018-10-24T08:39:09","slug":"gsp-215-week-6-ilab-virtual-memory","status":"publish","type":"post","link":"https:\/\/www.benedictsol.com\/blogs\/gsp-215-week-6-ilab-virtual-memory\/","title":{"rendered":"GSP 215 Week 6 iLab Virtual Memory"},"content":{"rendered":"<p>GSP 215 Week 6 iLab\t\u00a0\tWeek 6 Lab&#8221;\ufffdVirtual Memory\t\u00a0\tTCO 9&#8243;\ufffdGiven the need to support the runtime creation of varying quantities of data objects, learn how dynamic memory allocation can provide this capability in a very efficient way.\tTCO 8&#8243;\ufffdGiven the need to understand virtual memory, describe how memory allocation and paging are used to give a computer program access to more memory than physically available.\t\u00a0\t\u00a0\tScenario\tIn this week&#8217;s lab, you will override the new and delete operators for an implementation of linked list.\t\u00a0\tRubric\t\u00a0\tPoint distribution for this activity\tLab Activity\tDocument \ufffd\u00a0 Points possible \ufffd \ufffd\u00a0 Points received\tCode and screenshot\u00a0\u00a0 40 \ufffd\u00a0\u00a0\tTotal Points\u00a0\u00a0\u00a0\u00a0 40 \ufffd\u00a0\u00a0\t\u00a0\t\u00a0\t\u00a0\tGenerally, the default implementation of new and delete is sufficient for a given program. At times, you may want to specialize memory allocation for advanced tasks. You may want to allocate instances of a certain class from a particular memory pool, implement your own garbage collector, or caching.\t\u00a0\tWe will override the new and delete operator in this lab. When overriding these operators, both need to be overridden. The new operator allocates memory and creates an object. The delete operator deallocates memory.\t\u00a0\tWe will be implementing a linked list class and overloading the new and delete operator. We can improve the speed of allocating new nodes by keeping a list of deleted nodes and reusing the memory when new nodes are allocated.\tThe code for the linked list is below. You may also use your own implementation of linked list.\tThe overloaded new operator will check a freelist to recycle a node before going to the heap and getting one that way. The delete operator will add the node to the freelist.\tHint: Use the following in the Node class.\tvoid * operator new(size_t);\tvoid operator delete(void*);\tstatic void printFreelist();\tAfter the class Node definition, be sure to set the freelist to NULL.\tNode* Node::freelist=NULL;\t\u00a0\tImplement Node::printFreelist() as well, and in the Main, include calls to\tNode::printFreelist();\tto see the nodes in the free list.\tOriginal C++ Code:\t#include <iostream>\tusing namespace std;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GSP 215 Week 6 iLab \u00a0 Week 6 Lab&#8221;\ufffdVirtual Memory \u00a0 TCO 9&#8243;\ufffdGiven the need to support the runtime creation of varying quantities of data objects, learn how dynamic memory allocation can provide this capability in a very efficient way. <a href=\"https:\/\/www.benedictsol.com\/blogs\/gsp-215-week-6-ilab-virtual-memory\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-217644","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts\/217644","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/comments?post=217644"}],"version-history":[{"count":0,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts\/217644\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/media?parent=217644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/categories?post=217644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/tags?post=217644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}