Massively parallel processing (MPP) architecture
most important thing is that it not scale storage but also compute node
Massively parallel processing (MPP) architecture
most important thing is that it not scale storage but also compute node
How MPG works
Each processor have a local queue of goroutine, processor will spawn thread to consume goroutine task.
pre-allocated region is typically kept 7:51 small the exact size depends on the 7:54 compiler we are using but generally it 7:56 won't exceed a few megabytes this might
stack size depend on programming language and os, but in general it will not more than few MB
Keep contexts going with context.WithoutCancel()
There are scenarios where we need certain operations to proceed without being interrupted by the cancellation of their parent context.
A nil slice doesn't allocate any memory.
Returning null on error will make panic easier
When a parent goroutine creates a child goroutine in Go, the context can be propagated from the parent to the child. Context propagation allows the child goroutine to inherit and carry forward the same context values, deadlines, and cancellations.
child context does not effect others child context
This is basically a context switch of go-routines done by runtime scheduler. Observe that when send operation was executed, G1 was running, but by the end of the operation, G2 is running and G1 is blocked. Also note that, OS thread t1(m) is not blocked.
context switching go runtime is much easier than os
2.user space vs kernel space
The important thing to note here is that the copy into and out of the channel buffer is what gives us memory safety. The only shared memory both the go-routines access is hchan which is protected by mutex. Every object is just a copy. This property is what allows channels to align with the principle
it still mutex channel, but the message not be mutate, just copy in and out of the channel
recvq and sendq: These fields represent the waiting queues for blocked goroutines that are either waiting to read data from or write data to the channel. It contains reference to another structure sudog, which also plays a role in channel operations but will be explored later in the blog.
if buf not full or empty there is no need this field
Singelton Pattern
using sync.once, guerantee that initialization code inside the once.Do block is executed only once
Factory Method
loan package v1, v2
Decorator Pattern
higher order function
1. Builder Pattern
dynamic for client for e.g query builder