May 15, 2021 23:57
the one killed:
root       1087  0.0  0.0  55464  1104 ?        S<sl Apr25   0:09 /sbin/auditd
May 15, 2021 23:57
I killed one auditd process. There is another one under root that I can't kill -9. The original results remain unchanged.
May 15, 2021 23:39
make sense. the setuid was a good idea. But it looks like it's the actual log-in that made the difference.
May 15, 2021 23:38
I have created a completely new user with an unused uid, and it worked just fine, with fast dd speed.
May 15, 2021 23:34
@forest thats' true. I think the read/write speed is only affected when block size is large.
May 15, 2021 23:33
diff env.1007 env.1008
1c1
< XDG_SESSION_ID=33604
---
> XDG_SESSION_ID=33651
6,8c6,11
< SSH_CLIENT=100.124.208.22 53035 22
< SSH_TTY=/dev/pts/2
< USER=yunjiang.jiang
---
> SSH_CLIENT=100.124.208.22 63884 22
> CONDA_SHLVL=1
> CONDA_PROMPT_MODIFIER=
> OLDPWD=/home
> SSH_TTY=/dev/pts/0
> USER=search
9a13
> CONDA_EXE=/home/search/anaconda3/bin/conda
11,12c15,17
< MAIL=/var/spool/mail/yunjiang.jiang
< PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/Arcconf:/home/yunjiang.jiang/.local/bin:/home/yunjiang.jiang/bin
May 15, 2021 23:31
with 3 zeros:

uid=1007:
real	0m16.416s
user	0m0.069s
sys	0m16.346s

uid=1008:
real	0m15.398s
user	0m0.075s
sys	0m15.322s
May 15, 2021 23:28
add two more zeros to the for loop upper bound, and ran time ./a.out got longer time:

uid=1007:
real	0m1.141s
user	0m0.209s
sys	0m0.932s

uid=1008:
real	0m1.095s
user	0m0.199s
sys	0m0.896s
May 15, 2021 23:27
ok let me double check
May 15, 2021 23:26
write for loop:
uid=1007:
real	0m0.025s
user	0m0.005s
sys	0m0.020s

uid=1008:
real	0m0.025s
user	0m0.003s
sys	0m0.022s
May 15, 2021 23:25
your read c code returned
uid=1007:
real 0m1.669s
user 0m0.007s
sys 0m1.631s

uid=1008:
real 0m1.690s
user 0m0.003s
sys 0m1.687s
May 15, 2021 23:23
though with them combined, there was little perf difference.
May 15, 2021 23:23
let me try your read/write separate c code
May 15, 2021 23:23
1,3c1,3
< execve("/usr/bin/cat", ["cat", "test1.img"], [/* 22 vars */]) = 0
< brk(NULL)                               = 0x2345000
< mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2a61d40000
---
> execve("/usr/bin/cat", ["cat", "test1.img"], [/* 28 vars */]) = 0
> brk(NULL)                               = 0x1708000
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f637975d000
7c7
< mmap(NULL, 62854, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2a61d30000
May 15, 2021 23:23
strace returned some diff, but I don't know it well enough to know the meaning:
May 15, 2021 23:18
your code returned similar time results
May 15, 2021 23:16
deleted the target file before hand in both cases.
May 15, 2021 23:16
uid=1007 ; time bash -c "for i in {0..1} ; do cat test1.img > /tmp/test2.img ; done "

real	0m13.123s
user	0m0.004s
sys	0m2.609s
May 15, 2021 23:15
uid=1008 ; time bash -c "for i in {0..1} ; do cat test1.img > /tmp/test2.img ; done "

real	0m6.865s
user	0m0.008s
sys	0m2.016s
May 15, 2021 23:15
ok, I tried something in bash first
May 15, 2021 23:10
time bash -c 'for i in {0..1000000}; do :; done'

real	0m2.110s
user	0m1.978s
sys	0m0.132s
May 15, 2021 23:09
ah, ok thx
May 15, 2021 23:09
your command also returned similar results
May 15, 2021 23:09
this printed similar results on 1007 and 1008: Time taken 2 seconds 590 milliseconds (590 iterations)
May 15, 2021 23:08
#include <stdio.h>
#include <unistd.h>
#include <time.h>
int main(int argc, char** argv) {
clock_t before = clock();
int i;
for (i = 0; i < 1e9; ++i) {
int x = 12345 * 12345;
}
clock_t difference = clock() - before;
int msec = difference * 1000 / CLOCKS_PER_SEC;

printf("Time taken %d seconds %d milliseconds (%d iterations)\n",
msec/1000, msec%1000, 1e9);
}
May 15, 2021 23:04
OK good idea.
May 15, 2021 23:02
No disk quota I am aware of. Yes, /dev/zero -> /dev/null sees the same 4x perf gap as /dev/zero -> /tmp/test1.img
May 15, 2021 23:00
Also I recently ran userdel -r and groupdel on the old user for 1007, so things like .bashrc, .bash_profile should have been removed already.
May 15, 2021 22:58
ulimit returns unlimited under both 1007 and 1008.
May 15, 2021 22:58
yes, 1007 is actually my personal uid. Other people's account had no disk speed issue.
May 15, 2021 22:56
sudo ./a.out 1008
0
1008
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 26.4992 s, 40.5 MB/s
May 15, 2021 22:56
id
uid=1007(test.dd) gid=1001(xxx) groups=1001(xxx),10(wheel)
May 15, 2021 22:55
sudo ./a.out 1007
0
1007
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 6.28947 s, 171 MB/s
May 15, 2021 22:55
id: uid=1008(yyy) gid=1001(xxx) groups=1001(xxx),10(wheel),994(docker)
May 15, 2021 22:54
#include <stdio.h>
#include <unistd.h>

int main(int argc, char** argv) {
printf( "%d\n", setuid(atoi(argv[1]) ));
printf( "%d\n", getuid());
const FILE *fd = popen("ulimit -m 100000000; dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync","w");
pclose(fd);
}
May 15, 2021 22:53
@forest thanks a lot! I tried a variant of your c code, and indeed setuid to 1007 didn't matter. So it's only the user that's logged in that causes the speed gap.
May 15, 2021 22:20
@forest indeed I have been using /dev/null since half an hour ago. The results remain unchanged. I also noticed that with /dev/zero replaced by /dev/urandom, the 4x gap disappears. With bs=1M the gap also disappears, but not with large bs like 1G, 2G. Somehow 1007 is configured differently but don't know where to look.
May 15, 2021 21:56
@forest Indeed there was also a "tmpfs /run/user/0" entry under "df -h". I removed both, and ran dd command without sudo, but still got about 40 MB/s under the account with uid 1007. I started looking into this because the 1007 user on this machine ran wget much slower than other user/machines.
May 15, 2021 21:56
Just replaced /tmp/test1.img with dev/test1.img and got similar speed: 45MB/sec. Maybe need to replace /dev/zero with something else but not sure how.
May 15, 2021 21:56
@forest df -h indeed reveals the following mount point "tmpfs 26G 0 26G 0% /run/user/1007". I will umount it and try again. Meanwhile could you shed some light on why it can slow disk down? Thanks!
May 15, 2021 21:56
@forest Thanks. I just tried and succeeded with " sudo sh -c ' echo 3 > /proc/sys/vm/drop_caches ' ", but still got ulimit -m 100000000; dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync 1+0 records in 1+0 records out 1073741824 bytes (1.1 GB) copied, 27.1012 s, 39.6 MB/s
 

 Martin Sleziak's room

Miscellaneous (not suitable elsewhere)
Jul 6, 2020 17:05
@MartinSleziak hello Martin, I think I finally joined. The differential galois theory group was created a long time ago.
 

 Mathematics

Associated with Math.SE; for both general discussion & math qu...
May 20, 2017 23:57
good point!
May 20, 2017 23:49
@SimplyBeautifulArt can you render the latex and link it to some image pastebin?
May 8, 2017 04:26
@IcedPalmer what context are these from?
May 6, 2017 04:39
no problem. Just note that E_(T_i) is the same as E(T_i | T_0)
May 6, 2017 04:31
anyway I hope I conveyed enough of the subtleties in conditional probability here that you have some faith in the theory
May 6, 2017 04:31
not the middle of the process when you already know the value of T_{i-1}
May 6, 2017 04:30
but when you write E(T_{i-1}) you are from the perspective of the beginning of the process
May 6, 2017 04:30
yep!