Processes Flashcards
Process State
- new: The process is being created
- running: Instructions are being executed
- waiting: The process is waiting for some event to occur
(e.g., I/O completion) - ready: The process is waiting to be assigned to a processor
- terminated: The process has finished execution
PCB
Process Control Block. Data related to a process. Convienent way to store all relevenat data linked to a prcoess. Includes:
* process state
* Process number
* program counter
* registers
* memory limits
* list of open files
This data is used when interrupting and restarting a process.
Job, Ready, Device Queue
- Job Queue: All of the processes in the system.
- Ready Queue: All of the processes awaiting execution.
- Device Queue: Processes waiting for I/O
This is basically a linked list of the PCBs
Long-term scheduler
Selects which process should be brought into the ready queue. Controls the degree of multiprogramming.
Short-term scheduler
Selects which process should be executed next
Context Switch
Stopping a running process and running another one instead. Done by saving data into the PCB and loading it to run a process.
PID
Process Identifier - a unique ID each process in the systems receives upon creation
fork()
System call to create a new process. After calling this, the new program is basically a copy of the original one in terms of memory.
exec()
System call used after fork() to replace the process’ memory space with a new program
wait()
Takes the process out of the ready queue until the child process terminates
CoW
Copy on Write: When forking a program, the memory isn’t duplicated immediately, instead the relevant pages are only duplicated when one of the processes (child/parent) try to change a certain page. This is done by triggering a page fault and creating a new one for the writing process.
IPC-Facility
System calls to Send message between processes
IPC send() & receive() (Direct & Indirect)
Direct:
Sends message directly to named process.
Indirect:
Sends message to a common mailbox.
int pipe(piped[2])
Creates a directional pipe that can be used for interprocess communication.
pipefd[0] is the read end of the pipe.
piped[1] is the write end of the pipe.
The kernel buffers data written to the read end until it is read.
Sockets
Endpoint for communication, identified by an IP address and port (TCP/ UDP).
RPC
Remote Procedure Call.
A protocol for basically making requests to other computers but abstracting everything so that it looks like making a local function call. There is a client stub (proxy) on the server and client that handles all of the packages (marshals) and finds the actual server to call for using a lookup server where servers register themselves.
RMI
Remote Message Invocation. Basically like RPC, but in Java and for passing objects. This takes care of serialization and desarilization.