PKUOS - Pintos
Pintos source browser for PKU Operating System course
Functions | Variables
priority-donate-multiple2.c File Reference
#include <stdio.h>
#include "tests/threads/tests.h"
#include "threads/init.h"
#include "threads/synch.h"
#include "threads/thread.h"
Include dependency graph for priority-donate-multiple2.c:

Go to the source code of this file.

Functions

void test_priority_donate_multiple2 (void)
 
static void a_thread_func (void *lock_)
 
static void b_thread_func (void *lock_)
 
static void c_thread_func (void *a_ UNUSED)
 

Variables

static thread_func a_thread_func
 The main thread acquires locks A and B, then it creates three higher-priority threads. More...
 
static thread_func b_thread_func
 
static thread_func c_thread_func
 

Function Documentation

◆ a_thread_func()

static void a_thread_func ( void *  lock_)
static

Definition at line 65 of file priority-donate-multiple2.c.

References lock_acquire(), lock_release(), and msg().

Here is the call graph for this function:

◆ b_thread_func()

static void b_thread_func ( void *  lock_)
static

Definition at line 76 of file priority-donate-multiple2.c.

References lock_acquire(), lock_release(), and msg().

Here is the call graph for this function:

◆ c_thread_func()

static void c_thread_func ( void *a_  UNUSED)
static

Definition at line 87 of file priority-donate-multiple2.c.

References msg().

Here is the call graph for this function:

◆ test_priority_donate_multiple2()

void test_priority_donate_multiple2 ( void  )

Definition at line 28 of file priority-donate-multiple2.c.

Variable Documentation

◆ a_thread_func

thread_func a_thread_func
static

The main thread acquires locks A and B, then it creates three higher-priority threads.

The first two of these threads block acquiring one of the locks and thus donate their priority to the main thread. The main thread releases the locks in turn and relinquishes its donated priorities, allowing the third thread to run.

In this test, the main thread releases the locks in a different order compared to priority-donate-multiple.c.

Written by Godmar Back gback.nosp@m.@cs..nosp@m.vt.ed.nosp@m.u. Based on a test originally submitted for Stanford's CS 140 in winter 1999 by Matt Franklin start.nosp@m.led@.nosp@m.lelan.nosp@m.d.st.nosp@m.anfor.nosp@m.d.ed.nosp@m.u, Greg Hutchins gmh@l.nosp@m.elan.nosp@m.d.sta.nosp@m.nfor.nosp@m.d.edu, Yu Ping Hu yph@c.nosp@m.s.st.nosp@m.anfor.nosp@m.d.ed.nosp@m.u. Modified by arens.

Definition at line 23 of file priority-donate-multiple2.c.

◆ b_thread_func

thread_func b_thread_func
static

Definition at line 24 of file priority-donate-multiple2.c.

◆ c_thread_func

thread_func c_thread_func
static

Definition at line 25 of file priority-donate-multiple2.c.