0x1000_0000
0x1000_0000
)
user/user.h
for system callsoutput:
execve
(first), write
, exit_group
(last)write
exit_group
output:
open
/openat
, lseek
, read
, …/proc/uptime
- is this a real file on disk?
(source code)cat /proc/cpuinfo
; see more about procfscat /dev/random
what system calls are used to implement redirection >
(i.e., how does the output of uptime
go to an on-disk file instead of terminal)?
hints:
clone(...)
(old days: fork
).execve("/usr/bin/uptime", ...)
and the system calls right above (openat
, dup2
, close
).what system calls are used to implement pipe |
?
hints:
pipe
, clone
, execve
, and dup2
.strace
is implemented in Linux
exit
in main
? what if we simply return without calling exit
?+------+ +------+ +------+
| app1 | | app2 | | app3 |
+------+ +------+ +------+
+-------------------------------+
| operating system |
+-------------------------------+
+-----+ +-----+ +-------------+
| CPU | | RAM | | I/O devices |
+-----+ +-----+ +-------------+
kernel/start.c
kernel/memlayout.h
in xv6ecall
instructionsret
instruction