Code Monkey home page Code Monkey logo

cs5600_practicum_design_virtual_heap's Introduction

/*
* File Name: README.txt
* Assignment Title: Practicum I - Design Virtual Heap
*
* CS5600 Computer Systems / Northeastern University
* Spring 2023 / March 15, 2023
*
* Created by Chun Sheung Ng (Derrick) & Zhenyu Wang (Sean)
*
*/

Execution Commands:
1. Compiling: make
2. Executing main test: ./test
3. Executing multithread test: ./multithread
4. Cleaning all executables and unused files: make clean

Descriptions:
You need to build a program-managed heap that allows programs to allocate memory for use by the program from that heap.

A key simplifying assumption for this practicum is that the maximum memory that a program can allocate with a single call to your program-managed heap allocation function is the size of a single page in your heap. However, programs must to be able to allocate more memory than you have physical memory available (overcommitment).

When more memory is being allocated by the program your program-managed heap must use the disk as a "backing store" and store pages on disk. For the program to access allocated memory it must call some kind of a function that you need to build and that function must check if the requested memory page is already in the physical memory or if it has to be loaded from disk replacing some other page in physical memory with the page being loaded using some kind of page replacement algorithm.

The program managed heap must be thread-safe and you must demonstrate that it is thread-safe.

Structs defined:
1. var - holds properties of each node of memory allocation.
2. list - creates var_in_heap and holds its capacity, size, head and end.
3. thread_arg - is used for multithreading tests

Main functions:
1. pm_malloc() - takes an amount of certain size, counts the pages needed, allocates them to the pm_heap and record in the pm_heap_usage_records.
2. pm_free() - takes a starting pointer of certain memory block and changes the status of each page in the pm_heap_usage_records.

Helper functions in pm_heap.c:
1. swap-in() - swaps a var pointer from the disk into the heap
2. swap-out() - swaps a var pointer out from the heap to the disk
3. pm_read() - reads the contents of the var pointer. Swaps it back to the heap if it is in disk.
4. pm_write() - writes the contents of the var pointer to files when it is in disk and to heap pointer when it is in heap.

Other helper functions in pm_heap.h:
1. create_var_in_heap()
2. create_var
3. insert_var()
4. delete_var()
5. has_var()
6. has_var_in_heap()
7. print_list_var_in_heap()
8. print_all_vars()
9. enqueue_var_to_heap()
10. dequeue_var_from_heap()
11. find_available_page()

Multi-thread functions:
These are to construct and typecast the "thread_arg" for using pthread and call respective main functions in multithreading tests.
1. t_malloc()
2. t_free()
3. t_read()
4. t_write()

cs5600_practicum_design_virtual_heap's People

Contributors

csheung avatar sespeck avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.