Commit Graph
100 Commits
Author SHA1 Message Date
sBubshait f13fd435cd Merge remote-tracking branch 'origin/vm/page-swap-synch' into vm/virtual-memory/saleh
# Conflicts:
#	.gitlab-ci.yml
#	src/Makefile.build
#	src/threads/thread.c
#	src/userprog/exception.c
#	src/userprog/process.c
#	src/vm/frame.c
#	src/vm/page.c
#	src/vm/page.h
#	src/vm/stackgrowth.c
#	src/vm/stackgrowth.h
2024-12-05 02:21:53 +00:00
sBubshait 1a8eb1bbe5 Merge branch 'vm/memory-mapped-files' into vm/virtual-memory/saleh 2024-12-05 01:24:50 +00:00
sBubshait 52ec8fe779 Fix Bug: Grow stack if necessary in case of a page fault in the kernel context 2024-12-05 01:15:46 +00:00
sBubshait f171a05108 Merge branch 'vm/stack-growth/saleh' into vm/virtual-memory/saleh
# Conflicts:
#	src/userprog/exception.c
#	src/userprog/process.c
#	src/userprog/syscall.c
#	src/vm/frame.c
#	src/vm/page.c
#	src/vm/page.h
2024-12-05 00:51:03 +00:00
sBubshait 5265fed288 Refactor stack growth to be helper functions in exception for easier merging 2024-12-05 00:27:40 +00:00
sBubshait 61f6374006 Update gitlab CI to only run the tests associated with this feature (mmapped-files). 2024-12-04 22:06:09 +00:00
sBubshait 26a2d40325 Implement implicitly unmapping all mmapped files when a process exits. Refactor to reduce duplication 2024-12-04 22:00:59 +00:00
sBubshait 806d6bc19e Refactor: Move destroying mmap data into process_exit instead of thread 2024-12-04 21:59:38 +00:00
sBubshait ecbb4e74a5 Implement the unmap system call, writing back to the file if a page is dirty before removing from SPT 2024-12-04 19:07:28 +00:00
sBubshait 02b79d1934 Update mmap to add temporarily page_set_swap until swap is implemented 2024-12-04 18:13:07 +00:00
sBubshait 857cae3578 Update mmap to add a get helper function to find a mmap entry from its mapping 2024-12-04 18:08:05 +00:00
sBubshait 941e1e067a Update SPT page entry to change type from EXECUTABLE to PAGE_FILE to capture mmaps in addition to executables 2024-12-04 17:51:30 +00:00
sBubshait ad6e4b4059 Implement syscall_mmap to validate and then map all file data into a user address in memory 2024-12-04 17:42:53 +00:00
sBubshait 72fa0c1bbb Fix Bug: Initialise the mmap table for the newly created thread rather than the current thread 2024-12-04 17:41:14 +00:00
sBubshait 67f16cb2a6 Update syscall.c to allow mmap and unmap system calls through helper handler functions for each 2024-12-04 15:31:53 +00:00
sBubshait 6b0f708d8f Update mmap to add an insert helper function to allocate and add new mmap entries to the hash table 2024-12-04 15:26:00 +00:00
sBubshait 6e838aa06a Fix Bug in thread.c: Only initialise and destroy mmap files table if VM is defined 2024-12-04 15:24:11 +00:00
sBubshait a2f46f3b72 Add a mmap destroy function to cleanup all mmap hash table entries upon thread exit 2024-12-04 15:14:02 +00:00
sBubshait 1ce09a49a1 Add helper functions to initialise the memory-mapped files table and counter 2024-12-04 15:08:43 +00:00
sBubshait b3042b5aa6 Update thread structure to add mmap files table and a counter for mappings of the thread 2024-12-04 14:56:52 +00:00
sBubshait 85aabd86cd Update gitlab ci file to include mmap tests in the automated testing pipeline 2024-12-04 14:55:28 +00:00
sBubshait acc768e177 Add mmap module in vm defining mmap_entry structure and some helper functions 2024-12-04 13:01:01 +00:00
sBubshait 8047c65227 Update syscall handling of invalid pointers by preloading pages using the helper try_fetch_page 2024-11-29 18:55:28 +00:00
sBubshait d047a3c242 Update Userprog Makefile to include vm files 2024-11-29 18:49:26 +00:00
sBubshait c8b93c57ee Fix: Update writability of the last page after loading as a workaround to calculating the offset, w/ G 2024-11-29 15:45:44 +00:00
sBubshait 92d0b68243 Fix: Avoid closing the file after loading segments to be able to lazily load from file without opening, w/ G 2024-11-29 14:32:55 +00:00
sBubshait 801fd7d310 Implement page fault for lazy loading executables, w/ G 2024-11-28 20:03:50 +00:00
sBubshait df20e0fdfe Update load_segment to load only the metadata of the pages to the SPT, w/ G 2024-11-28 18:35:49 +00:00
sBubshait 97e6e0fb1e Add SPT Helper Functions: Insert, Get, Cleanup w/ G 2024-11-28 18:18:52 +00:00
sBubshait 14fc96febf Implement Supplemental Page Table (SPT) per thread along with structure for its entries, w/ G 2024-11-28 17:54:15 +00:00
sBubshait 8f82f9d747 Fix Bug in fd_counter initialisation when USERPROG is not defined 2024-11-15 16:57:16 +00:00
sBubshait ea3b3594ea Update fd_hash to use the fd itself as the hash value for performance, w/ G & E 2024-11-15 15:53:01 +00:00
sBubshait 6b1dbdd34f Update thread and syscall to use local fd counter instead global one, preventing overflow 2024-11-15 15:48:56 +00:00
sBubshait 7daf4fb079 Refactor process_exit to add more comments for readability 2024-11-15 15:35:07 +00:00
sBubshait a7f1d519da Refactor process_wait to add more comments and improve readability 2024-11-15 15:09:24 +00:00
sBubshait 0f1bce2e88 Refactor process_init_stack to add asserts and comments 2024-11-15 14:52:21 +00:00
sBubshait f4c900e56c Refactor process.c for comments, clarity and readability 2024-11-15 14:37:38 +00:00
sBubshait 82d45880f7 Update validate_user_pointer to start from the beginning of the page rather than the given ptr 2024-11-15 13:51:10 +00:00
sBubshait 1c757ecdfe Update syscall to add more helpful comments for clarity and readability 2024-11-15 13:51:10 +00:00
sBubshait 6a1d10a19b Refactor synch to follow PintOS curly braces indentation style in if statements 2024-11-15 13:51:10 +00:00
sBubshait fa2fb4a711 Refactor system call comments for accuracy and grammar 2024-11-13 18:48:23 +00:00
sBubshait 31ea215805 Refactor validate_user_string to remove unnecessary variable to track length of str 2024-11-13 18:30:24 +00:00
sBubshait 9549ca28e5 Refactor syscall: Use EXIT_FAILURE instead of magic numbers & close files on failure 2024-11-13 18:18:41 +00:00
sBubshait b1c5819469 Avoid masking the struct syscall_arguments using typedef for consistency 2024-11-13 18:06:51 +00:00
sBubshait 287130ca7b Update syscall.c to use syscall_exit on failure instead of calling thread_exit directly 2024-11-13 18:02:08 +00:00
sBubshait 4f586bb4da Fix Bug: Free all entries in the fd hashtable when the process exits, w/ E 2024-11-13 17:42:25 +00:00
sBubshait d890c2353e Add constant MAX_SYSCALL_ARGS to avoid magic numbers [Gleb] 2024-11-13 17:16:15 +00:00
sBubshait eb4f23c290 Add validate_user_string helper function to validate that a string is fully conatined within user vm 2024-11-13 17:11:37 +00:00
sBubshait 26de38cdba Update validate_user_pointer to check if the memory block is mapped into a physical address 2024-11-13 16:39:45 +00:00
sBubshait 6e59e8c9f3 Update validate_user_pointer to be a void function 2024-11-13 16:22:16 +00:00
sBubshait 30e49846b5 Add more tests for system calls to deal with bad buffers given to read and write 2024-11-13 16:21:12 +00:00
sBubshait 115c650c55 Fix Bug in thread initialisation: only init hash if USERPROG is defined 2024-11-08 19:10:42 +00:00
sBubshait e40794e672 Fix Bug in fd_get_file: In case fd not found, then returns NULL, w/ E 2024-11-08 16:48:19 +00:00
sBubshait 8912ef4660 Implement writing to file system files in the write system call, w/ E 2024-11-08 16:26:47 +00:00
sBubshait 2a1cc3c361 Implement filesize and tell system calls, w/ E 2024-11-08 16:14:53 +00:00
sBubshait a80084e907 Fix Bug in fd_get_file declaration use open_file instead of file, w/ E 2024-11-08 15:54:28 +00:00
sBubshait 5424276603 Add a helper function to get a file from its descriptor (FD), w/ E 2024-11-08 15:50:48 +00:00
sBubshait 5bd94894e0 Update thread structure to add a hash table of open files and initialise it, w/ E 2024-11-08 15:13:04 +00:00
sBubshait 5bbe7a03c0 Add in syscall hash helper functions for open_file struct: fd_hash and fd_less, w/ E 2024-11-08 15:12:08 +00:00
sBubshait b112824a64 Implement the exec system call through process_execute, w/ E 2024-11-08 14:41:27 +00:00
sBubshait 26e38be761 Update validate_user_pointer to check if the ptr is mapped to a physical memory address, w/ E 2024-11-08 14:21:16 +00:00
sBubshait 39018419cd Fix Bug in Process.c to print the exit statement in process_exit instead of exit syscall to handle unexpected/bad exits 2024-11-07 12:15:29 +00:00
sBubshait 6a3cf67d33 Fix Bug in process.c initialising a char to NULL 2024-11-07 11:55:26 +00:00
sBubshait 2bfde66d22 Merge remote-tracking branch 'origin/user-programs-stdout' into system-calls 2024-11-07 11:45:36 +00:00
sBubshait fcb7e9e441 Update setup_stack to temporarily fake set-up for a stack to prevent page faults in no arg user programs 2024-11-06 15:48:27 +00:00
sBubshait ab716de0a6 Update process_wait to temporarily sleep for 1 second to allow user programs to run 2024-11-06 15:46:47 +00:00
sBubshait 91cef4d650 Refactor lock release and sema up to remove unnecessary code 2024-11-06 15:36:56 +00:00
sBubshait 5aac37d167 Add temporary fixes to process_wait and setup stack, w/ E 2024-11-05 23:28:17 +00:00
sBubshait 02fff62ca2 Refactor syscall.c to follow PintOS styling, w/ E 2024-11-05 23:24:41 +00:00
sBubshait 01933cb5de Implement the write system call, w/ E 2024-11-05 23:07:07 +00:00
sBubshait e9c4061531 Implement the exit system call, w/ E 2024-11-05 22:38:45 +00:00
sBubshait 2dccd87a76 Update thread to add exit_status, intialised to -1, into the thread structure, w/ E 2024-11-05 22:38:09 +00:00
sBubshait 5e2342fad7 Update syscall to make syscall_number an unsigned integer instead of an int 2024-11-04 00:49:47 +00:00
sBubshait 0d057da3dc Refactor syscall to follow PintOS style in adding space after after function name in calls 2024-11-04 00:48:36 +00:00
sBubshait 79f6a8e808 Fix Bug in syscall handler related to pointer arithmetic: add sizeof uintptr_t instead of 1 2024-11-04 00:44:55 +00:00
sBubshait 3a258cf064 Update validate_user_pointer to perform no memory checks when size is 0 2024-11-04 00:38:58 +00:00
sBubshait e718159ed8 Update syscall to use screaming uppercase casing for a constant 2024-11-04 00:29:07 +00:00
sBubshait ade8faf0f4 Update syscall to add more comments explaining the basic handler 2024-11-04 00:20:09 +00:00
sBubshait d626b7a392 Implement basic syscall_handler using the lookup table, w/ E 2024-11-03 23:47:22 +00:00
sBubshait 62453ef432 Add a look up table from system call numbers to their handler functions, w/ E 2024-11-03 22:54:03 +00:00
sBubshait 0bf5fdb0e5 Add syscall_function type definition for the different syscall handlers, w/ E 2024-11-03 22:28:17 +00:00
sBubshait c2414ec54d Add priority_less for comparing threads based on priority and Refactor sema up to use list_max for clarity 2024-10-25 16:04:55 +01:00
sBubshait 30ab3ae861 Update thread_create to only yield CPU to the new thread if necessary 2024-10-25 15:47:19 +01:00
sBubshait 81309dcda9 Refactor sema_up to follow PintOS styling of if statements 2024-10-25 15:44:56 +01:00
sBubshait 4879775d0b Update donate priority to add an assertion that intrrupts are disabled, w/ T 2024-10-23 16:32:40 +01:00
sBubshait 6223846fde Update lock_acquire to disable interrupts to eliminate race-conditions, w/ T 2024-10-23 16:30:38 +01:00
sBubshait d82176a2e2 Refactor lock release to follow PintOS indent style and use list functoins, w/ T 2024-10-22 22:52:29 +01:00
sBubshait 78c6fd36e3 Refactor sema_up to add comments for clarity, w/ T 2024-10-22 21:04:14 +01:00
sBubshait 5549b9c0cb Refactor thread recalculate priority to add comments for clarity, w/ T 2024-10-22 20:52:52 +01:00
sBubshait bf6104200c Refactor thread set priority to remove unused variable and add comment, w/ T 2024-10-22 20:47:34 +01:00
sBubshait 244db41434 Update condvar to use linear search due to changes in priority from donations, w/ T 2024-10-22 20:25:13 +01:00
sBubshait d9b9572631 Fix Bug in recalculating priority, uses 'elem' instead of 'donor_elem', w/ T 2024-10-22 19:49:53 +01:00
sBubshait 7f7b1648cd Fix indentation in recalculate priority to match pintos style, w/ T 2024-10-20 22:28:29 +01:00
sBubshait 44de31c0ff Fix Bug in Implementation of recalculate priority setting base priority, w/ T 2024-10-20 20:54:48 +01:00
sBubshait b1dba1a0bd Add implementation for recalculate effective priority, w/ T 2024-10-20 20:37:03 +01:00
sBubshait 343ac55d37 Implement priority donation helper function with propagation, w/ T 2024-10-20 19:42:35 +01:00
sBubshait 5a651f1279 Update implementation of thread set priority to account for donations, w/ T 2024-10-20 18:06:07 +01:00
sBubshait 8b1e0b9559 Add donation-related information to the thread structure, w/ T 2024-10-20 17:04:14 +01:00
sBubshait bfdedc53e2 Update set priority so not to yield if no ready threads 2024-10-17 19:46:10 +01:00
sBubshait c9a9d57019 Merge branch 'task1/priority-scheduling' into task1/merged/priority-scheduling
# Conflicts:
#	.gitignore
#	src/threads/synch.c
#	src/threads/thread.c
2024-10-17 19:30:19 +01:00