#include "threads/thread.h"#include <debug.h>#include <stddef.h>#include <random.h>#include <stdio.h>#include <string.h>#include "threads/flags.h"#include "threads/interrupt.h"#include "threads/intr-stubs.h"#include "threads/palloc.h"#include "threads/synch.h"#include "threads/vaddr.h"#include "intrinsic.h"
Macros | |
| #define | THREAD_MAGIC 0xcd6abf4b |
| #define | THREAD_BASIC 0xd42df210 |
| #define | TIME_SLICE 4 /* # of timer ticks to give each thread. */ |
| #define | is_thread(t) ((t) != NULL && (t)->magic == THREAD_MAGIC) |
| #define | running_thread() ((struct thread *) (pg_round_down (rrsp ()))) |
Functions | |
| static void | kernel_thread (thread_func *, void *aux) |
| static void | idle (void *aux UNUSED) |
| static struct thread * | next_thread_to_run (void) |
| static void | init_thread (struct thread *, const char *name, int priority) |
| static void | do_schedule (int status) |
| static void | schedule (void) |
| static tid_t | allocate_tid (void) |
| int64_t | get_global_ticks (void) |
| void | set_global_ticks (int64_t ticks) |
| void | thread_awake (int64_t ticks) |
| void | thread_sleep (int64_t ticks) |
| bool | cmp_priority (const struct list_elem *a, const struct list_elem *b, void *aux UNUSED) |
| void | thread_init (void) |
| void | thread_start (void) |
| void | thread_tick (void) |
| void | thread_print_stats (void) |
| tid_t | thread_create (const char *name, int priority, thread_func *function, void *aux) |
| void | thread_block (void) |
| void | thread_unblock (struct thread *t) |
| const char * | thread_name (void) |
| struct thread * | thread_current (void) |
| tid_t | thread_tid (void) |
| void | thread_exit (void) |
| void | thread_yield (void) |
| void | thread_set_priority (int new_priority) |
| int | thread_get_priority (void) |
| void | thread_set_nice (int nice UNUSED) |
| int | thread_get_nice (void) |
| int | thread_get_load_avg (void) |
| int | thread_get_recent_cpu (void) |
| static void | idle (void *idle_started_ UNUSED) |
| void | do_iret (struct intr_frame *tf) |
| static void | thread_launch (struct thread *th) |
Variables | |
| static struct list | ready_list |
| static struct list | sleep_list |
| static struct thread * | idle_thread |
| static struct thread * | initial_thread |
| static struct lock | tid_lock |
| static struct list | destruction_req |
| static int64_t | global_ticks = INT64_MAX |
| static long long | idle_ticks |
| static long long | kernel_ticks |
| static long long | user_ticks |
| static unsigned | thread_ticks |
| bool | thread_mlfqs |
| static uint64_t | gdt [3] = { 0, 0x00af9a000000ffff, 0x00cf92000000ffff } |
| #define is_thread | ( | t | ) | ((t) != NULL && (t)->magic == THREAD_MAGIC) |
| #define running_thread | ( | ) | ((struct thread *) (pg_round_down (rrsp ()))) |
| #define THREAD_BASIC 0xd42df210 |
| #define THREAD_MAGIC 0xcd6abf4b |
| #define TIME_SLICE 4 /* # of timer ticks to give each thread. */ |
|
static |



| void do_iret | ( | struct intr_frame * | tf | ) |


|
static |


| int64_t get_global_ticks | ( | void | ) |

|
static |

|
static |

|
static |


|
static |


|
static |


|
static |


| void set_global_ticks | ( | int64_t | ticks | ) |

| void thread_awake | ( | int64_t | ticks | ) |


| void thread_block | ( | void | ) |


| tid_t thread_create | ( | const char * | name, |
| int | priority, | ||
| thread_func * | function, | ||
| void * | aux | ||
| ) |


| struct thread * thread_current | ( | void | ) |
| void thread_exit | ( | void | ) |


| int thread_get_load_avg | ( | void | ) |
| int thread_get_nice | ( | void | ) |
| int thread_get_priority | ( | void | ) |


| int thread_get_recent_cpu | ( | void | ) |
| void thread_init | ( | void | ) |


|
static |


| const char * thread_name | ( | void | ) |


| void thread_print_stats | ( | void | ) |


| void thread_set_nice | ( | int nice | UNUSED | ) |
| void thread_set_priority | ( | int | new_priority | ) |

| void thread_sleep | ( | int64_t | ticks | ) |


| void thread_start | ( | void | ) |


| void thread_tick | ( | void | ) |


| tid_t thread_tid | ( | void | ) |
| void thread_unblock | ( | struct thread * | t | ) |


| void thread_yield | ( | void | ) |


|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| bool thread_mlfqs |
|
static |
|
static |
|
static |