Fix multi-oom #39

Merged
gk1623 merged 23 commits from userprog-oom into master 2024-11-13 22:09:12 +00:00
6 changed files with 24 additions and 13 deletions
Showing only changes of commit ca9d23edf9 - Show all commits

View File

@@ -82,14 +82,15 @@ process_execute (const char *cmd)
of the process. */ of the process. */
char *file_name = strtok_r (cmd_copy, " ", &data->cmd_saveptr); char *file_name = strtok_r (cmd_copy, " ", &data->cmd_saveptr);
/* NOTE: Currently, the file being executed is closed in load () and then /* NOTE: Currently, the file being executed is closed in load () and then
reopened here. Because load is an exported public function, this reopened here. Because load is an exported public function, this
might be necessary. */ might be necessary. */
lock_acquire (&filesys_lock); lock_acquire (&filesys_lock);
/* Validates that the current file to be executed is a valid file */ /* Validates that the current file to be executed is a valid file */
if (filesys_open (file_name) == NULL) bool valid_file = filesys_open (file_name) != NULL;
return TID_ERROR;
lock_release (&filesys_lock); lock_release (&filesys_lock);
if (!valid_file)
return TID_ERROR;
/* Create a new thread to execute the command, by initializing /* Create a new thread to execute the command, by initializing
it running the function 'start_process' with the appropriate it running the function 'start_process' with the appropriate