I read that goroutines are now preemptible. The preemption is done via a sysmon
goroutine that sends stop signals to goroutines which have used up their time slice. On posix systems, I believe this is done through pthread_kill
. My question is: how does this work in windows since windows doesn't support thread signaling? I had assumed that the go runtime may have been using a posix thread library like pthreads4w
, however I just saw that even in pthreads4w
, pthread_kill
doesn't support sending signals.
How does Go preempt goroutines in windows?
250 Views Asked by Samuel Okechukwu At
1
There are 1 best solutions below
Related Questions in MULTITHREADING
- Convert Apache VirtualHost to nginx Server Block for Dynamic Subdomains
- Nested dynamically generated forms using jQuery
- AngularJS Dynamic Slider Control
- dynamic content control mapping for MS word c#
- get value from the dynamic create textbox
- Android : Unable to change width of dynamic button
- saving matlab file (.mat) with dynamic name
- MODx Create dynamic frontend page / display manager page without login
- Dynamic XML parsing, data storage, and forms in c#
- Cannot convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.....' - Umbraco v6
Related Questions in GO
- Convert Apache VirtualHost to nginx Server Block for Dynamic Subdomains
- Nested dynamically generated forms using jQuery
- AngularJS Dynamic Slider Control
- dynamic content control mapping for MS word c#
- get value from the dynamic create textbox
- Android : Unable to change width of dynamic button
- saving matlab file (.mat) with dynamic name
- MODx Create dynamic frontend page / display manager page without login
- Dynamic XML parsing, data storage, and forms in c#
- Cannot convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.....' - Umbraco v6
Related Questions in WINAPI
- Convert Apache VirtualHost to nginx Server Block for Dynamic Subdomains
- Nested dynamically generated forms using jQuery
- AngularJS Dynamic Slider Control
- dynamic content control mapping for MS word c#
- get value from the dynamic create textbox
- Android : Unable to change width of dynamic button
- saving matlab file (.mat) with dynamic name
- MODx Create dynamic frontend page / display manager page without login
- Dynamic XML parsing, data storage, and forms in c#
- Cannot convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.....' - Umbraco v6
Related Questions in GOROUTINE
- Convert Apache VirtualHost to nginx Server Block for Dynamic Subdomains
- Nested dynamically generated forms using jQuery
- AngularJS Dynamic Slider Control
- dynamic content control mapping for MS word c#
- get value from the dynamic create textbox
- Android : Unable to change width of dynamic button
- saving matlab file (.mat) with dynamic name
- MODx Create dynamic frontend page / display manager page without login
- Dynamic XML parsing, data storage, and forms in c#
- Cannot convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.....' - Umbraco v6
Related Questions in PREEMPTION
- Convert Apache VirtualHost to nginx Server Block for Dynamic Subdomains
- Nested dynamically generated forms using jQuery
- AngularJS Dynamic Slider Control
- dynamic content control mapping for MS word c#
- get value from the dynamic create textbox
- Android : Unable to change width of dynamic button
- saving matlab file (.mat) with dynamic name
- MODx Create dynamic frontend page / display manager page without login
- Dynamic XML parsing, data storage, and forms in c#
- Cannot convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.....' - Umbraco v6
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The comments in
runtime/preempt.go
give an overview of how preemption works in the runtime. Specifically to do with asynchronous preemption:So how does async preemption work on windows? As mentioned in the original proposal for non-cooperative preemption of goroutines:
The Windows
SuspendThread
function can be used to suspend a thread by its handle, andGetThreadContext
can be used to get the processor state of the thread. The specific usages of these functions are implemented inruntime/os_windows.go