CS318 - Pintos
Pintos source browser for JHU CS318 course
Functions
mlfqs-block.c File Reference
#include <stdio.h>
#include "tests/threads/tests.h"
#include "threads/init.h"
#include "threads/malloc.h"
#include "threads/synch.h"
#include "threads/thread.h"
#include "devices/timer.h"
Include dependency graph for mlfqs-block.c:

Go to the source code of this file.

Functions

static void block_thread (void *lock_)
 Checks that recent_cpu and priorities are updated for blocked threads. More...
 
void test_mlfqs_block (void)
 

Function Documentation

◆ block_thread()

static void block_thread ( void *  lock_)
static

Checks that recent_cpu and priorities are updated for blocked threads.

The main thread sleeps for 25 seconds, spins for 5 seconds, then releases a lock. The "block" thread spins for 20 seconds then attempts to acquire the lock, which will block for 10 seconds (until the main thread releases it). If recent_cpu decays properly while the "block" thread sleeps, then the block thread should be immediately scheduled when the main thread releases the lock.

Definition at line 50 of file mlfqs-block.c.

References lock_acquire(), msg(), start_time, timer_elapsed(), TIMER_FREQ, and timer_ticks().

Referenced by test_mlfqs_block().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_mlfqs_block()

void test_mlfqs_block ( void  )