6 - Processes Flashcards
(37 cards)
What is multiprogramming?
OS gives CPU to
another program if current program
must wait on I/O
What is Cooperative Multitasking?
Programs can
voluntarily yield CPU to another program
What is Preemptive Multitasking?
A program gets a fraction of a second to execute, then OS automatically switches to the next program, and so on Almost all modern OSes implement this
What is Multithreading?
allows even more efficient
multitasking, usually preemptive
What is Multitasking?
Concurrent execution of multiple programs
Usually an illusion of parallelism
Can run more processes than there are CPUs
What is the use of Multitasking?
Allows us to reduce CPU idling during I/O
What is a process?
An abstraction of a program in execution.
Is a program the same thing as a process?
NO!
Program is PASSIVE
Process is active
Does a process get its own address space? What is in this address space?
• text section: the program code
• data section: global variables, constant
variables
• heap: memory for dynamic allocation during run time
• stack: temporary data (parameters, return address, local variables)
What is the Process Control Block (PCB)?
A data structure comprising of bits of information needed by the OS for process management.
What are the typical parts of the PCB?
HIGH LEVEL
- Process/Memory/File Management
• process state
• program counter, CPU registers
• priority, pointers to various queues
• memory management info: eg. page tables, segment
tables, etc.
• accounting info: eg. CPU time, timeout values, process
numbers, etc.
• I/O status info: open files, I/O devices, etc.
What is a Process Table?
A collection of all PCBs
Which system call does UNIX define to create a new process?
fork()
What is a Parent Process?
The process that is creating a new process
What is a Child Process?
A newly created process
What is a PID?
A unique process identifier - Each process gets one
Which system call does UNIX define to terminate a process?
exit() or kill()
How do you start an external program in UNIX?
First fork() to create a new process, then start external program with exec()
What does a PID of 0 mean?
The process is the child process.
What does a PID < 0 mean?
An error occurred.
What is the difference between the system() and popen() C functions?
system() just uses fork() to create a child process that executes the command
popen() opens a pipe between the parent and child (The parent has control over the child’s input and output streams).
What is the difference the UNIX and Windows process organization?
UNIX - Parent and child processes continue to be associated, forming a process hierarchy
Windows - All processes are equal, the parent process can give the control of its children to any other process.
What is the init or systemd process?
The first process started after booting?
What is the PID of init?
Always 1