Chapter 3 OS Processes

78 flashcardsby Lulu
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
What is a process?
A process is a program in execution.
2
What is the difference between a program and a process?
A program is a passive executable stored on disk while a process is an active program running in memory.
3
What are the main components of a process?
Text section, data section, heap, stack, program counter, and CPU registers.
4
What is stored in the text section of a process?
Executable program instructions.
5
What is stored in the data section?
Global and static variables.
6
What is stored in the stack?
Local variables, function parameters, and return addresses.
7
What is stored in the heap?
Dynamically allocated memory.
8
What is dynamic memory allocation?
Memory allocated during program execution using functions such as malloc().
9
Which memory region stores malloc() memory?
The heap.
10
What is the program counter?
The address of the next instruction to execute.
11
What are CPU registers used for?
To store temporary execution data and intermediate values.
12
What are the five basic process states?
New, Ready, Running, Waiting, and Terminated.
13
What is the New state?
The process is being created.
14
What is the Ready state?
The process is waiting to be assigned to the CPU.
15
What is the Running state?
The CPU is currently executing the process.
16
What is the Waiting state?
The process is waiting for an event such as I/O completion.
17
What is the Terminated state?
The process has finished execution.
18
What is a Process Control Block (PCB)?
A data structure used by the operating system to store information about a process.
19
What information is stored in the PCB?
Process state, program counter, CPU registers, scheduling information, memory information, accounting information, and I/O information.
20
Why is the PCB important?
It allows the operating system to pause and later resume a process.
21
What is a thread?
The smallest unit of CPU execution within a process.
22
What resources do threads share?
Code section, heap, and data section.
23
What resources does each thread maintain separately?
Stack, program counter, and CPU registers.
24
What is process scheduling?
The operating system selecting which process receives CPU time.
25
What is the purpose of process scheduling?
To maximize CPU utilization and system responsiveness.
26
What is the ready queue?
The set of processes waiting for CPU execution.
27
What is the wait queue?
The set of processes waiting for an event such as I/O completion.
28
What is a context switch?
The CPU switching from one process to another.
29
What happens during a context switch?
The old process state is saved and the new process state is loaded.
30
Where is process context stored during a context switch?
In the Process Control Block.
31
Why is a context switch considered overhead?
Because no useful work is performed while switching processes.
32
What factors affect context switch time?
Operating system complexity, PCB complexity, and hardware support.
33
What is a parent process?
A process that creates one or more child processes.
34
What is a child process?
A process created by another process.
35
What system call creates a child process in UNIX?
fork().
36
What does fork() return to the child process?
0.
37
What does fork() return to the parent process?
The PID of the child process.
38
What does fork() return if an error occurs?
-1.
39
What system call replaces a process's memory with a new program?
exec().
40
What system call causes a parent process to wait for a child process?
wait().
41
What system call terminates a process normally?
exit().
42
What system call forcibly terminates a process?
abort().
43
What is a zombie process?
A terminated child process whose parent has not called wait().
44
What is an orphan process?
A child process whose parent terminated before it did.
45
What is cascading termination?
When termination of a parent process causes all child processes to terminate.
46
What is interprocess communication (IPC)?
A mechanism that allows processes to communicate and synchronize.
47
Why do processes cooperate?
Information sharing, computation speedup, modularity, and convenience.
48
What are the two major IPC models?
Shared memory and message passing.
49
What is shared memory?
A memory region shared between processes for communication.
50
Who controls communication in shared memory?
The user processes.
51
What is the biggest issue with shared memory?
Synchronization.
52
What is message passing?
Processes communicating by sending and receiving messages.
53
What are the two message passing operations?
send(message) and receive(message).
54
What is direct communication?
Processes explicitly name each other when sending messages.
55
What is indirect communication?
Processes communicate through mailboxes or ports.
56
What is a mailbox?
A shared communication object used for indirect communication.
57
What is blocking communication?
Communication where the sender or receiver waits.
58
What is nonblocking communication?
Communication where execution continues immediately.
59
What is a rendezvous?
When both send and receive operations are blocking.
60
What is buffering in message passing?
The queue of messages attached to a communication link.
61
What is zero-capacity buffering?
No messages are queued and sender and receiver must synchronize.
62
What is bounded buffering?
The communication link holds a limited number of messages.
63
What is unbounded buffering?
The communication link can hold unlimited messages.
64
What is the producer-consumer problem?
A synchronization problem where one process produces data and another consumes it.
65
What is an unbounded buffer?
A buffer with no practical size limit.
66
What is a bounded buffer?
A buffer with a fixed maximum size.
67
What is a pipe?
A communication channel between two processes.
68
What is an ordinary pipe?
A unidirectional pipe that typically requires a parent-child relationship.
69
What are ordinary pipes called in Windows?
Anonymous pipes.
70
What is a named pipe?
A bidirectional pipe that does not require a parent-child relationship.
71
What is a socket?
An endpoint for communication.
72
What identifies a socket?
An IP address and a port number.
73
What is the loopback address?
127.0.0.1.
74
What is a Remote Procedure Call (RPC)?
A mechanism that allows a process to call a procedure on another machine as if it were local.
75
What is a client stub in RPC?
A proxy on the client side that marshals parameters and contacts the server.
76
What is a server stub in RPC?
A proxy on the server side that unpacks parameters and executes the procedure.
77
What Linux structure represents a process?
task_struct.
78
What information does task_struct store?
PID, process state, parent process, children, open files, and memory information.
Study all 78 cards for free