From 11c1519a12cdae1ce05d31a6e389a103259c6c93 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 26 Mar 2012 20:18:23 +0200 Subject: first timer alarm implementation --- pintos-progos/threads/thread.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'pintos-progos/threads') diff --git a/pintos-progos/threads/thread.h b/pintos-progos/threads/thread.h index eebf42c..9cc5ef7 100644 --- a/pintos-progos/threads/thread.h +++ b/pintos-progos/threads/thread.h @@ -76,11 +76,13 @@ typedef int tid_t; set to THREAD_MAGIC. Stack overflow will normally change this value, triggering the assertion. */ /* The `elem' member has a dual purpose. It can be an element in - the run queue (thread.c), or it can be an element in a - semaphore wait list (synch.c). It can be used these two ways - only because they are mutually exclusive: only a thread in the - ready state is on the run queue, whereas only a thread in the - blocked state is on a semaphore wait list. */ + the run queue (thread.c), it can be an element in a semaphore + wait list (synch.c), or it can be an element in the alarm sleep + list (timer.c). It can be used these two ways only because they + are mutually exclusive: only a thread in the ready state is on + the run queue, only a thread in the blocked state is on a semaphore + wait list, whereas only a thread waiting for an alarm event is on + the alarm sleep list. */ struct thread { /* Owned by thread.c. */ @@ -91,7 +93,7 @@ struct thread int priority; /* Priority. */ struct list_elem allelem; /* List element for all threads list. */ - /* Shared between thread.c and synch.c. */ + /* Shared between thread.c, synch.c and timer.c. */ struct list_elem elem; /* List element. */ #ifdef USERPROG @@ -103,6 +105,8 @@ struct thread /* Owned by thread.c. */ unsigned magic; /* Detects stack overflow. */ + + int64_t alarm_tick; /* absolute tick when to trigger an alarm event */ }; /* If false (default), use round-robin scheduler. -- cgit v1.2.3