Lecture: OS organization

class structure

overview

programming interface

example: hello

$ strace -o log -- echo hello

output:

execve("/usr/bin/echo", ["echo", "hello"], [/* 43 vars */]) = 0
...
write(1, "hello\n", 6)                  = 6
...
exit_group(0)                           = ?

example: uptime

$ strace -o log -- uptime

output:

execve("/usr/bin/uptime", ["uptime"], [/* 43 vars */]) = 0
...
openat(AT_FDCWD, "/proc/uptime", O_RDONLY) = 3
lseek(3, 0, SEEK_SET)                   = 0
read(3, "8827716.99 421503180.64\n", 8191) = 24
...
write(1, " 15:37:50 up 102 days,  4:08,  8"..., 72) = 72
...
exit_group(0)                                          = ?

exercise: redirection

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)?

$ uptime > file

hints:

exercise: pipe

what system calls are used to implement pipe |?

$ uptime | tr '[a-z]' '[A-Z]'

hints:

summary

isolation

kernel-user split