PKUOS - Pintos
Pintos source browser for PKU Operating System course
Data Structures | Functions
alarm-wait.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 alarm-wait.c:

Go to the source code of this file.

Data Structures

struct  sleep_test
 Information about the test. More...
 
struct  sleep_thread
 Information about an individual thread in the test. More...
 

Functions

static void test_sleep (int thread_cnt, int iterations)
 Creates N threads, each of which sleeps a different, fixed duration, M times. More...
 
void test_alarm_single (void)
 
void test_alarm_multiple (void)
 
static void sleeper (void *t_)
 Sleeper thread. More...
 

Function Documentation

◆ sleeper()

static void sleeper ( void *  t_)
static

Sleeper thread.

Definition at line 138 of file alarm-wait.c.

References sleep_thread::duration, sleep_thread::id, lock_acquire(), lock_release(), sleep_thread::test, timer_sleep(), and timer_ticks().

Referenced by test_sleep().

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

◆ test_alarm_multiple()

void test_alarm_multiple ( void  )

Definition at line 22 of file alarm-wait.c.

◆ test_alarm_single()

void test_alarm_single ( void  )

Definition at line 16 of file alarm-wait.c.

◆ test_sleep()

static void test_sleep ( int  thread_cnt,
int  iterations 
)
static

Creates N threads, each of which sleeps a different, fixed duration, M times.

Runs THREAD_CNT threads thread sleep ITERATIONS times each.

Records the wake-up order and verifies that it is valid.

Definition at line 51 of file alarm-wait.c.

References ASSERT, sleep_thread::duration, fail(), free(), sleep_thread::id, sleep_thread::iterations, lock_acquire(), lock_init(), lock_release(), malloc(), msg(), name, NULL, PANIC, PRI_DEFAULT, sleeper(), snprintf(), test(), sleep_thread::test, thread_create(), thread_mlfqs, timer_sleep(), and timer_ticks().

Here is the call graph for this function: