-
Notifications
You must be signed in to change notification settings - Fork 1
Processes and Users
The goal of the computing system is to run actions as instructed by the user. Instructions are run by the CPU (Central Processing Unit) in execution abstractions that we call processes. Processes are running programs, i.e. executable code that now uses system resources. Processes hide CPU, memory and complexity from the user. It is the role of the operating system to ensure fair access for all processes to system resources.
In this chapter we delve into key concepts related to processes and process scheduling. We present the POSIX API for working with processes. We look into shell internals: running commands, redirections, pipes, subshells.
goals:
- process API
- monitoring and fine-tuning process resource use: CPU, memory, I/O
- shell internals: starting a process, loading, external/internal commands, redirection
running actions, run instructions on CPU, multiple instructions separation, processes CPU, memory, I/O abstractions scheduling processes, priorities, I/O-bound vs CPU-bound creating and terminating processes process investigation shell processes, subshells, foreground, background redirection
Process runs and uses CPU, memory, I/O. Show CPU time/percentage, virtual memory and resident memory for process.
Run processes with nice priority altered, see time duration. Difference between user time, system time, wall time.
Show redirection using dup()
and dup2()
.
Show the use of fork()
to create new process. Show use of fork()
+ exec()
.
Show inheritance of child processes().
Inspect shell using strace
when using internal commands vs external commands. Inspect running in background.
Show example with pipe()
. Inspect with lsof
.
Inspect process with environemnt variable set.
Show what happens when we use echo "a" | read v, vs read v <<<"a".
Redirecting output of two chained commands. (a ; b) > f
Inspect tee
. Use tee -a
.
What does the daemon()
call do?
Start process as root
and create child process as another user using setuid()
.
Programatically get resource usage for process through getrusage()
.
Start process using spawn...
. Start process using popen()
.