merge process-wait
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include <hash.h>
|
||||
#include <list.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "threads/synch.h"
|
||||
#include "threads/fixed-point.h"
|
||||
|
||||
/* States in a thread's life cycle. */
|
||||
@@ -30,6 +32,18 @@ typedef int tid_t;
|
||||
#define NICE_DEFAULT 0 /* Default niceness. */
|
||||
#define NICE_MAX 20 /* Highest niceness. */
|
||||
|
||||
/* A process result, synchronised between parent and child. */
|
||||
struct process_result
|
||||
{
|
||||
tid_t tid; /* The tid of the child process. */
|
||||
int exit_status; /* The exit status of the child process. Initially set
|
||||
to -1, then to exit_status when child dies. */
|
||||
struct lock lock; /* Lock the exit_status and sema. */
|
||||
struct semaphore sema; /* Semaphore to signal the parent that the exit_status
|
||||
has been set. */
|
||||
struct list_elem elem; /* List element for the parent's children list. */
|
||||
};
|
||||
|
||||
/* A kernel thread or user process.
|
||||
|
||||
Each thread structure is stored in its own 4 kB page. The
|
||||
@@ -109,6 +123,11 @@ struct thread
|
||||
int nice; /* Nice value for this thread */
|
||||
fp32_t recent_cpu; /* Amount of time this process received */
|
||||
|
||||
/* Process wait properties. */
|
||||
struct process_result *result; /* Result of the process. */
|
||||
struct list child_results; /* List of children's of this thread
|
||||
process results. */
|
||||
|
||||
/* Shared between thread.c and synch.c. */
|
||||
struct list_elem elem; /* List element. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user