General Concepts
Goroutines
Smallest sequence of programmed instructions that can run independently
Managed by OS
Smallest sequence of programmed instructions that can run independently
Managed by OS
Context Switch by swapping out data at CPU level
C10k is the problem of concurrently handling ten thousand connections.
Handling many concurrent connections is a different problem to handling many requests per second.
The latter requires high throughput
(processing them quickly)
While C10K does not have to be fast,
but requires efficient scheduling of connections.
Smallest sequence of programmed instructions that can run independently
Smallest sequence of programmed instructions that can run independently
Managed by
Context Switch by swapping out data at runtime level
Processor is the only component being used for execution
Execution is dependent on the input-output system and its resources, such as disk drives and peripheral devices
Concurrency vs. Parallelism
Call 1
Write Email
Prep Food
Call 2
Send Email
Eat Food
You
Concurrency
Concurrency vs. Parallelism
Call 1
Write Email
Eat Food
You
Call 2
Prep Food
Eat Food
Friend
Call 3
Send Email
Parallelism
Call 1
Email 1/2
Prep Food
Call 2
Email 2/2
Eat Food
Call 1
Email 1/2
Prep Food
Call 2
Email 2/2
You: Core #1
Friend: Core #2
Global
Run
queue
Do not communicate by sharing memory; instead, share memory by communicating.
See Sample 7
See Sample 9