title | date | author | description | song | ||||||
---|---|---|---|---|---|---|---|---|---|---|
The Process Abstraction |
2015-01-30 |
Geoffrey Challen |
Introduction to the process abstraction and standard UNIX utilities. |
|
-
Operating system abstractions.
-
Processes.
-
Inter-process communication (IPC).
-
Process examples.
-
Thanks for taking the preterm!
-
If you are enrolled in the class you should be receiving course emails. If you would like to sign up for the email list, here is the link: https://www.ops-class.org/mailman/listinfo/ub
-
We are still working on the website
-
Recitations will start next week.
-
The add/drop deadline is Monday February 1st.
-
You still have time this weekend to examine the assignments and decide if this course is right for you right now.
-
-
Location — we’ll start in the third floor area outside the official TA office and see how we go.
-
Please be respectful of the TAs and ninjas:
-
Bother them relentlessly during office hours…
-
and leave them alone outside of office hours.
-
-
I will cold call students during class, possibly using a tool integrate with the slides.
-
Cold calling is not designed to make anyone uncomfortable! Feel free to pass or say "I don’t know."
-
hiding undesirable properties,
-
adding new capabilities, and
-
organizing information.
Abstractions provide an interface to application programmers that separates policy — what the interface commits to accomplishing—from mechanism — how the interface is implemented.
-
Disks are slow!
-
Chunks of storage are actually distributed all over the disk.
-
Disk storage may fail!
-
Growth and shrinking.
-
Organization into directories.
-
Ownership and permissions.
-
Access time, modification time, type, etc.
-
Processes organize information about other abstractions and represent a single thing that the computer is "doing."
-
You know processes as app(lication)s.
The operating system is responsible for isolating processes from each other.
-
What you do in your own process is your own business but it shouldn’t be able to crash the machine or effect other processes—or at least processes started by other users.
-
Thus: safe intra-process communication is your problem; safe inter-process communication is an operating system problem.
-
A variety of mechanism exist to enable inter-process communication (IPC), including shared files or sockets, exit codes, signals, pipes and shared memory.
-
All require coordination between the communicating processes.
-
Most have semantics limiting the degree to which processes can interfere with each other.
-
A process can’t just send a SIGKILL to any other process running on the machine!
-
-
Pipes create a producer-consumer buffer between two processes.
-
Allows the output from one process to be used as the input to another.
-
The operating system manages a queue for each pipe to accommodate different input and output rates.
-
Facilitates the canonical chaining together of small UNIX utilities to do more sophisticated processing.
-
Signals are a limited form of asynchronous communication between processes.
-
Processes can register a signal handler to run when a signal is received.
-
Users can send signals to processes owned by them; the super-user can send a signal to any process.
-
Processes can ignore most signals.
-
SIGKILL
is a notable exception; used for non-graceful termination. -
SIGTERM
is used for graceful shutdown and sent by Control-C.
-
-
return codes — we will discuss again when we learn about
wait()
and_exit()
.-
You will implement return codes for ASST2.
-
-
pipes — we will discuss again when we learn about
fork()
. -
signals — are difficult to use and implement and not something we will return to.
-
shared memory — we will discuss again when we learn about address spaces and virtual memory.
-
Potential confusing due to overlapping terminology—we can describe both a process and a thread as running.
-
Terminology can be helpful for remembering the distinction:
-
A computing process requires multiple resources: the CPU, memory, files, etc.
-
A thread of execution abstracts CPU state.
-
-
Processes contain threads; threads belong to a process.
-
Only one exception: the kernel may have threads of execution not associated with any user process
-
(Except the kernel process, which is a process, remember?)
-
-
A process is considered to be running when one or more of its threads are running.
-
Different operating systems use different terminology, but share common ideas.
-
Waiting for and processing interface events: mouse clicks, keyboard input, etc.
-
Redrawing the screen as necessary in response to user input, web page loading, etc.
-
Loading web pages—usually multiple parts in parallel to speed things up.
-
Firefox.exe: the executable code of Firefox itself.
-
Shared libraries for web page parsing, security, etc.
-
Stacks storing local variables for running threads.
-
A heap storing dynamically-allocated memory.
-
Configuration files.
-
Fonts.
-
UID
: user the process is running as. -
PID
: process ID. -
PPID
: parent process ID. -
PRI
: scheduling priority. -
SZ
: size of the core image of the process (kB). -
WCHAN
: if the process is not running, description of what it is waiting on. -
RSS
: total amount of resident memory is use by the process (kB). -
TIME
: measure of the amount of time that the process has spent running.