diff --git a/src/arch/alpha/linux/linux.hh b/src/arch/alpha/linux/linux.hh
--- a/src/arch/alpha/linux/linux.hh
+++ b/src/arch/alpha/linux/linux.hh
@@ -141,6 +141,11 @@
        uint64_t freehigh;  /* Available high memory size */
        uint64_t mem_unit;  /* Memory unit size in bytes */
     } tgt_sysinfo;
+
+    struct tgt_timespec {
+        int64_t tv_sec;
+        int64_t tv_nsec;
+    };
 };
 
 #endif // __ALPHA_ALPHA_LINUX_LINUX_HH__
diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc
--- a/src/arch/alpha/linux/process.cc
+++ b/src/arch/alpha/linux/process.cc
@@ -467,7 +467,7 @@
     /* 337 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc),
     /* 338 */ SyscallDesc("afs_syscall", unimplementedFunc),
     /* 339 */ SyscallDesc("uname", unameFunc),
-    /* 340 */ SyscallDesc("nanosleep", unimplementedFunc),
+    /* 340 */ SyscallDesc("nanosleep", nanosleepFunc<AlphaLinux>),
     /* 341 */ SyscallDesc("mremap", mremapFunc<AlphaLinux>),
     /* 342 */ SyscallDesc("nfsservctl", unimplementedFunc),
     /* 343 */ SyscallDesc("setresuid", unimplementedFunc),
diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc
--- a/src/cpu/o3/cpu.cc
+++ b/src/cpu/o3/cpu.cc
@@ -600,6 +600,19 @@
 
         activeThreads.push_back(tid);
     }
+
+    if (lastActivatedCycle < curTick) {
+        scheduleTickEvent(0);
+
+        // Be sure to signal that there's some activity so the CPU doesn't
+        // deschedule itself.
+        activityRec.activity();
+        fetch.wakeFromQuiesce();
+
+        lastActivatedCycle = curTick;
+
+        _status = Running;
+    }
 }
 
 template <class Impl>
@@ -644,19 +657,6 @@
     } else {
         activateThread(tid);
     }
-
-    if (lastActivatedCycle < curTick) {
-        scheduleTickEvent(delay);
-
-        // Be sure to signal that there's some activity so the CPU doesn't
-        // deschedule itself.
-        activityRec.activity();
-        fetch.wakeFromQuiesce();
-
-        lastActivatedCycle = curTick;
-
-        _status = Running;
-    }
 }
 
 template <class Impl>
@@ -685,9 +685,10 @@
     bool deallocated = deallocateContext(tid, false, 1);
     // If this was the last thread then unschedule the tick event.
     if ((activeThreads.size() == 1 && !deallocated) ||
-        activeThreads.size() == 0)
+        activeThreads.size() == 0) {
         unscheduleTickEvent();
-    _status = Idle;
+        _status = Idle;
+    }
 }
 
 template <class Impl>
@@ -697,6 +698,8 @@
     //For now, this is the same as deallocate
     DPRINTF(O3CPU,"[tid:%i]: Halt Context called. Deallocating", tid);
     deallocateContext(tid, true, 1);
+    if(activeThreads.size() == 1 || activeThreads.size() == 0)
+        _status = Idle;
 }
 
 template <class Impl>
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1226,5 +1226,32 @@
     return sec;
 }
 
+template <class OS>
+SyscallReturn
+nanosleepFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+                ThreadContext *tc)
+{
+    int index = 0;
+    TypedBufferArg<typename OS::tgt_timespec> bufp(process->getSyscallArg(tc, index));
+    bufp.copyIn(tc->getMemPort());
+
+    int sleepCycles = tc->getCpuPtr()->tickToCycles(bufp->tv_sec * SimClock::Int::s + bufp->tv_nsec * SimClock::Int::ns);
+    if(sleepCycles < 0) {
+        sleepCycles = INT_MAX;
+    }
+    DPRINTF(SyscallVerbose, "nanosleep: sleeping for %ld cycles\n", sleepCycles);
+
+    index = 1;
+    TypedBufferArg<typename OS::tgt_timespec> bufret(process->getSyscallArg(tc, index));
+    bufret->tv_sec = 0;
+    bufret->tv_nsec = 0;
+    bufp.copyOut(tc->getMemPort());
+
+    tc->suspend();
+    tc->activate(sleepCycles);
+
+    return 0;
+}
+
 
 #endif // __SIM_SYSCALL_EMUL_HH__
