chapter 3 Flashcards
weight of a process
refers to the amount of resources and effort required by the OS to manage it, such as creation, scheduling and termination effort. Other factors contributing to the weight of a process is:
- size of its context
- CPU scheduling decisions
- context saving and loading
classic unix processes are considered to be heavyweight
threads (Fäden)
- is a leightweight process
- share all segments except the stack
kernel-level threading (1:1)
- each user-level thread corresponds directly to one kernel-levle thread. This model treats threads as lightweight processes, meaning that multiple threads can exist within a single process`s @ space, each managed individually by the CPU (pthreads)
- The CPU is aware of each thread and is responsible for their creation, snchro and destruction
user-level threading (m:1)
- multiple user-level threads are managed within a single kernel-level thread (a single @ space)
- featherweight processes, leighter than kernel threads
- thread management is done in the user level and not kernel level
- entire process will be blocked if one thread makes a blocking call
- one thread can access CPU at a time, cant run in parallel
- CPU has no knowledge about these threads, since they are implemented in the app level
- extremely fast context switching
hybrid-level threading (m:m)
- combines both types of threading
- featherweight processes
general info
linux makes no difference between heavyweight and lightweight processes
command “which”
- which vi (vi is a command)
- outputs the directory of the command
command “vi”
- vi <filename> — Open or edit a file, start executing the command</filename>
- to stop it, hit Ctrl-z
command “&”
- emacs bar.c &
- when added at the end, emacs will be started in the background
command “jobs”
- type only jobs in the terminal
- outputs all started commands
command “bg”
- sends an already stopped command into the background and resumes executing
>
- redirecting stdout
- echo “Hello” > text
- stores the output in text
- ls -l > file.txt will store the output in file.txt
<
- redirecting stdin
- wc < file1.txt will read the intput from file.txt
copy-on-write (COW)
with the help of MMU, parent and child processes share the same code and data segment.
only when the child progress changes data, the segment is copied.