Processes Flashcards
what is a program
a set of instruction
what is a process
a program together with its files and metadata
what is context
information about each process, held in memory.
the environment in which a process operates, including variables and resources.
what is an address space
the accessible memory locations for a process
what is segmentation
memory is divided into variable sized chunks
where does the OS hold the information about a process
process control block
what is init
the root of the hierarchy of processes in linux
what does it mean for a process to fork
create a clone of itself- its child.
what is an orphan? what happens to the child?
the parent expires before the child.
the child is adopted by init and becomes a daemon
what is a zombie
a child process terminated unnoticed by its parent
give the elements that make up a process’ context
variables and resources in memory
registers storing: state memory management page tables list of resources the process owns cached information
what is multiprocessing? what need does it create?
multiprocessing is a resource
it creates a need to communicate between processes
how can processes communicate
shared memory
files
message passing
signals
pipes
barriers
how is IPC performed using shared memory
there will be a shared byte where one process can write if it is on and the other can read etc.
it is safe and atomic. May require locks and semaphores
how is IPC preformed using files
processes alter the file contents
how is IPC performed using messages
data blocks are sent from one process to another.
synchronous or asynchronous (pipe)
how is IPC performed using signals
like interrupts but software generated
how is IPC performed using pipes
a FIFO structure. carries streams or structures messages
how is IPC performed using barriers
barriers are a method of synchronisation rather than message passing. All processes can proceed once they meet the barrier
what is a socket
endpoint of communication. method of IPC
what are the benefits of multithreading
simpler source code- decoded into bits
parallel processing can utilise all cores, giving higher performance
what are the drawbacks of multithreading
more difficult to program
dependencies must be guaranteed
chance of deadlock
what is deadlock
processes compete for resources and reach a state where none can proceed
what are the methods of preventing deadlock
ordering algorithms: the process that has progressed furthest will not be blocked
back off: start again from scratch
central arbiter- processes must ask for a resource
what are locks
when an operation much be done in divisibly.
what are some examples of structural locks
system call to claim a resource like memory
writing to a file
what are the two options if a lock is busy
busy wait (spinlock)- keep checking
block on the lock and context switch
how are locks implemented
mutex
semaphore
what is a thread
a single, sequential series of machine instructions.
many threads make up a process.
share the same context
private registers and stacks
share virtual memory maps.
managed by the scheduler
has own state
cooperative scheduling
what is a hypervisor
layer of software between OS and hardware that allows more than one OS to run on a single machine. Type 1 and type 2
what is fork()
a system call that calls once but returns twice, once in calling function and once in copy
what is a container
a container is a term for a virtual computer. splits one machine into many virtual ones.
they share the same kernel but have their own IP addresses and view of the filing system
what does chroot do
defines a container using the current position as the new root
what is a PCB
process control block. the OS’s definition of a process. Holds information about a process.