[SOLVED] CS代考计算机代写 /* Verifies that lowering a thread’s priority so that it is no

30 $

File Name: CS代考计算机代写_/*_Verifies_that_lowering_a_thread’s_priority_so_that_it_is_no.zip
File Size: 828.96 KB

SKU: 5204960557 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


/* Verifies that lowering a thread’s priority so that it is no
longer the highest-priority thread in the system causes it to
yield immediately. */

#include
#include “tests/threads/tests.h”
#include “threads/init.h”
#include “threads/thread.h”

static thread_func changing_thread;

void
test_priority_change(void)
{
/* This test does not work with the MLFQS. */
ASSERT(!thread_mlfqs);

msg(“Creating a high-priority thread 2.”);
thread_create(“thread 2”, PRI_DEFAULT + 1, changing_thread, NULL);
msg(“Thread 2 should have just lowered its priority.”);
thread_set_priority(PRI_DEFAULT – 2);
msg(“Thread 2 should have just exited.”);
}

static void
changing_thread(void *aux UNUSED)
{
msg(“Thread 2 now lowering priority.”);
thread_set_priority(PRI_DEFAULT – 1);
msg(“Thread 2 exiting.”);
}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代考计算机代写 /* Verifies that lowering a thread’s priority so that it is no
30 $