Local variables and return addresses are stored in the process’s:
Process Management
The process concept and its memory layout, process states and the PCB, scheduling queues and schedulers, context switches, process creation (fork/exec) and termination, and interprocess communication with shared memory (bounded buffer) and message passing.
How to read this page
Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.
All 48 slides
- 1 Chapter 3: Processes
- 2 Outline
- 3 Objectives
- 4 Process Concept
- 5 Process Concept (Cont.)
- 6 Process in Memory
- 7 Process State
- 8 Diagram of Process State
- 9 Process Control Block (PCB)
- 10 Process Control Block (PCB)
- 11 Threads
- 12 Process Representation in Linux
- 13 Process Scheduling
- 14 Ready and Wait Queues
- 15 Representation of Process Scheduling
- 16 Schedulers
- 17 Addition of Medium Term Scheduling
- 18 Schedulers (Cont.)
- 19 Context Switch
- 20 CPU Switch From Process to Process
- 21 Operations on Processes
- 22 Process Creation
- 23 Process Creation (Cont.)
- 24 A Tree of Processes in Linux
- 25 C Program Forking Separate Process
- 26 Creating a Separate Process via Windows API
- 27 Process Termination
- 28 Process Termination
- 29 Android Process Importance Hierarchy
- 30 Multiprocess Architecture – Chrome Browser
- 31 Interprocess Communication
- 32 Communications Models
- 33 Producer-Consumer Problem
- 34 IPC – Shared Memory
- 35 Bounded-Buffer – Shared-Memory Solution
- 36 Producer Process – Shared Memory
- 37 Consumer Process – Shared Memory
- 38 What about Filling all the Buffers?
- 39 Producer
- 40 Consumer
- 41 IPC – Message Passing
- 42 Message Passing (Cont.)
- 43 Implementation of Communication Link
- 44 Direct Communication
- 45 Indirect Communication
- 46 Indirect Communication (Cont.)
- 47 Indirect Communication (Cont.)
- 48 Slide 48
Process in Memory
Notes
Memory layout from low to high: text, data, heap (grows up) … stack (grows down).
Exam angle
Diagram of Process State
Notes
Transitions: ready → running (dispatch), running → ready (interrupt), running → waiting (I/O or event wait), waiting → ready (I/O done).
Trap A waiting process goes to READY when its I/O completes, never straight to running.
Exam angle
When a process’s I/O completes, it moves from waiting to:
Process Control Block (PCB)
Exam angle
Which is NOT stored in a PCB?
Ready and Wait Queues
Notes
Ready queue: processes in memory waiting for the CPU. Wait queues: waiting for an event or device.
Schedulers
Notes
Short-term (CPU) scheduler: picks the next ready process, runs very often. Long-term (job) scheduler: controls the degree of multiprogramming.
Exam angle
The scheduler that controls the degree of multiprogramming is the:
Addition of Medium Term Scheduling
Notes
Medium-term scheduler: swaps processes out of memory and back in to reduce the degree of multiprogramming.
Schedulers (Cont.)
Notes
I/O-bound processes: many short CPU bursts. CPU-bound: few long bursts. A good mix keeps both CPU and devices busy.
Context Switch
Exam angle
During a context switch the system does useful work for the processes.
- It is overhead.
Process Creation (Cont.)
Notes
UNIX: fork() makes a copy of the parent; exec() replaces the child’s memory with a new program; wait() lets the parent wait.
Exam angle
After fork(), the return value in the child process is:
- The parent receives the child’s pid; −1 means failure.
Process Termination
Notes
exit() ends a process; the parent collects the status with wait(). Zombie: terminated but parent hasn’t called wait(). Orphan: parent ended without waiting.
Exam angle
A process that has terminated but whose parent has not yet called wait() is a:
Communications Models
Notes
Two IPC models: shared memory (fast, processes synchronize themselves) and message passing (kernel involved, easier for small data and distributed systems).
Exam angle
Which IPC model is usually faster once set up?
- No system call per exchange after the region is set up.
Bounded-Buffer – Shared-Memory Solution
Notes
Circular bounded buffer: in = next free slot, out = first full slot. Empty when in out; full when (in + 1) % SIZE out, so only SIZE − 1 items fit.
Exam angle
With the in/out bounded-buffer solution and BUFFER_SIZE = 10, at most how many items can be in the buffer?
- One slot stays empty to tell full from empty.
What about Filling all the Buffers?
Notes
Adding a count variable lets all slots be used, but count++ / count-- then need synchronization (race condition → Ch 6).
Seen again Chapter 6: Synchronization, slide 6: the race on count
Indirect Communication
Notes
Indirect communication: send to / receive from a mailbox (port); a link can join many processes.
Exam angle
In indirect communication, messages are sent to:
Indirect Communication (Cont.)
Notes
Blocking (synchronous) vs. non-blocking (asynchronous) send and receive. Blocking send + blocking receive = rendezvous.