Schedtool help please

Can anyone help me with the following (prompts are 4 parts at the bottom):

"The command, schedtool (Links to an external site.), is a utility program to query or change CPU-scheduling policies under Linux. Additionally, review the WIkipedia entry regarding Processor Affinity (Links to an external site.).

Install schedtool as follows:
sudo apt install schedtool

Once installed, review the man page for schedtool and learn about the basic capabilities.
man schedtool

Use schedtool to list the scheduling policies and priority min/max for each policy.
schedtool -r

Using the CPU bound PI program, runner.c Download runner.c,
Compile as follows:
gcc -Wall -pedantic -o runner runner.cpp

Execute and ensure that it works and that you understand the output.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//Infinite CPU Bound Program - runner.c

#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

// Infinite CPU bound program
// Stops only when interrupted or killed.
// Every ITERATIONS times through its loop it prints a report of how
// long (in microseconds) it took to do the last ITERATIONS iterations.
// The time is elapsed (wall clock) time (so only an estimate).

static const long int ITERATIONS = 500000000;

int main(int argc, char *argv[])
{
	long		diff=0;
	timeval		start, stop;

	while(1) {						// do test until killed
    
		if(gettimeofday(&start, 0) < 0) {		// get start time
			perror("gettimeofday");
			exit(1);
		}

		for(long i = ITERATIONS; i > 0; i--) {		// the actual 'test'
			// do nothing
		}

		if(gettimeofday(&stop, 0) < 0) {		// get end time
			perror("gettimeofday");
			exit(1);
		}

		diff = stop.tv_sec - start.tv_sec;
		diff *= 1000000; // microseconds per second
		diff += stop.tv_usec - start.tv_usec;
		printf("%ld usecs\n", diff);
	}

	return 0;
}


Display the information about your CPU
At the command line, type
lscpu

Ensure that you have at least 2 cores

Start the Ubuntu System Monitor utility
Select the Resources tab (at top)
View the CPU History

Execution A
Open three (3) terminal windows
Note, if you only have two (2) cores, you can use two (2) windows
Start the runner program execution on all three (3) terminals
Once all three (3) are started
Note the typical time, shown in microseconds
Review the CPU History and note the cores assigned to each process

Execution B
Open three (3) terminal windows
Note, if you only have two (2) cores, you can use two (2) windows
Start the runner program execution on all three (3) terminals with the following command
schedtool -a 0 -e ./runner

Review the CPU History and note the cores assigned to each process
Once all three (3) are started
Note the typical time, shown in microseconds
Review the CPU History and note the cores assigned to each process

Question on Section 1 - CPU Information (1 pts)
Report the information about your CPU.

Question on Section 2 - Scheduling Policies (1 pts)
Report the scheduling policies and priority min/max for each policy.

Question on Section 3 - Execution Results (3 pts)
Report the results from Execution A
Typical time in microseconds
CPUs assigned
Report the results from Execution B
Typical time in microseconds
CPUs assigned

Question on Section 4 - Processor Affinity (10 pts)
Note why the results for B were degraded
Explain when such a thing would be advantageous
Provide a simple example"

Please help me answer these questions!
Have you tried any of this?

Questions 1-3 are just instructions that you follow and list your observations. We can't help you observe this stuff as you have all the steps.

Q4 requires you to think.

No one is going to download all that stuff and run stuff without good reason.
Topic archived. No new replies allowed.