CSE 120 Lecture Notes - Lecture 3: Interrupt, Process State, System Call

51 views4 pages
Timesharing
-notion of all processes somehow running “in parallel”
-in reality, each process gets quantum of CPU time (fixed amount of time)
-illusion of parallel progress by “rapidly switching” CPU!
How is timesharing implemented?
-Kernel keeps track of progress of each process
-state of progress:
- Running: use CPU, make progress
- Ready: able to make progress, not using CPU
- Blocked: not able to make progress, can’t use CPU
-Kernel selects a “ready” process to run
-kernel gets back control
-selects next process to run
Process State Diagram
-processes ask for resources via system calls
-if system is busy, then the process is “blocked” by the kernel
State transitions:
- Sleep: process gives up CPU to “wait” for event
- Wakeup: event occured, make process ready
- Puts process in the ready state
- Dispatch: kernel actually gave the CPU to that process
- Change from ready to running
- Preempt: take away the CPU from this process and give it to someone else
- Move process to ready state (still has the resources to run!)
Logical vs. Physical Execution
Logical
Able to execute Not able to execute
Physical Actually Run X
Executing
Not actually Ready Blocked
executing
When does the kernel run? - system call or hardware interrupt
Kernel runs as part of the running process
Kernel “maintains” list of processes
- Contents of CPU contexts
- Areas of memory being used
- Reasons for being blocked (so the kernel knows when to ready a blocked process)
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.