void lock_release(struct lock *lock) { KASSERT(lock!=NULL); KASSERT(lock->hold); KASSERT(lock_do_i_hold(lock)); spinlock_acquire(&lock->mut_lock); lock->hold=0; //sem->sem_count++; KASSERT(lock->hold == 0); lock->holder=NULL; wchan_wakeone(lock->mut_wchan); spinlock_release(&lock->mut_lock); // Write this /* KASSERT(lock!=NULL); KASSERT(lock->lockNeed==curthread); spinlock_acquire(&lock->lockNeed); lock->lockNeed==NULL; //thread_wakeup(lock);// wake a thread suppose it waits for the same lock. spinlock_release(&lock->lockNeed); */ //(void)lock; // suppress warning until code gets written }
/*when some condition is meet, cv signal will weak up one thread which currently blocking on the cv's wchan*/ void cv_signal(struct cv *cv, struct lock *lock) { // spinlock_acquire(&cv->cv_lock); wchan_wakeone(cv->cv_wchan); (void)lock; // spinlock_release(&cv->cv_lock); }
void cv_signal(struct cv *cv, struct lock *lock) { KASSERT( lock_do_i_hold(lock) ); wchan_wakeone(cv->cv_wchan); }
void cv_signal(struct cv *cv, struct lock *lock) { KASSERT(cv != NULL); KASSERT(lock != NULL); wchan_wakeone(cv->cv_wchan); (void)lock; //We don't need to modify the lock in this case }
void cv_signal(struct cv *cv, struct lock *lock) { // Write this KASSERT(lock_do_i_hold(lock)); spinlock_acquire(&cv->cv_lock); wchan_wakeone(cv->cv_wchan, &cv->cv_lock); spinlock_release(&cv->cv_lock); }
void lock_release(struct lock *lock) { // Write this KASSERT(lock_do_i_hold(lock)); spinlock_acquire(&lock->lk_lock); lock->lk_holder = NULL; wchan_wakeone(lock->lk_wchan, &lock->lk_lock); spinlock_release(&lock->lk_lock); }
void lock_release(struct lock *lock) { spinlock_acquire(&lock->lk_spinlock); if(lock_do_i_hold(lock)) { lock->lk_owner = NULL; wchan_wakeone(lock->lk_wchan); } spinlock_release(&lock->lk_spinlock); }
void cv_signal(struct cv *cv, struct lock *lock) { // Write this #if OPT_A1 KASSERT(lock != NULL); wchan_wakeone(cv->cv_wchan); #endif // (void)cv; // suppress warning until code gets written // (void)lock; // suppress warning until code gets written }
void lock_release(struct lock *lock) { KASSERT(lock != NULL); spinlock_acquire(&lock->lk_spinlock); KASSERT(lock->lk_owner == curthread); lock->lk_owner = NULL; wchan_wakeone(lock->lk_wchan); spinlock_release(&lock->lk_spinlock); }
void cv_signal(struct cv *cv, struct lock *lock) { // Write this // todo: checks for caller KASSERT(lock->lk_holder == curthread); //wchan_lock(cv->cv_wchan); // todo: got an error from this call, should we unlock here or not? //lock_release(lock); wchan_wakeone(cv->cv_wchan); }
void cv_signal(struct cv *cv, struct lock *lock) { #if OPT_A1 KASSERT(cv != NULL && lock != NULL); KASSERT(curthread->t_in_interrupt == false); spinlock_acquire(&cv->cv_lock); wchan_wakeone(cv->cv_wchan); spinlock_release(&cv->cv_lock); #endif }
void cv_signal(struct cv *mycv, struct lock *mylock) { // Write this wchan_wakeone(mycv->cv_wchan); //end of added stuff // (void)mycv; // suppress warning until code gets written (void)mylock; // suppress warning until code gets written }
void cv_signal(struct cv *cv, struct lock *lock) { KASSERT(cv != NULL); KASSERT(lock != NULL); if(lock_do_i_hold(lock)) { spinlock_acquire(&cv->spin_lock); wchan_wakeone(cv->cv_wchan, &cv->spin_lock); spinlock_release(&cv->spin_lock); } }
void lock_release(struct lock *lock) { if(lock_do_i_hold(lock)) { spinlock_acquire(&lock->spin_lock); spinlock_data_set(&lock->lk_busy,0); lock->lk_cpu = NULL; lock->lk_thread = NULL; wchan_wakeone(lock->lk_wchan, &lock->spin_lock); spinlock_release(&lock->spin_lock); } }
void cv_signal(struct cv *cv, struct lock *lock) { // Write this KASSERT(cv!=NULL); KASSERT(lock!=NULL); KASSERT(lock_do_i_hold(lock)); wchan_wakeone(cv->cv_wchan); //(void)cv; // suppress warning until code gets written //(void)lock; // suppress warning until code gets written }
void cv_signal(struct cv *cv, struct lock *lock) { KASSERT(cv); KASSERT(lock); (void) lock; spinlock_acquire(&cv->cv_lock); wchan_wakeone(cv->cv_wchan, &cv->cv_lock); spinlock_release(&cv->cv_lock); }
void V(struct semaphore *sem) { KASSERT(sem != NULL); spinlock_acquire(&sem->sem_lock); sem->sem_count++; KASSERT(sem->sem_count > 0); wchan_wakeone(sem->sem_wchan); spinlock_release(&sem->sem_lock); }
void lock_release(struct lock *lock) { // Write this KASSERT(lock != NULL); if(lock_do_i_hold(lock) == false) KASSERT(lock_do_i_hold(lock) == true); spinlock_acquire(&lock->lk_spinlock); lock->lk_isheld = false; lock->lk_curthread = NULL; wchan_wakeone(lock->lk_wchan, &lock->lk_spinlock); spinlock_release(&lock->lk_spinlock); //(void)lock; // suppress warning until code gets written }
void lock_release(struct lock *lock) { // Write this spinlock_acquire(&lock->lk_spinlock); // if (lock_do_i_hold(lock)) // { lock->lk_owner = NULL; wchan_wakeone(lock->lk_wchan); //} spinlock_release(&lock->lk_spinlock); //(void)lock; // suppress warning until code gets written }
void lock_release(struct lock *lock) { #if OPT_A1 KASSERT(lock->lock_holder != NULL); spinlock_acquire(&lock->lock_lock); KASSERT(lock_do_i_hold(lock)); lock->lock_holder = NULL; wchan_wakeone(lock->lk_wchan); spinlock_release(&lock->lock_lock); #endif }
void lock_release(struct lock *lock) { // Write this KASSERT(lock != NULL); spinlock_acquire(&lock->lk_spinlock); lock->lock_hold=0; KASSERT(lock->lock_hold== 0); lock->lk_thread= NULL; wchan_wakeone(lock->lock_wchan); spinlock_release(&lock->lk_spinlock); // (void)lock; // suppress warning until code gets written }
void cv_signal(struct cv *cv, struct lock *lock) { // Write this //Peng 2.21.2016 KASSERT(cv!=NULL); KASSERT(lock!=NULL); KASSERT(lock_do_i_hold(lock)); spinlock_acquire(&cv->cv_splk); wchan_wakeone(cv->cv_wchan, &cv->cv_splk); spinlock_release(&cv->cv_splk); //Peng //(void)cv; // suppress warning until code gets written //(void)lock; // suppress warning until code gets written }
void lock_release(struct lock *lock) { #if OPT_A1 KASSERT(lock_do_i_hold(lock)); KASSERT(lock->available == false); spinlock_acquire(&lock->lk_spinlock); lock->available = true; lock->initial_thread = NULL; wchan_wakeone(lock->lock_wchan); spinlock_release(&lock->lk_spinlock); #else (void*)lock; #endif }
void cv_signal(struct cv *cv, struct lock *lock) { // Write this // (void)cv; // suppress warning until code gets written // (void)lock; // suppress warning until code gets written /* * Author: Student * Wake up the wchan which is sleeping on the CV */ if(lock_do_i_hold(lock)) { wchan_wakeone(cv->cv_wchan); } }
void cv_signal(struct cv *cv, struct lock *lock) { #if OPT_A1 KASSERT(cv != NULL); KASSERT(lock != NULL); KASSERT(lock->who_hold == curthread); //spinlock_acquire(&cv->cv_lock); wchan_wakeone(cv->cv_wchan); //spinlock_release(&cv->cv_lock); #else // Write this (void)cv; // suppress warning until code gets written (void)lock; // suppress warning until code gets written #endif }
void cv_signal(struct cv *cv, struct lock *lock) { // Write this #if OPT_A1 KASSERT(cv != NULL); KASSERT(lock != NULL); KASSERT(lock_do_i_hold(lock)); spinlock_acquire(&cv->cv_spinlock); wchan_wakeone(cv->cv_wchan); spinlock_release(&cv->cv_spinlock); #else (void)cv; // suppress warning until code gets written (void)lock; // suppress warning until code gets written #endif }
void lock_release(struct lock *lock) { // Write this #if OPT_A1 KASSERT(lock != NULL); KASSERT(curthread->t_in_interrupt == false); KASSERT(lock->who_hold == curthread); spinlock_acquire(&lock->lk_lock); lock->be_held = false; lock->who_hold = NULL; wchan_wakeone(lock->lk_wchan); spinlock_release(&lock->lk_lock); #else (void)lock; // suppress warning until code gets written #endif }
void lock_release(struct lock *lock) { KASSERT(lock != NULL); spinlock_acquire(&lock->lk_lock); KASSERT(lock->lk_holder == curthread); lock->lk_holder = NULL; wchan_wakeone(lock->lk_wchan, &lock->lk_lock); spinlock_release(&lock->lk_lock); /* Call this when the lock is released */ HANGMAN_RELEASE(&curthread->t_hangman, &lock->lk_hangman); }
void cv_signal(struct cv* cv, struct lock* lock) { // acquire spinlock for atomicity spinlock_acquire(&cv->cv_splock); // release lock so other thread can use it lock_release(lock); // move one TCB in the waiting queue from waiting to ready wchan_wakeone(cv->cv_wchan, &cv->cv_splock); // release spinlock spinlock_release(&cv->cv_splock); // reacquire lock while we have control again lock_acquire(lock); }
void lock_release(struct lock *mylock) { // Write this if(curthread != mylock->owner_thread) { return; } spinlock_acquire(&mylock->lk_spinlock); mylock->owner_thread = NULL; wchan_wakeone(mylock->lk_wchan); spinlock_release(&mylock->lk_spinlock); //end of added stuff // (void)mylock; // suppress warning until code gets written }