Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
PROCESS_NUM_LIMIT = 32
Browse files Browse the repository at this point in the history
  • Loading branch information
CCXXXI committed Jan 10, 2021
1 parent 03d0f98 commit e8baca1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/userprog/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
/* List of all user processes. */
static struct list all_list;

static int process_num = 1;
enum
{
PROCESS_NUM_LIMIT = 32
};

static thread_func start_process NO_RETURN;
static bool load(const char *cmdline, void (**eip)(void), void **esp);
static void process_load_fail(void);
Expand Down Expand Up @@ -51,6 +57,10 @@ void process_init(void)
thread id, or TID_ERROR if the thread cannot be created. */
tid_t process_execute(const char *file_name)
{
if (process_num == PROCESS_NUM_LIMIT)
return TID_ERROR;
++process_num;

char *fn_copy0, *fn_copy1;
tid_t tid;

Expand Down Expand Up @@ -205,6 +215,8 @@ int process_wait(tid_t child_tid)
/* Free the current process's resources. */
void process_exit(void)
{
--process_num;

struct thread *cur = thread_current();
uint32_t *pd;

Expand Down

0 comments on commit e8baca1

Please sign in to comment.