independent processes
can’t be affected by others and vice versa
cooperating processes
can be affected and can affect other processes
reasons for communication
Ctrl+Z
suspends a process, doesn’t terminate
signal types
Hardware-induced (e.g., SIGILL)
Software-induced (e.g., SIGQUIT or SIGPIPE)
actions
term
ign
core
stop
cont
catching signals
kernel delivers the signal
→ Stops code currently executing (after saving contacts- states of registers- of the current program)
→ Saves context
→Executes signal handling code
→Restores original context
signal info pushed onto the stack
floating point state
ucontext: SP and IP
siginfo - info about the signal
sigreturn - SP; address to where to return after the signal handler finishes
upon sigreturn, the kernel
reasons for synchronisation
fork()
exec()
race conditions
a situation in which several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place
spooler directory
a designated area where files are temporarily stored while they are being processed by a program or service, typically related to printing or job management
critical region
a code region with access to shared resources
requirements to avoid race conditions
a solution to the critical region problem must satisfy
Peterson’s solution
when a process wants to enter its critical region it sets its flag to true and it will set the turn to the other process, i.e. it gives the turn to the other process
semaphore
semaphore idea
binary seamphores
mutex locks
only 0 or 1
spinlock semaphore
busy waiting wastes CPU cycles that some other process might be able to use - the process “spins” while waiting for the lock
Readers/Writers