Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/golang-basics/concurrency
A go routines can block for one of these reasons:
Here's the full list of Go routines statuses:
Feel free to check the rest of the statuses in the runtime source code
Here are couple of simple rules to make sure channels are used correctly
The Coffman Conditions are known as the techniques/conditions to help detect, prevent and correct deadlocks. The Coffman Conditions are as follows:
Mutual Exclusion
A concurrent process holds exclusive rights to a resource, at any one time.
Wait for Condition
A concurrent process must simultaneously hold a resource and be waiting for an additional resource.
No Preemption
A resource held by a concurrent process can only be released by that process
Circular Wait
A concurrent process (P1) must be waiting on a chain of other concurrent processes (P2), which are in turn waiting on it (P1)
Primarily the Go scheduler has the opportunity to get triggered on these events:
G - goroutine M - worker thread, or machine P - processor, a resource that is required to execute Go code. M must have an associated P to execute Go code
Once the syscall exists Go tries to apply one of the rules:
Goroutines do not go in the global queue only when the local queue is full; it is also pushed in it when Go inject a list of goroutines to the scheduler, e.g. from the network poller or goroutines asleep during the garbage collection
sysmon
is smart enough to not consume resources when there is nothing to do.
Its cycle time is dynamic and depends on the current activity of the running program.
The initial pace is set at 20 nanoseconds, meaning the thread is constantly looking to help.
Then, after some cycles, if the thread is not doing anything, the sleep between two cycles
will double until it reaches 10ms.
If your application does not have many system calls or long-running goroutines,
the thread should back off to a 10ms delay most of its time, giving
a very light overhead to your application.
For the implementation details checkout sysmon
source code
The thread is also able to detect when it should not run. Here are two cases:
Here's how Go makes sure to equally distribute & balance work and make use of computer resources as efficient as possible:
GOMAXPROCS=2 GODEBUG=schedtrace=1000,scheddetail=1 go run main.go
In general terms a pipeline is a mechanism for inter-process communication using message passing, where the output of a pipeline is the input for the next pipeline.
Suppose that assembling one car requires three tasks that take 20, 10, and 15 minutes, respectively. Then, if all three tasks were performed by a single station, the factory would output one car every 45 minutes. By using a pipeline of three stations, the factory would output the first car in 45 minutes, and then a new one every 20 minutes.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.