Processes - Chapter 3
Process - program in execution
Job - process
Batch system - completes jobs sequentially
Time shared system - completes jobs concurrently, based on allocated time slots
Memory Structure

Text - contains program code
Data section - stores global variables
Stack - stores local data (i say data because it includes functions)
Heap - stores dynamically allocated memory
Process State

admitted - new process is made and is put in ready queue
scheduler dispatch - process is now at the front of the queue and is set to running
interrupt - an interrupt occurs and the process is sent back to the ready queue
IO wait - the process requires IO the process is set to waiting
IO completion - the IO has completed and the process is then sent to the ready queue
exit - the process is terminated, along with its memory space
Process Control Block (PCB)

Process State - i.e. running, waiting, ready
Process Number - the ID of that process
Program Counter - points to the next instruction, multi-THREADS need multiple program counters
Registers - the last value of the registers in the cpu
Memory limits - memory allocated to that process
List of open files - lists out all currently open files
Accounting information - time limits, time since process start...
Process Scheduling
Ready queue - processes ready in main memory
Job queue - all processes in the system
Device queue - process waiting for IO
Process scheduler (general term) - selects next process to execute out of the ready/ job/ device queues

CPU scheduler (short-term) - selects the next process to be executed by the CPU
Job scheduler (long-term) - selects processes to be added to the ready queue (process might be in virtual memory)
Medium-term scheduler - will remove a process by putting it in main memory and bring another into the ready queue and primary memory
Context switches
When switching processes, the processes state is saved via the PCB
Child Processes and Memory sharing
Children can share all, apart of, or none of the parents resources
Processes refure to one another via their PID
UNIX commands for process management
fork() - create a new process
exec() - replaces parents memory space with childs
wait() - moves parent to waiting queue, until child termination
exit() - terminates the process
abort() - kills child
Killing children
Children should not exist without a parent
Zombie - parent did not wait for child to terminate (baso child is still running with parent that left it)
Orphan - parent died, with out waiting
Interprocess communication (IPC)
Coperation processes - processes that communicate with others
Done by:
- Message passing - done by using a queue, bound or un-bound (unlimited in size)
- Shared memory
Shared Memory communication
Symmetry - both processes know each others id
Asymmetric - only one knows the id (the sender)
Messages are passed by mailboxes (port)
Blocking (synchronous messaging, i.e. cannot read/write till message is ready/read)
Non-blocking (well guess retard ^^^)