csheung / cs5600_practicum_design_virtual_heap Goto Github PK
View Code? Open in Web Editor NEWCS5600 Practicum I - Design Virtual Heap
CS5600 Practicum I - Design Virtual Heap
/* * 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()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.