-
Notifications
You must be signed in to change notification settings - Fork 0
/
written_answers.txt
255 lines (186 loc) · 10.4 KB
/
written_answers.txt
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
Answers for parts 1 - 5
Enter your answers in the designated location. Do NOT remove lines that start
with '=' signs. Removing these lines will break our grading scrips and will
result in 0 points. Also, keep lines to a max of 80 chars long (you do not
need to worry if the top command is longer than 80 chars). Also, please limit
your answers to about 40 words.
================================== P1Q1 start ==================================
Describe how you created the 70%/30% split.
We find that when nice = 16, the weight is 29. And when nice = 12, weight is 70. And
29/70 is close to 30/70. Then we design a program myprogram where we fork 5 times, and
we use while(1) to make it run forever. By using the terminal command, we run the
myprogram twice with different nice value.
- Include the command lines you executed
taskset -c 1 nice -n 12 ./program &
taskset -c 1 nice -n 16 ./program &
htop
- Indicate if you needed root privileges for any of those commands
No command need root privilege
- Include the top output
0[| 1.3%] Tasks: 83, 109 thr; 2 running
1[|||||||||||||||||||||||||100.0%] Load average: 9.99 6.86 3.90
Mem[|||||||||||||||||||||489M/3.81G] Uptime: 02:22:31
Swp[ 0K/975M]
PID▽USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
2101 debbie 36 16 2172 72 0 R 6.0 0.0 0:17.36 ./program
2100 debbie 36 16 2172 72 0 R 6.6 0.0 0:17.37 ./program
2099 debbie 36 16 2172 72 0 R 6.0 0.0 0:17.36 ./program
2098 debbie 36 16 2172 72 0 R 6.0 0.0 0:17.36 ./program
2097 debbie 36 16 2172 72 0 R 6.6 0.0 0:17.37 ./program
2095 debbie 32 12 2172 68 0 R 13.9 0.0 0:42.49 ./program
2094 debbie 32 12 2172 68 0 R 14.6 0.0 0:42.49 ./program
2093 debbie 32 12 2172 68 0 R 13.9 0.0 0:42.48 ./program
2092 debbie 32 12 2172 68 0 R 13.9 0.0 0:42.49 ./program
2091 debbie 32 12 2172 68 0 R 13.9 0.0 0:42.48 ./program
=================================== P1Q1 end ===================================
================================== P1Q2 start ==================================
Describe how you created a real-time priority task.
We create a new program myprogram2. The only change we made from myprogram is that
we fork one more time in myprogram2 and set the new process to be real time by
sched_setscheduler().
- Include the command lines you executed
taskset -c 1 nice -n 16 ./program &
sudo taskset -c 1 nice -n 12 ./program2 &
htop
- Indicate if you needed root privileges for any of those commands
Running myprogram2 need root privilege because it sets the schedule policy of a
process.
- Include the top output
0[||| 5.3%] Tasks: 82, 113 thr; 2 running
1[||||||||||||||||||||||||100.0%] Load average: 11.81 6.69 2.78
Mem[|||||||| 437M/3.81G] Uptime: 00:04:49
Swp[ 0K/975M]
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command△
1061 debbie 36 16 2172 68 0 R 0.0 0.0 0:01.24 ./program
1062 debbie 36 16 2172 68 0 R 0.0 0.0 0:01.24 ./program
1063 debbie 36 16 2172 68 0 R 0.7 0.0 0:01.25 ./program
1064 debbie 36 16 2172 68 0 R 0.7 0.0 0:01.25 ./program
1065 debbie 36 16 2172 68 0 R 0.7 0.0 0:01.25 ./program
1068 root 32 12 2172 68 0 R 0.0 0.0 0:01.59 ./program2
1069 root 32 12 2172 68 0 R 0.7 0.0 0:01.59 ./program2
1070 root 32 12 2172 68 0 R 0.7 0.0 0:01.59 ./program2
1071 root 32 12 2172 68 0 R 0.7 0.0 0:01.59 ./program2
1072 root 32 12 2172 68 0 R 0.7 0.0 0:01.59 ./program2
1074 root -31 12 2172 68 0 R 96.7 0.0 3:42.22 ./program2
=================================== P1Q2 end ===================================
================================== P2Q1 start ==================================
The output of diff or diffconfig when comparing the config files for your
mainline fallback kernel and your MuQSS kernel
-CFS_BANDWIDTH y
-CGROUP_CPUACCT y
-FAIR_GROUP_SCHED y
-NUMA_BALANCING y
-NUMA_BALANCING_DEFAULT_ENABLED y
-RT_GROUP_SCHED n
-SCHED_AUTOGROUP y
LOCALVERSION "-cs4118" -> "-aw3389-muqss"
+RQ_ALL n
+RQ_MC y
+RQ_MC_LLC n
+RQ_NONE n
+RQ_SMP n
+RQ_SMT n
+SCHED_MUQSS y
+SHARERQ 2
+SMT_NICE y
=================================== P2Q1 end ===================================
================================== P2Q2 start ==================================
Indicate you successfully patched, built, and booted into your MuQSS-enabled
Linux kernel.
[ 0.274397] MuQSS possible/present/online CPUs: 128/2/2
[ 0.274401] MuQSS locality CPU 0 to 0: 0
[ 0.274404] MuQSS locality CPU 0 to 1: 4
[ 0.274408] MuQSS locality CPU 1 to 0: 4
[ 0.274412] MuQSS locality CPU 1 to 1: 0
[ 0.274517] MuQSS CPU 0 llc 0 RQ order 0 RQ 0 llc 0
[ 0.274520] MuQSS CPU 0 llc 0 RQ order 1 RQ 1 llc 2
[ 0.274524] MuQSS CPU 1 llc 2 RQ order 0 RQ 1 llc 2
[ 0.274528] MuQSS CPU 1 llc 2 RQ order 1 RQ 0 llc 0
[ 0.274531] MuQSS CPU 0 llc 0 CPU order 0 RQ 0 llc 0
[ 0.274535] MuQSS CPU 0 llc 0 CPU order 1 RQ 1 llc 2
[ 0.274539] MuQSS CPU 1 llc 2 CPU order 0 RQ 1 llc 2
[ 0.274542] MuQSS CPU 1 llc 2 CPU order 1 RQ 0 llc 0
[ 0.274546] MuQSS runqueue share type MC total runqueues: 2
[ 1.390102] MuQSS CPU scheduler v0.205 by Con Kolivas.
=================================== P2Q2 end ===================================
================================== P3Q1 start ==================================
Describe how you created the 70%/30% split.
- Include the command lines you executed
- Indicate if you needed root privileges for any of those commands
- How were the results different from P1Q1, if at all.
/* TODO */
=================================== P3Q1 end ===================================
================================== P3Q2 start ==================================
Describe how you created a real-time priority task.
- Include the command lines you executed
- Indicate if you needed root privileges for any of those commands
- How were the results different from P1Q2, if at all.
/* TODO */
=================================== P3Q2 end ===================================
================================== P3Q3 start ==================================
MuQSS features unprivileged real-time tasks. Perform the previous task with and
without root privileges, and describe the differences.
With root privileges, the real time process still occupy about 70% of the cpu
while other 10 process hardly occupied the cpu. Without the root privileges,
the real time process occupied about 40%-60% cpu, while the other 10 process
occupies about 0.5%-3% cpu.
=================================== P3Q3 end ===================================
================================== P4Q1 start ==================================
Verify Con Kolivas' claim by timing the kernel build-time in both your fallback
and your MuQSS-patched kernels.
We run time make -j2 on both kernels, here is our result:
The Muqss kernel had shorter system time, but longer user time and real time.
On Muqss kernel:
real time: 11m36s
user: 21m24s
sys: 2m17s
On cs-4118 kernel:
real time: 10m13s
user: 16m31s
sys: 2m38s
=================================== P4Q1 end ===================================
================================== P4Q2 start ==================================
Design an experiment that you think will highlight MuQSS’s strength. Perform
the experiment and report your findings.
We compress the hw5 directory (1.1GB) to test the speed of two kernels, and the
final hw5.zip file is 429MB. We found that both kernel use almost same real time
to compress the hw5. But muqss kernel used more time on user and less time on
system than the origin kernel.
=================================== P4Q2 end ===================================
================================== P5Q1 start ==================================
Briefly describe the advantages and disadvantages of a larger HZ.
Advantages:higher resolution and greater accuracy; system call that employs a
timeout value will be more precise; finer resolution of measurments; process
preemption more accurate.
Disadvantage:more time on time interrupt handler, quicker to overflow.
=================================== P5Q1 end ===================================
================================== P5Q2 start ==================================
What is the HZ currently configured for your running Linux system?
250. We find it in /linux/include/asm-generic/param.h
=================================== P5Q2 end ===================================
================================== P5Q3 start ==================================
What are jiffies? Explain the relationship between jiffies, HZ, and time.
The number of ticks that have occurred since the system booted.
Jiffies / HZ = (length of time since the system booted)
=================================== P5Q3 end ===================================
================================== P5Q4 start ==================================
Find the current value of jiffies in your system.
- In minutes, how much time does this jiffies value represent?
- Does it match the uptime reported by the uptime command? (Hint: it
doesn’t.) Please give the formula to convert jiffies to the current
(real) uptime, in minutes.
- Why does this large difference exist? (Hint: in 32-bit Linux systems,
jiffies is a 32-bit value.)
jiffies is 4298944282. It represents 4298944282/(250 * 60) = 286569.29 minutes.
No, it doesn't, the real time is 4 hours 30 minutes.
real uptime = (jiffies - (0x100000000- 300 * HZ) )/(HZ * 60) minutes
real uptime = (4298944282 - (0x100000000 - 300 * 250))/(250*60)=270.13 minutes
The jiffies start at 0x100000000 - 300*HZ to test overflow. Because after 300
seconds, the jiffies will need more than 32 bits to represent it.
=================================== P5Q4 end ===================================
================================== P5Q5 start ==================================
What are Niffies? How do they differ from Jiffies?
Niffies are monotonic forward moving timer with nanosecond resolution, which
was used in BFS. Jiffies are with 1/HZ second resolution.
Niffies are per-runqueue variable while Jiffies are per-system global variable.
=================================== P5Q5 end ===================================