Lecture 3 Flashcards
A process is…
…a program in execution
A process has at least the following:
- Program counter
- Stack
- Data section
Difference between program and process
Program is the actual file on the disk, process is the job
When you execute a file, the OS…
…invokes a process (allocates whatever the program requires to run)
Another word for a process is a…
…job
The stack stores the ____ and grows from ____ to ____
Local variables, max to 0
The heap stores the ____ and grows from ____ to ____
Dynamically allocated memory, 0 to max
Data stores ____ and is below the ____
Global variables, heap
Text stores ____ and is below the ____
Program code, data
As a process executes, it changes its…
…state
Process States:
- New (just created)
- Running (Instructions being executed)
- Waiting (Waiting for an event to occur)
- Ready (Waiting for the CPU)
- Terminated (Process has finished execution)
OS maintains info about process in…
…PCB (Process Control Block)
PCB contains what info?
- Process State
- Program Counter
- CPU registers
- CPU scheduling info
- Memory-management info
- Accounting info
- I/O status
PCB used to…
…switch CPU from one process to another
PCB in Linux is represented by…
…the C structure task_struct (in a doubly linked list)
Processes are maintained in…
…queues
Ready Queue
Set of all processes in main memory, ready and waiting to execute
Device Queues
Set of processes waiting for an I/O device
Two types of processes in queues
CPU bound and I/O bound
When CPU switches from process to process, the kernel…
…saves the state of the first process in first PCB, then loads the state of the second process from second PCB into registers
Context-switch time is…
…pure overhead (no useful work is done)
Typically ____ for switching
A few milliseconds
Processes may create other processes, forming a…
…tree
Process creates a child process using…
…fork system call
Child is a ____ of the parent
copy
Typically, child loads another program into its address space using…
…exec system call
Parent waits for…
…its children to terminate