Fix multi-oom #39

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

View File

@@ -170,7 +170,6 @@ start_process (void *proc_start_data)
/* If stack initialization failed, free resources and quit. */ /* If stack initialization failed, free resources and quit. */
if (!success) if (!success)
{ {
process_exit ();
goto fail; goto fail;
} }
@@ -189,7 +188,6 @@ start_process (void *proc_start_data)
fail: fail:
data->success = false; data->success = false;
sema_up (&data->loaded); sema_up (&data->loaded);
thread_exit ();
} }
/* Helper function that initializes the stack of a newly created /* Helper function that initializes the stack of a newly created
@@ -375,10 +373,11 @@ process_exit (void)
/* Free child process results or signal parent's death. */ /* Free child process results or signal parent's death. */
struct list_elem *e; struct list_elem *e;
for (e = list_begin (&cur->child_results); for (e = list_begin (&cur->child_results);
e != list_end (&cur->child_results); e = list_next (e)) e != list_end (&cur->child_results);)
{ {
struct process_result *result struct process_result *result
= list_entry (e, struct process_result, elem); = list_entry (e, struct process_result, elem);
struct list_elem *next = list_next (e);
lock_acquire (&result->lock); lock_acquire (&result->lock);
/* Child has died (and was not waited for). Free the result. */ /* Child has died (and was not waited for). Free the result. */
if (sema_try_down (&result->sema)) if (sema_try_down (&result->sema))
@@ -392,6 +391,7 @@ process_exit (void)
sema_up (&result->sema); sema_up (&result->sema);
lock_release (&result->lock); lock_release (&result->lock);
} }
e = next;
} }
/* Destroy the current process's page directory and switch back /* Destroy the current process's page directory and switch back