What is a program and what does it need?
A static file stored on disk
– Make source code
– Compile it to an object file
– Link object file(s) + libraries with run-time system = executable file
What is a process and what can each one have?
The live usage of a program and a unit of dispatching
– Each has a unique PID (a number)
What happen when a program is executed?
What if the same program is
executed again?
What is a process given and what can it not do?
It’s own memory area and a process cannot affect the state of another
What is a process control block?
The information of a process that must be saved so execution can be resumed later as if nothing had happened
What is a process state and its types?
As a process executes, it changes state
– new: The process is being created
– running: Instructions are being executed
– waiting: The process is waiting for some event to occur
– ready: The process is waiting to be assigned to a process
– terminated: The process has finished execution
What information does a process control block retain?
What is a context switch?
The switch between two processes, e.g. to perform I/O or run another process
What hapens when a context switch is used?
It saves the context block (process state)
* When exec instruction: PC, registers, flag changes
* CPU is reused by each process in turn
* Each process has its own area of RAM (text, data, stack)
What is a virtual cpu?
Multiprocessing on one CPU
What happens to a process on a virtual cpu?
Each process has a virtual CPU
the processes appear to be executing simultaneously which:
* executes a process in a few ms
* saves the context (registers (incl. Flag and PC))
* switches to another process
* executes that in a few ms
What does each process share and what do they not share?
All processes share the cpu but has its own stack
What is apparent concurrency?
When one process is run at a time
What is true concurrency?
When processes overlap
How does a cpu switch from process to process
When a process is interrupted or a system call happen it will save its state into it’s own process control block. The new process will reload a state from it’s own process control block
What is a pre-emptive OS?
The execution of a process that can be interrupted to schedule another process
What is a non-pre-emptive OS?
A process that cannot be interrupted to schedule another process
Explain non-deterministic OS
An OS where it is not possible to predict the order in which
interrupts occur, therefore not possible to synchronise
processes using timing
Today’s O/S’s are often event-driven
What are event-driven OS?
OS that wait for an asynchronous event to happen
main() = short loop waiting for events and responds to the event
What are all of the events that event-driven OS wait for?
How can process be seen when it comes to resources?
– a unit of dispatching (scheduling)
– a unit of resource ownership
* competing for resources
– RAM
– Disk Space
– CPU
What is needed for multitasking?
What features does memory protection of a cpu have?