ANSWERS GRADED A+
✔✔Address Space - ✔✔The memory that the process can address.
✔✔Registers - ✔✔Part of the process's machine state.
Many instructions explicitly read or update registers and thus clearly they are important
to the execution of the process
✔✔Program Counter (PC) /
Instruction Pointer (IP) - ✔✔A special register that form part of a machine state.
Tells us which instruction of the program will execute next.
✔✔Stack Pointer & Frame Pointer - ✔✔Used to manage the stack for function
parameters, local variables, and return addresses.
✔✔Modularity - ✔✔A general software design principle.
A common design paradigm to separate high-level policies from their low-level
mechanisms.
Separating the two allows one easily to change policies without having to rethink the
mechanism and is thus a form of modularity.
✔✔Process API - ✔✔Create: An operating system must include some method to create
new processes. When you type a command into the shell, or double-click on an
application icon, the OS is invoked to create a new process to run the program you
have indicated.
Destroy: As there is an interface for process creation, systems also provide an interface
to destroy processes forcefully. Of course, many processes will run and just exit by
themselves when complete; when they don't, however, the user may wish to kill them,
and thus an interface to halt a runaway process is quite useful.
Wait: Sometimes it is useful to wait for a process to stop running; thus some kind of
waiting interface is often provided.
Miscellaneous Control: Other than killing or waiting for a process, there are sometimes
other controls that are possible. For example, most operating systems provide some
kind of method to suspend a process (stop it from running for a while) and then resume
it (continue it running).
,Status: There are usually interfaces to get some status information about a process as
well, such as how long it has run for, or what state it is in.
✔✔Load - ✔✔The first thing that the OS must do to run a program is to load its code
and any static data (e.g., initialized variables) into memory, into the address space of
the process.
✔✔Disk /
Disc /
Flash-Based SSD - ✔✔Where a program initially resides in some kind of executable
format.
The process of loading a program and static data into memory requires the OS to read
those bytes from disk and place them in memory somewhere.
✔✔Eagerly (Loading Process) - ✔✔The loading process done all at once before running
the program.
✔✔Lazily (Loading Process) - ✔✔Loading pieces of code or data only as they are
needed during program execution.
✔✔Run-Time Stack /
Stack - ✔✔Once the code and static data are loaded into memory, there are a few other
things the OS needs to do before running the process. Some memory must be allocated
for the program's run-time stack (or just stack).
C programs use the stack for local variables, function parameters, and return
addresses; the OS allocates this memory and gives it to the process.
The OS will also likely initialize the stack with arguments; specifically, it will fill in the
parameters to the main() function, i.e., argc and the argv array.
✔✔Heap - ✔✔In C, the heap is used for explicitly requested dynamically-allocated data;
programs request such space by calling malloc() and free it explicitly by calling free().
The heap is needed for data structures such as linked lists, hash tables, trees, and
other interesting data structures. The heap will be small at first; as the program runs,
and requests more memory via the malloc() library API, the OS may get involved and
allocate more memory to the process to help satisfy such calls.
✔✔File Descriptors - ✔✔In UNIX systems, each process by default has three open file
descriptors, for standard input, output, and error; these descriptors let programs easily
read input from the terminal and print output to the screen.
✔✔Process States - ✔✔Running: In the running state, a process is running on a
processor. This means it is executing instructions.
, Ready: In the ready state, a process is ready to run but for some reason the OS has
chosen not to run it at this given moment.
Blocked: In the blocked state, a process has performed some kind of operation that
makes it not ready to run until some other event takes place. A common example: when
a process initiates an I/O request to a disk, it becomes blocked and thus some other
process can use the processor.
✔✔Scheduled /
Scheduling - ✔✔When a process is moved from the ready state to the running state.
✔✔Descheduled /
Descheduling - ✔✔When a process is moved from the running state to the ready state.
✔✔Process List /
Task List - ✔✔To track the state of each process, for example, the OS likely will keep
some kind of process list for all processes that are ready and some additional
information to track which process is currently running.
✔✔Process Control Block (PCB) - ✔✔Sometimes people refer to the individual structure
that stores information about a process as a Process Control Block (PCB), a fancy way
of talking about a C structure that contains information about each process (also
sometimes called a process descriptor).
✔✔Register Context - ✔✔The register context will hold, for a stopped process, the
contents of its registers. When a process is stopped, its registers will be saved to this
memory location; by restoring these registers (i.e., placing their values back into the
actual physical registers), the OS can resume running the process.
✔✔Initial State - ✔✔Sometimes a system will have an initial state that the process is in
when it is being created.
✔✔Final State - ✔✔A process could be placed in a final state where it has exited but
has not yet been cleaned up (in UNIX-based systems, this is called the zombie state).
This final state can be useful as it allows other processes (usually the parent that
created the process) to examine the return code of the process and see if the just-
finished process executed successfully (usually, programs return zero in UNIX-based
systems when they have accomplished a task successfully, and non-zero otherwise).
When finished, the parent will make one final call (e.g., wait()) to wait for the completion
of the child, and to also indicate to the OS that it can clean up any relevant data
structures that referred to the now-extinct process.