flâneur — a map of the web's best reading

Efficient Alarm Clock | CS 162 Project 2

cs162.org · 202 words · saved by 1 readers

timer_sleep is useful for threads that operate in real-time (e.g. for blinking the cursor once per second). The current implementation of timer_sleep is inefficient, because it calls thread_yield in a loop until enough time has passed. This consumes CPU cycles while the thread is waiting. Your task is to reimplement timer_sleep so that it executes efficiently without any busy waiting. Back to top Copyright © 2022 CS 162 staff.

Efficient Alarm Clock | CS 162 Project 2 Skip to main content Menu Expand (external link) Document Search Copy Copied CS 162 Project 2 Efficient Alarm Clock In Pintos, threads may call this function to put themselves to sleep: /** * This function suspends execution of the calling thread until time has * advanced by at least x timer ticks. Unless the system is otherwise idle, the * thread need not wake up after exactly x ticks. Just put it on the ready queue * after they have waited for the right number of ticks. The argument to * timer_sleep() is expressed in timer ticks, not in milliseconds o

Explore this link on the map →

related reading