Commit Graph
99 Commits
Author SHA1 Message Date
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 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
sBubshait 88967acdaa Update cond_wait to insert into waiters list in sorted order of priority 2024-10-17 08:53:53 +01:00
sBubshait e74ee59e17 Update sema priority compare to take aux optionally as priority of first sema 2024-10-17 08:46:14 +01:00
sBubshait 53b296d6c4 Add function to compare the priority of two semaphores 2024-10-17 08:36:29 +01:00
sBubshait 0d6fb2f167 Update sema_up to yield CPU if unblocked has higher priority 2024-10-17 07:15:10 +01:00
sBubshait 24900545d4 Update sema_down to insert into waiters list in priority sorted order 2024-10-17 06:54:10 +01:00
sBubshait fb268cdef0 Update thread make priority_more public 2024-10-17 06:47:58 +01:00
sBubshait dbb7fd56e3 Update set priority to reorder the list if priority is changed 2024-10-17 06:38:27 +01:00
sBubshait 949455aae5 Update set priority to eliminate race condition when accessing ready list 2024-10-17 06:35:39 +01:00
sBubshait 5c09ff0149 Updated set priority to yield if priority is lowered 2024-10-17 06:27:59 +01:00
sBubshait 9f53040d27 Update thread_set_priority to not do anything if priority is unchanged 2024-10-17 06:00:34 +01:00
sBubshait 62c8818c05 Update thread_yield to add thread back in sorted order of priority 2024-10-16 08:18:51 +01:00
sBubshait fda79173c0 Update thread_unblock to maintain priority order in ready_list 2024-10-16 08:14:00 +01:00
sBubshait 1c53790ca7 Update set_priority to ensure that the new priority is within bounds 2024-10-16 08:13:56 +01:00
sBubshait 9bb0b758c8 Fix Error missing semicolon after function signature 2024-10-16 07:40:41 +01:00
sBubshait 8b3f9e353f Update creating thread to yield if the new thread has higher priority 2024-10-16 07:33:24 +01:00
sBubshait 83910f945c Add priority comparator function for thread list sorting 2024-10-16 07:26:02 +01:00
sBubshait 9f71c989a9 Update gitignore to ignore temporary Mac OS files and code editor folders 2024-10-16 07:10:31 +01:00
sBubshait a28bae3ad1 Add Contributing Guidelines for Group Collaboration 2024-10-15 04:30:59 +01:00