PART 3 - PROCESSES Flashcards
What is the process model?
The process model is the abstraction of a running program.
- It is a program in execution.
- Many processes can run the same program text
- Each process has its own address space (isolation)
- A (parent) process can create/fork (child) processes
Provide (pseudo) concurrent operation even on single CPU (multiple virtual CPUs).
Pseudo parallelism versus multiprocessor system.
What is the conceptual model?
Hints: (Independent, Logical Program Counter - Real Physical Program Counter)
Each process is independent
Each process has own program counter, registers and variables, and flow of control.
To run process, copy LOGICAL PROGRAM COUNTER into the REAL, PHYSICAL PROGRAM COUNTER.
When switch, value of the PHYSICAL PROGRAM COUNTER is stored in the PROCESS LOGICAL PROGRAM COUNTER in memory.
Explain how Processes work over time
Over a long period of time, all processes make progress.
-At any given instance only one process is active (Assuming single CPU)
CPUs switch rapidly between processes
-The rate of progress is not uniform, predictable or reproducible (You cannot predict that the same process will perform the same).
You cannot make assumptions about timing
-Cannot make assumptions at where the process will be in t+20 secs.
What is a program?
Program is an algorithm expressed in a programming language or other notation.
Program is the thing we write as programmers.
What is a process?
Process is an ACTIVITY that is EXECUTING ON A PROCESSOR.
A process has a program text, input, output, state etc.
Explain interrupt and switching of processes
1) Another activity (process) requires the CPU
2) Save state of the current process.
- the current process is on the CPU. Save everything you need in order to be able to restart the process.
3) Switch to a higher priority process (or next in line) with its own program and state.
Also, two distinct processes may execute the same program
Explain the process lifecycle and states
Processes have a lifecycle that is managed by the Operating System.
The operating system manages everything FROM CREATION TO TERMINATION, through intermediate states.
In simple systems (eg. microwave controller) all processes are created at system startup.
In general-purpose systems we need to create and terminate processes during system operation.
Explain the two ways a program can terminate (Voluntary & Involuntary)
Termination is either:
VOLUNTARY: Under the control of the process
-normal exit, error exit (Typically invalid user error)
INVOLUNTARY: Outside the control of the process
-Fatal error, Killed by another process
What is high-level process abstraction?
It views the whole system as a collection of processes, everything running on your system is a process.
Some processes perform user tasks, others perform system tasks.
The scheduler manages interrupt handling, starting and stopping processes.
Describe processes in MINIX
MINIX 3 is structured as a collection of processes
- It is Microkernel
- Processes, including system processes, communicate with each other using inter-process communication (IPC)
What is the process initialisation?
1) The kernel starts the SYSTEM and CLOCK TASKS.
2) The kernel STARTS the PROCESS MANAGER and FILE SYSTEM processes.
3) Process manager and file system cooperate to start other servers and drivers in the boot image.
- Each server and driver runs, initialises itself and then blocks
- Once all tasks, drivers, and servers loaded from the boot image have blocked, init, the first user process is executed.
What are kernel calls?
Kernel calls are Low-level functions that are provided by the system task
• Interface provided by kernel layer to system processes (drivers and servers) in layers 2 and 3
• Allow drivers and servers to do their work
• E.g. requesting to read a hardware I/O port
– Not accessible to user processes in layer 4
What are system calls?
Standards-comliant, high-level calls such as open, read, stat, fork
-Interface provided by layer 3 server processes to layer 4 user processes
What is Inter-process Communication (IPC) in MINIX?
Processes communicate by sending messages to each other (through the kernel).
Explain the three primary primitives of IPC
send, receive, sendrec
The three primary primitives of IPC:
– send(dest, &message) to send a message to
process dest
– receive(src, &message) to receive (wait) for a
message from process src (or ANY process)
– sendrec(src_dst, &message) to send and
receive a message to/from process src_dst
&message is the address of the location of the
message (e.g. where the kernel copies to/from)