Instructions to use HyperionGrayAI/cybermodels-windows with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use HyperionGrayAI/cybermodels-windows with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-Coder-Next") model = PeftModel.from_pretrained(base_model, "HyperionGrayAI/cybermodels-windows") - Notebooks
- Google Colab
- Kaggle
Release Cybermodels Windows v0.1 adapter, reference index and training data
Browse files- .gitattributes +1 -0
- COPYING +674 -0
- LICENSE-ADAPTER +202 -0
- NOTICE.md +7 -0
- README.md +53 -0
- TRAINING.md +21 -0
- adapter_config.json +19 -0
- adapter_model.safetensors +3 -0
- ask_transformers.py +45 -0
- build_data.py +121 -0
- data/additional-references.json +4 -0
- data/eval.jsonl +16 -0
- data/examples.jsonl +74 -0
- data/questions.tsv +38 -0
- data/train.jsonl +58 -0
- gpuless_provenance.json +25 -0
- release.json +20 -0
- runtime/flash_revision.py +33 -0
- runtime/reference.py +49 -0
- runtime/serve_windows.py +104 -0
- sources.json +121 -0
- sources/MicrosoftDocs/win32/LICENSE +395 -0
- sources/MicrosoftDocs/win32/LICENSE-CODE +17 -0
- sources/MicrosoftDocs/win32/condition-variables.md +82 -0
- sources/MicrosoftDocs/win32/context-switches.md +36 -0
- sources/MicrosoftDocs/win32/critical-section-objects.md +43 -0
- sources/MicrosoftDocs/win32/event-objects.md +37 -0
- sources/MicrosoftDocs/win32/file-mapping.md +37 -0
- sources/MicrosoftDocs/win32/i-o-completion-ports.md +73 -0
- sources/MicrosoftDocs/win32/job-objects.md +97 -0
- sources/MicrosoftDocs/win32/mutex-objects.md +36 -0
- sources/MicrosoftDocs/win32/page-state.md +27 -0
- sources/MicrosoftDocs/win32/process-handles-and-identifiers.md +21 -0
- sources/MicrosoftDocs/win32/scheduling-priorities.md +250 -0
- sources/MicrosoftDocs/win32/semaphore-objects.md +38 -0
- sources/MicrosoftDocs/win32/synchronous-and-asynchronous-i-o.md +76 -0
- sources/MicrosoftDocs/win32/thread-local-storage.md +40 -0
- sources/MicrosoftDocs/win32/working-set.md +37 -0
- sources/MicrosoftDocs/windows-driver-docs/LICENSE +395 -0
- sources/MicrosoftDocs/windows-driver-docs/LICENSE-CODE +17 -0
- sources/MicrosoftDocs/windows-driver-docs/canceling-irps.md +38 -0
- sources/MicrosoftDocs/windows-driver-docs/introduction-to-kernel-dispatcher-objects.md +63 -0
- training/capture.py +160 -0
- training/fit.py +239 -0
- training/flash_revision.py +33 -0
- training/question_scores.json +1112 -0
- training/scores.json +67 -0
- windows.sqlite +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
windows.sqlite filter=lfs diff=lfs merge=lfs -text
|
COPYING
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 29 June 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works.
|
| 12 |
+
|
| 13 |
+
The licenses for most software and other practical works are designed
|
| 14 |
+
to take away your freedom to share and change the works. By contrast,
|
| 15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 16 |
+
share and change all versions of a program--to make sure it remains free
|
| 17 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 18 |
+
GNU General Public License for most of our software; it applies also to
|
| 19 |
+
any other work released this way by its authors. You can apply it to
|
| 20 |
+
your programs, too.
|
| 21 |
+
|
| 22 |
+
When we speak of free software, we are referring to freedom, not
|
| 23 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 24 |
+
have the freedom to distribute copies of free software (and charge for
|
| 25 |
+
them if you wish), that you receive source code or can get it if you
|
| 26 |
+
want it, that you can change the software or use pieces of it in new
|
| 27 |
+
free programs, and that you know you can do these things.
|
| 28 |
+
|
| 29 |
+
To protect your rights, we need to prevent others from denying you
|
| 30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 31 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 32 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 33 |
+
|
| 34 |
+
For example, if you distribute copies of such a program, whether
|
| 35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 36 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 37 |
+
or can get the source code. And you must show them these terms so they
|
| 38 |
+
know their rights.
|
| 39 |
+
|
| 40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 43 |
+
|
| 44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 45 |
+
that there is no warranty for this free software. For both users' and
|
| 46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 47 |
+
changed, so that their problems will not be attributed erroneously to
|
| 48 |
+
authors of previous versions.
|
| 49 |
+
|
| 50 |
+
Some devices are designed to deny users access to install or run
|
| 51 |
+
modified versions of the software inside them, although the manufacturer
|
| 52 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 53 |
+
protecting users' freedom to change the software. The systematic
|
| 54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 56 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 57 |
+
products. If such problems arise substantially in other domains, we
|
| 58 |
+
stand ready to extend this provision to those domains in future versions
|
| 59 |
+
of the GPL, as needed to protect the freedom of users.
|
| 60 |
+
|
| 61 |
+
Finally, every program is threatened constantly by software patents.
|
| 62 |
+
States should not allow patents to restrict development and use of
|
| 63 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 64 |
+
avoid the special danger that patents applied to a free program could
|
| 65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 66 |
+
patents cannot be used to render the program non-free.
|
| 67 |
+
|
| 68 |
+
The precise terms and conditions for copying, distribution and
|
| 69 |
+
modification follow.
|
| 70 |
+
|
| 71 |
+
TERMS AND CONDITIONS
|
| 72 |
+
|
| 73 |
+
0. Definitions.
|
| 74 |
+
|
| 75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 76 |
+
|
| 77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 78 |
+
works, such as semiconductor masks.
|
| 79 |
+
|
| 80 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 82 |
+
"recipients" may be individuals or organizations.
|
| 83 |
+
|
| 84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 85 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 86 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 87 |
+
earlier work or a work "based on" the earlier work.
|
| 88 |
+
|
| 89 |
+
A "covered work" means either the unmodified Program or a work based
|
| 90 |
+
on the Program.
|
| 91 |
+
|
| 92 |
+
To "propagate" a work means to do anything with it that, without
|
| 93 |
+
permission, would make you directly or secondarily liable for
|
| 94 |
+
infringement under applicable copyright law, except executing it on a
|
| 95 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 96 |
+
distribution (with or without modification), making available to the
|
| 97 |
+
public, and in some countries other activities as well.
|
| 98 |
+
|
| 99 |
+
To "convey" a work means any kind of propagation that enables other
|
| 100 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 102 |
+
|
| 103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 104 |
+
to the extent that it includes a convenient and prominently visible
|
| 105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 106 |
+
tells the user that there is no warranty for the work (except to the
|
| 107 |
+
extent that warranties are provided), that licensees may convey the
|
| 108 |
+
work under this License, and how to view a copy of this License. If
|
| 109 |
+
the interface presents a list of user commands or options, such as a
|
| 110 |
+
menu, a prominent item in the list meets this criterion.
|
| 111 |
+
|
| 112 |
+
1. Source Code.
|
| 113 |
+
|
| 114 |
+
The "source code" for a work means the preferred form of the work
|
| 115 |
+
for making modifications to it. "Object code" means any non-source
|
| 116 |
+
form of a work.
|
| 117 |
+
|
| 118 |
+
A "Standard Interface" means an interface that either is an official
|
| 119 |
+
standard defined by a recognized standards body, or, in the case of
|
| 120 |
+
interfaces specified for a particular programming language, one that
|
| 121 |
+
is widely used among developers working in that language.
|
| 122 |
+
|
| 123 |
+
The "System Libraries" of an executable work include anything, other
|
| 124 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 125 |
+
packaging a Major Component, but which is not part of that Major
|
| 126 |
+
Component, and (b) serves only to enable use of the work with that
|
| 127 |
+
Major Component, or to implement a Standard Interface for which an
|
| 128 |
+
implementation is available to the public in source code form. A
|
| 129 |
+
"Major Component", in this context, means a major essential component
|
| 130 |
+
(kernel, window system, and so on) of the specific operating system
|
| 131 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 132 |
+
produce the work, or an object code interpreter used to run it.
|
| 133 |
+
|
| 134 |
+
The "Corresponding Source" for a work in object code form means all
|
| 135 |
+
the source code needed to generate, install, and (for an executable
|
| 136 |
+
work) run the object code and to modify the work, including scripts to
|
| 137 |
+
control those activities. However, it does not include the work's
|
| 138 |
+
System Libraries, or general-purpose tools or generally available free
|
| 139 |
+
programs which are used unmodified in performing those activities but
|
| 140 |
+
which are not part of the work. For example, Corresponding Source
|
| 141 |
+
includes interface definition files associated with source files for
|
| 142 |
+
the work, and the source code for shared libraries and dynamically
|
| 143 |
+
linked subprograms that the work is specifically designed to require,
|
| 144 |
+
such as by intimate data communication or control flow between those
|
| 145 |
+
subprograms and other parts of the work.
|
| 146 |
+
|
| 147 |
+
The Corresponding Source need not include anything that users
|
| 148 |
+
can regenerate automatically from other parts of the Corresponding
|
| 149 |
+
Source.
|
| 150 |
+
|
| 151 |
+
The Corresponding Source for a work in source code form is that
|
| 152 |
+
same work.
|
| 153 |
+
|
| 154 |
+
2. Basic Permissions.
|
| 155 |
+
|
| 156 |
+
All rights granted under this License are granted for the term of
|
| 157 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 158 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 159 |
+
permission to run the unmodified Program. The output from running a
|
| 160 |
+
covered work is covered by this License only if the output, given its
|
| 161 |
+
content, constitutes a covered work. This License acknowledges your
|
| 162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 163 |
+
|
| 164 |
+
You may make, run and propagate covered works that you do not
|
| 165 |
+
convey, without conditions so long as your license otherwise remains
|
| 166 |
+
in force. You may convey covered works to others for the sole purpose
|
| 167 |
+
of having them make modifications exclusively for you, or provide you
|
| 168 |
+
with facilities for running those works, provided that you comply with
|
| 169 |
+
the terms of this License in conveying all material for which you do
|
| 170 |
+
not control copyright. Those thus making or running the covered works
|
| 171 |
+
for you must do so exclusively on your behalf, under your direction
|
| 172 |
+
and control, on terms that prohibit them from making any copies of
|
| 173 |
+
your copyrighted material outside their relationship with you.
|
| 174 |
+
|
| 175 |
+
Conveying under any other circumstances is permitted solely under
|
| 176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 177 |
+
makes it unnecessary.
|
| 178 |
+
|
| 179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 180 |
+
|
| 181 |
+
No covered work shall be deemed part of an effective technological
|
| 182 |
+
measure under any applicable law fulfilling obligations under article
|
| 183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 184 |
+
similar laws prohibiting or restricting circumvention of such
|
| 185 |
+
measures.
|
| 186 |
+
|
| 187 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 188 |
+
circumvention of technological measures to the extent such circumvention
|
| 189 |
+
is effected by exercising rights under this License with respect to
|
| 190 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 191 |
+
modification of the work as a means of enforcing, against the work's
|
| 192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 193 |
+
technological measures.
|
| 194 |
+
|
| 195 |
+
4. Conveying Verbatim Copies.
|
| 196 |
+
|
| 197 |
+
You may convey verbatim copies of the Program's source code as you
|
| 198 |
+
receive it, in any medium, provided that you conspicuously and
|
| 199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 200 |
+
keep intact all notices stating that this License and any
|
| 201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 202 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 203 |
+
recipients a copy of this License along with the Program.
|
| 204 |
+
|
| 205 |
+
You may charge any price or no price for each copy that you convey,
|
| 206 |
+
and you may offer support or warranty protection for a fee.
|
| 207 |
+
|
| 208 |
+
5. Conveying Modified Source Versions.
|
| 209 |
+
|
| 210 |
+
You may convey a work based on the Program, or the modifications to
|
| 211 |
+
produce it from the Program, in the form of source code under the
|
| 212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 213 |
+
|
| 214 |
+
a) The work must carry prominent notices stating that you modified
|
| 215 |
+
it, and giving a relevant date.
|
| 216 |
+
|
| 217 |
+
b) The work must carry prominent notices stating that it is
|
| 218 |
+
released under this License and any conditions added under section
|
| 219 |
+
7. This requirement modifies the requirement in section 4 to
|
| 220 |
+
"keep intact all notices".
|
| 221 |
+
|
| 222 |
+
c) You must license the entire work, as a whole, under this
|
| 223 |
+
License to anyone who comes into possession of a copy. This
|
| 224 |
+
License will therefore apply, along with any applicable section 7
|
| 225 |
+
additional terms, to the whole of the work, and all its parts,
|
| 226 |
+
regardless of how they are packaged. This License gives no
|
| 227 |
+
permission to license the work in any other way, but it does not
|
| 228 |
+
invalidate such permission if you have separately received it.
|
| 229 |
+
|
| 230 |
+
d) If the work has interactive user interfaces, each must display
|
| 231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 233 |
+
work need not make them do so.
|
| 234 |
+
|
| 235 |
+
A compilation of a covered work with other separate and independent
|
| 236 |
+
works, which are not by their nature extensions of the covered work,
|
| 237 |
+
and which are not combined with it such as to form a larger program,
|
| 238 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 240 |
+
used to limit the access or legal rights of the compilation's users
|
| 241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 242 |
+
in an aggregate does not cause this License to apply to the other
|
| 243 |
+
parts of the aggregate.
|
| 244 |
+
|
| 245 |
+
6. Conveying Non-Source Forms.
|
| 246 |
+
|
| 247 |
+
You may convey a covered work in object code form under the terms
|
| 248 |
+
of sections 4 and 5, provided that you also convey the
|
| 249 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 250 |
+
in one of these ways:
|
| 251 |
+
|
| 252 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 253 |
+
(including a physical distribution medium), accompanied by the
|
| 254 |
+
Corresponding Source fixed on a durable physical medium
|
| 255 |
+
customarily used for software interchange.
|
| 256 |
+
|
| 257 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 258 |
+
(including a physical distribution medium), accompanied by a
|
| 259 |
+
written offer, valid for at least three years and valid for as
|
| 260 |
+
long as you offer spare parts or customer support for that product
|
| 261 |
+
model, to give anyone who possesses the object code either (1) a
|
| 262 |
+
copy of the Corresponding Source for all the software in the
|
| 263 |
+
product that is covered by this License, on a durable physical
|
| 264 |
+
medium customarily used for software interchange, for a price no
|
| 265 |
+
more than your reasonable cost of physically performing this
|
| 266 |
+
conveying of source, or (2) access to copy the
|
| 267 |
+
Corresponding Source from a network server at no charge.
|
| 268 |
+
|
| 269 |
+
c) Convey individual copies of the object code with a copy of the
|
| 270 |
+
written offer to provide the Corresponding Source. This
|
| 271 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 272 |
+
only if you received the object code with such an offer, in accord
|
| 273 |
+
with subsection 6b.
|
| 274 |
+
|
| 275 |
+
d) Convey the object code by offering access from a designated
|
| 276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 277 |
+
Corresponding Source in the same way through the same place at no
|
| 278 |
+
further charge. You need not require recipients to copy the
|
| 279 |
+
Corresponding Source along with the object code. If the place to
|
| 280 |
+
copy the object code is a network server, the Corresponding Source
|
| 281 |
+
may be on a different server (operated by you or a third party)
|
| 282 |
+
that supports equivalent copying facilities, provided you maintain
|
| 283 |
+
clear directions next to the object code saying where to find the
|
| 284 |
+
Corresponding Source. Regardless of what server hosts the
|
| 285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 286 |
+
available for as long as needed to satisfy these requirements.
|
| 287 |
+
|
| 288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 289 |
+
you inform other peers where the object code and Corresponding
|
| 290 |
+
Source of the work are being offered to the general public at no
|
| 291 |
+
charge under subsection 6d.
|
| 292 |
+
|
| 293 |
+
A separable portion of the object code, whose source code is excluded
|
| 294 |
+
from the Corresponding Source as a System Library, need not be
|
| 295 |
+
included in conveying the object code work.
|
| 296 |
+
|
| 297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 298 |
+
tangible personal property which is normally used for personal, family,
|
| 299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 302 |
+
product received by a particular user, "normally used" refers to a
|
| 303 |
+
typical or common use of that class of product, regardless of the status
|
| 304 |
+
of the particular user or of the way in which the particular user
|
| 305 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 306 |
+
is a consumer product regardless of whether the product has substantial
|
| 307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 308 |
+
the only significant mode of use of the product.
|
| 309 |
+
|
| 310 |
+
"Installation Information" for a User Product means any methods,
|
| 311 |
+
procedures, authorization keys, or other information required to install
|
| 312 |
+
and execute modified versions of a covered work in that User Product from
|
| 313 |
+
a modified version of its Corresponding Source. The information must
|
| 314 |
+
suffice to ensure that the continued functioning of the modified object
|
| 315 |
+
code is in no case prevented or interfered with solely because
|
| 316 |
+
modification has been made.
|
| 317 |
+
|
| 318 |
+
If you convey an object code work under this section in, or with, or
|
| 319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 320 |
+
part of a transaction in which the right of possession and use of the
|
| 321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 322 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 323 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 324 |
+
by the Installation Information. But this requirement does not apply
|
| 325 |
+
if neither you nor any third party retains the ability to install
|
| 326 |
+
modified object code on the User Product (for example, the work has
|
| 327 |
+
been installed in ROM).
|
| 328 |
+
|
| 329 |
+
The requirement to provide Installation Information does not include a
|
| 330 |
+
requirement to continue to provide support service, warranty, or updates
|
| 331 |
+
for a work that has been modified or installed by the recipient, or for
|
| 332 |
+
the User Product in which it has been modified or installed. Access to a
|
| 333 |
+
network may be denied when the modification itself materially and
|
| 334 |
+
adversely affects the operation of the network or violates the rules and
|
| 335 |
+
protocols for communication across the network.
|
| 336 |
+
|
| 337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 338 |
+
in accord with this section must be in a format that is publicly
|
| 339 |
+
documented (and with an implementation available to the public in
|
| 340 |
+
source code form), and must require no special password or key for
|
| 341 |
+
unpacking, reading or copying.
|
| 342 |
+
|
| 343 |
+
7. Additional Terms.
|
| 344 |
+
|
| 345 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 346 |
+
License by making exceptions from one or more of its conditions.
|
| 347 |
+
Additional permissions that are applicable to the entire Program shall
|
| 348 |
+
be treated as though they were included in this License, to the extent
|
| 349 |
+
that they are valid under applicable law. If additional permissions
|
| 350 |
+
apply only to part of the Program, that part may be used separately
|
| 351 |
+
under those permissions, but the entire Program remains governed by
|
| 352 |
+
this License without regard to the additional permissions.
|
| 353 |
+
|
| 354 |
+
When you convey a copy of a covered work, you may at your option
|
| 355 |
+
remove any additional permissions from that copy, or from any part of
|
| 356 |
+
it. (Additional permissions may be written to require their own
|
| 357 |
+
removal in certain cases when you modify the work.) You may place
|
| 358 |
+
additional permissions on material, added by you to a covered work,
|
| 359 |
+
for which you have or can give appropriate copyright permission.
|
| 360 |
+
|
| 361 |
+
Notwithstanding any other provision of this License, for material you
|
| 362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 363 |
+
that material) supplement the terms of this License with terms:
|
| 364 |
+
|
| 365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 366 |
+
terms of sections 15 and 16 of this License; or
|
| 367 |
+
|
| 368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 369 |
+
author attributions in that material or in the Appropriate Legal
|
| 370 |
+
Notices displayed by works containing it; or
|
| 371 |
+
|
| 372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 373 |
+
requiring that modified versions of such material be marked in
|
| 374 |
+
reasonable ways as different from the original version; or
|
| 375 |
+
|
| 376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 377 |
+
authors of the material; or
|
| 378 |
+
|
| 379 |
+
e) Declining to grant rights under trademark law for use of some
|
| 380 |
+
trade names, trademarks, or service marks; or
|
| 381 |
+
|
| 382 |
+
f) Requiring indemnification of licensors and authors of that
|
| 383 |
+
material by anyone who conveys the material (or modified versions of
|
| 384 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 385 |
+
any liability that these contractual assumptions directly impose on
|
| 386 |
+
those licensors and authors.
|
| 387 |
+
|
| 388 |
+
All other non-permissive additional terms are considered "further
|
| 389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 390 |
+
received it, or any part of it, contains a notice stating that it is
|
| 391 |
+
governed by this License along with a term that is a further
|
| 392 |
+
restriction, you may remove that term. If a license document contains
|
| 393 |
+
a further restriction but permits relicensing or conveying under this
|
| 394 |
+
License, you may add to a covered work material governed by the terms
|
| 395 |
+
of that license document, provided that the further restriction does
|
| 396 |
+
not survive such relicensing or conveying.
|
| 397 |
+
|
| 398 |
+
If you add terms to a covered work in accord with this section, you
|
| 399 |
+
must place, in the relevant source files, a statement of the
|
| 400 |
+
additional terms that apply to those files, or a notice indicating
|
| 401 |
+
where to find the applicable terms.
|
| 402 |
+
|
| 403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 404 |
+
form of a separately written license, or stated as exceptions;
|
| 405 |
+
the above requirements apply either way.
|
| 406 |
+
|
| 407 |
+
8. Termination.
|
| 408 |
+
|
| 409 |
+
You may not propagate or modify a covered work except as expressly
|
| 410 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 411 |
+
modify it is void, and will automatically terminate your rights under
|
| 412 |
+
this License (including any patent licenses granted under the third
|
| 413 |
+
paragraph of section 11).
|
| 414 |
+
|
| 415 |
+
However, if you cease all violation of this License, then your
|
| 416 |
+
license from a particular copyright holder is reinstated (a)
|
| 417 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 419 |
+
holder fails to notify you of the violation by some reasonable means
|
| 420 |
+
prior to 60 days after the cessation.
|
| 421 |
+
|
| 422 |
+
Moreover, your license from a particular copyright holder is
|
| 423 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 424 |
+
violation by some reasonable means, this is the first time you have
|
| 425 |
+
received notice of violation of this License (for any work) from that
|
| 426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 427 |
+
your receipt of the notice.
|
| 428 |
+
|
| 429 |
+
Termination of your rights under this section does not terminate the
|
| 430 |
+
licenses of parties who have received copies or rights from you under
|
| 431 |
+
this License. If your rights have been terminated and not permanently
|
| 432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 433 |
+
material under section 10.
|
| 434 |
+
|
| 435 |
+
9. Acceptance Not Required for Having Copies.
|
| 436 |
+
|
| 437 |
+
You are not required to accept this License in order to receive or
|
| 438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 440 |
+
to receive a copy likewise does not require acceptance. However,
|
| 441 |
+
nothing other than this License grants you permission to propagate or
|
| 442 |
+
modify any covered work. These actions infringe copyright if you do
|
| 443 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 444 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 445 |
+
|
| 446 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 447 |
+
|
| 448 |
+
Each time you convey a covered work, the recipient automatically
|
| 449 |
+
receives a license from the original licensors, to run, modify and
|
| 450 |
+
propagate that work, subject to this License. You are not responsible
|
| 451 |
+
for enforcing compliance by third parties with this License.
|
| 452 |
+
|
| 453 |
+
An "entity transaction" is a transaction transferring control of an
|
| 454 |
+
organization, or substantially all assets of one, or subdividing an
|
| 455 |
+
organization, or merging organizations. If propagation of a covered
|
| 456 |
+
work results from an entity transaction, each party to that
|
| 457 |
+
transaction who receives a copy of the work also receives whatever
|
| 458 |
+
licenses to the work the party's predecessor in interest had or could
|
| 459 |
+
give under the previous paragraph, plus a right to possession of the
|
| 460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 461 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 462 |
+
|
| 463 |
+
You may not impose any further restrictions on the exercise of the
|
| 464 |
+
rights granted or affirmed under this License. For example, you may
|
| 465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 466 |
+
rights granted under this License, and you may not initiate litigation
|
| 467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 468 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 469 |
+
sale, or importing the Program or any portion of it.
|
| 470 |
+
|
| 471 |
+
11. Patents.
|
| 472 |
+
|
| 473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 474 |
+
License of the Program or a work on which the Program is based. The
|
| 475 |
+
work thus licensed is called the contributor's "contributor version".
|
| 476 |
+
|
| 477 |
+
A contributor's "essential patent claims" are all patent claims
|
| 478 |
+
owned or controlled by the contributor, whether already acquired or
|
| 479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 480 |
+
by this License, of making, using, or selling its contributor version,
|
| 481 |
+
but do not include claims that would be infringed only as a
|
| 482 |
+
consequence of further modification of the contributor version. For
|
| 483 |
+
purposes of this definition, "control" includes the right to grant
|
| 484 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 485 |
+
this License.
|
| 486 |
+
|
| 487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 488 |
+
patent license under the contributor's essential patent claims, to
|
| 489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 490 |
+
propagate the contents of its contributor version.
|
| 491 |
+
|
| 492 |
+
In the following three paragraphs, a "patent license" is any express
|
| 493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 494 |
+
(such as an express permission to practice a patent or covenant not to
|
| 495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 496 |
+
party means to make such an agreement or commitment not to enforce a
|
| 497 |
+
patent against the party.
|
| 498 |
+
|
| 499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 500 |
+
and the Corresponding Source of the work is not available for anyone
|
| 501 |
+
to copy, free of charge and under the terms of this License, through a
|
| 502 |
+
publicly available network server or other readily accessible means,
|
| 503 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 506 |
+
consistent with the requirements of this License, to extend the patent
|
| 507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 508 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 509 |
+
covered work in a country, or your recipient's use of the covered work
|
| 510 |
+
in a country, would infringe one or more identifiable patents in that
|
| 511 |
+
country that you have reason to believe are valid.
|
| 512 |
+
|
| 513 |
+
If, pursuant to or in connection with a single transaction or
|
| 514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 515 |
+
covered work, and grant a patent license to some of the parties
|
| 516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 517 |
+
or convey a specific copy of the covered work, then the patent license
|
| 518 |
+
you grant is automatically extended to all recipients of the covered
|
| 519 |
+
work and works based on it.
|
| 520 |
+
|
| 521 |
+
A patent license is "discriminatory" if it does not include within
|
| 522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 524 |
+
specifically granted under this License. You may not convey a covered
|
| 525 |
+
work if you are a party to an arrangement with a third party that is
|
| 526 |
+
in the business of distributing software, under which you make payment
|
| 527 |
+
to the third party based on the extent of your activity of conveying
|
| 528 |
+
the work, and under which the third party grants, to any of the
|
| 529 |
+
parties who would receive the covered work from you, a discriminatory
|
| 530 |
+
patent license (a) in connection with copies of the covered work
|
| 531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 532 |
+
for and in connection with specific products or compilations that
|
| 533 |
+
contain the covered work, unless you entered into that arrangement,
|
| 534 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 535 |
+
|
| 536 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 537 |
+
any implied license or other defenses to infringement that may
|
| 538 |
+
otherwise be available to you under applicable patent law.
|
| 539 |
+
|
| 540 |
+
12. No Surrender of Others' Freedom.
|
| 541 |
+
|
| 542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 543 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 546 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 548 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 549 |
+
the Program, the only way you could satisfy both those terms and this
|
| 550 |
+
License would be to refrain entirely from conveying the Program.
|
| 551 |
+
|
| 552 |
+
13. Use with the GNU Affero General Public License.
|
| 553 |
+
|
| 554 |
+
Notwithstanding any other provision of this License, you have
|
| 555 |
+
permission to link or combine any covered work with a work licensed
|
| 556 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 557 |
+
combined work, and to convey the resulting work. The terms of this
|
| 558 |
+
License will continue to apply to the part which is the covered work,
|
| 559 |
+
but the special requirements of the GNU Affero General Public License,
|
| 560 |
+
section 13, concerning interaction through a network will apply to the
|
| 561 |
+
combination as such.
|
| 562 |
+
|
| 563 |
+
14. Revised Versions of this License.
|
| 564 |
+
|
| 565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 566 |
+
the GNU General Public License from time to time. Such new versions will
|
| 567 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 568 |
+
address new problems or concerns.
|
| 569 |
+
|
| 570 |
+
Each version is given a distinguishing version number. If the
|
| 571 |
+
Program specifies that a certain numbered version of the GNU General
|
| 572 |
+
Public License "or any later version" applies to it, you have the
|
| 573 |
+
option of following the terms and conditions either of that numbered
|
| 574 |
+
version or of any later version published by the Free Software
|
| 575 |
+
Foundation. If the Program does not specify a version number of the
|
| 576 |
+
GNU General Public License, you may choose any version ever published
|
| 577 |
+
by the Free Software Foundation.
|
| 578 |
+
|
| 579 |
+
If the Program specifies that a proxy can decide which future
|
| 580 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 581 |
+
public statement of acceptance of a version permanently authorizes you
|
| 582 |
+
to choose that version for the Program.
|
| 583 |
+
|
| 584 |
+
Later license versions may give you additional or different
|
| 585 |
+
permissions. However, no additional obligations are imposed on any
|
| 586 |
+
author or copyright holder as a result of your choosing to follow a
|
| 587 |
+
later version.
|
| 588 |
+
|
| 589 |
+
15. Disclaimer of Warranty.
|
| 590 |
+
|
| 591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 599 |
+
|
| 600 |
+
16. Limitation of Liability.
|
| 601 |
+
|
| 602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 610 |
+
SUCH DAMAGES.
|
| 611 |
+
|
| 612 |
+
17. Interpretation of Sections 15 and 16.
|
| 613 |
+
|
| 614 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 615 |
+
above cannot be given local legal effect according to their terms,
|
| 616 |
+
reviewing courts shall apply local law that most closely approximates
|
| 617 |
+
an absolute waiver of all civil liability in connection with the
|
| 618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 619 |
+
copy of the Program in return for a fee.
|
| 620 |
+
|
| 621 |
+
END OF TERMS AND CONDITIONS
|
| 622 |
+
|
| 623 |
+
How to Apply These Terms to Your New Programs
|
| 624 |
+
|
| 625 |
+
If you develop a new program, and you want it to be of the greatest
|
| 626 |
+
possible use to the public, the best way to achieve this is to make it
|
| 627 |
+
free software which everyone can redistribute and change under these terms.
|
| 628 |
+
|
| 629 |
+
To do so, attach the following notices to the program. It is safest
|
| 630 |
+
to attach them to the start of each source file to most effectively
|
| 631 |
+
state the exclusion of warranty; and each file should have at least
|
| 632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 633 |
+
|
| 634 |
+
{one line to give the program's name and a brief idea of what it does.}
|
| 635 |
+
Copyright (C) {year} {name of author}
|
| 636 |
+
|
| 637 |
+
This program is free software: you can redistribute it and/or modify
|
| 638 |
+
it under the terms of the GNU General Public License as published by
|
| 639 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 640 |
+
(at your option) any later version.
|
| 641 |
+
|
| 642 |
+
This program is distributed in the hope that it will be useful,
|
| 643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 645 |
+
GNU General Public License for more details.
|
| 646 |
+
|
| 647 |
+
You should have received a copy of the GNU General Public License
|
| 648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 649 |
+
|
| 650 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 651 |
+
|
| 652 |
+
If the program does terminal interaction, make it output a short
|
| 653 |
+
notice like this when it starts in an interactive mode:
|
| 654 |
+
|
| 655 |
+
{project} Copyright (C) {year} {fullname}
|
| 656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 657 |
+
This is free software, and you are welcome to redistribute it
|
| 658 |
+
under certain conditions; type `show c' for details.
|
| 659 |
+
|
| 660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 661 |
+
parts of the General Public License. Of course, your program's commands
|
| 662 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 663 |
+
|
| 664 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 667 |
+
<http://www.gnu.org/licenses/>.
|
| 668 |
+
|
| 669 |
+
The GNU General Public License does not permit incorporating your program
|
| 670 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 671 |
+
may consider it more useful to permit linking proprietary applications with
|
| 672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 673 |
+
Public License instead of this License. But first, please read
|
| 674 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
LICENSE-ADAPTER
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
NOTICE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Attribution and licenses
|
| 2 |
+
|
| 3 |
+
The adapter parameters are released by Hyperion Gray under Apache-2.0, included in LICENSE-ADAPTER. The base is Qwen/Qwen3-Coder-Next by the Qwen team, revision a7fbcb5c0e12d62a448eaa0e260346bf5dcc0feb, published under Apache-2.0. The base weights are downloaded separately.
|
| 4 |
+
|
| 5 |
+
The Microsoft Learn documents in sources/MicrosoftDocs are by Microsoft and contributors. Their contents are licensed under Creative Commons Attribution 4.0 International. Source code examples in those repositories carry the included MIT license. Each source record in sources.json links both the versioned original and the reader-facing page. The snapshot preserves the source Markdown. The SQLite reference index strips Markdown and splits the text into shorter passages for retrieval.
|
| 6 |
+
|
| 7 |
+
Hyperion Gray releases the authored questions, answers, additional reference notes, and their adaptations in the training examples under CC BY 4.0. Attribute Microsoft and contributors for the underlying documentation, and Hyperion Gray for the curation and adaptations. The license texts are included in the source directories. The software in this release follows the workspace's GPLv3 license in COPYING. Third-party runtimes retain their respective licenses.
|
README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: peft
|
| 3 |
+
base_model: Qwen/Qwen3-Coder-Next
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
tags:
|
| 9 |
+
- lora
|
| 10 |
+
- windows
|
| 11 |
+
- retrieval-augmented-generation
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Cybermodels Windows v0.1
|
| 15 |
+
|
| 16 |
+
Hyperion Gray's Windows Cybermodels preview pairs Qwennifer Flash with a rank-four output-head adapter and a versioned, offline Microsoft Learn reference index. It covers selected Windows scheduling, process, memory, synchronization and I/O topics. The hosted model ID is `cybermodels-windows` in ClusterFK.
|
| 17 |
+
|
| 18 |
+
## Ask a question
|
| 19 |
+
|
| 20 |
+
Sign in to ClusterFK, select **cybermodels-windows** in Solo or Collaborate, and ask a Windows question. One example is “When should I use WakeAllConditionVariable?” The worker retrieves supporting text for each user turn and asks Flash to cite the corresponding Microsoft Learn page. [Open ClusterFK](https://clusterfk.hgws.sh)
|
| 21 |
+
|
| 22 |
+
To run against the public Transformers base, install PyTorch, Transformers with Qwen3Next support, Accelerate, PEFT and safetensors. Download this whole repository, including its SQLite file, and run:
|
| 23 |
+
|
| 24 |
+
```sh
|
| 25 |
+
python ask_transformers.py 'Does an auto-reset event lose the signal if nobody is waiting?'
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
This entry point uses full BF16 base weights with six experts per token. It requires hardware or host memory for the full base. Hosted Flash uses the same adapter on its MXFP4 expert bank and packed spine with six experts per token. Quantization and execution differ between the two paths. The hosted measurements apply to the packed configuration.
|
| 29 |
+
|
| 30 |
+
## Data and training
|
| 31 |
+
|
| 32 |
+
The exact supervised examples are in `data/train.jsonl` and the evaluation examples in `data/eval.jsonl`. The columns include the question, the rendered user prompt, the complete target answer, source ID, retrieval hits and split. `data/questions.tsv` contains the authored questions and answers. Retrieval prompts include up to two source passages and targets for sourced training examples include a reference link. The closed-book prompt omits the reference text. Three questions ask for machine-specific facts that static documentation cannot establish.
|
| 33 |
+
|
| 34 |
+
The corpus has 37 distinct questions. Training uses 29 questions from 13 documents in two prompt conditions (58 examples). Eight questions from four other documents are evaluated in both conditions (16 examples). Each evaluation passage is available for open-book retrieval. `sources.json` lists all 17 pinned Microsoft articles. Two additional inference-only reference notes cover thread standby state and page-file sizing. SQLite FTS5 ranks document sections locally; the hosted model makes no web requests for retrieval.
|
| 35 |
+
|
| 36 |
+
The CPU-native GPUless optimizer updates rank-four matrices in a space derived from training activations and training vocabulary rows. It expands the result into standard PEFT tensors targeting `lm_head`. The rest of the model stays frozen. The exact upstream base revision and packed runtime fingerprint are in `release.json`. `training/scores.json` and `training/question_scores.json` report teacher-forced loss and token accuracy. The earlier book-based SOQOL pilot was a different dataset and adapter.
|
| 37 |
+
|
| 38 |
+
## Evaluation
|
| 39 |
+
|
| 40 |
+
Each condition uses the same eight held-out questions. At each answer position, the model receives the preceding reference tokens and predicts the next token. The retrieval condition includes citation tokens in the targets.
|
| 41 |
+
|
| 42 |
+
| Held-out condition | Target tokens | Qwennifer Flash | Flash + Windows adapter |
|
| 43 |
+
| --- | ---: | ---: | ---: |
|
| 44 |
+
| Question alone | 175 | 46.86% | 50.86% |
|
| 45 |
+
| Question and retrieved passages | 371 | 68.19% | 70.35% |
|
| 46 |
+
|
| 47 |
+
These percentages measure next-token accuracy. The small sample leaves general Windows answer quality open. In a separate free-generation check, the hosted model correctly identified that at most one thread can be on standby per logical processor and linked Microsoft Learn. It also put quotation marks around Hyperion Gray’s paraphrase. Verify exact quotations against the original page. [Microsoft Learn ThreadState reference](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.threadstate)
|
| 48 |
+
|
| 49 |
+
In the public ClusterFK browser, the Windows specialist and Qwennifer Flash each completed a seat in the same room. The Windows specialist synthesized their answers and correctly explained that signaling an auto-reset event releases one waiting thread. The packed Flash runtime was tested end to end. The portable adapter was loaded onto the upstream Transformers architecture and its output-head update checked numerically. Full BF16 text generation remains untested. [Microsoft Learn Event Objects](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)
|
| 50 |
+
|
| 51 |
+
## Files and attribution
|
| 52 |
+
|
| 53 |
+
The safetensors file contains the adapter. `windows.sqlite`, the pinned Markdown, and `build_data.py` support offline lookup and rebuilding the examples. `runtime/serve_windows.py` uses the Belikewater Flash HTTP server for authenticated streaming. `training/` contains the capture and fit entry points for GPUless. See `NOTICE.md` for source attribution and the licenses of the weights, training data, reference content and software.
|
TRAINING.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Reproducing the Windows adapter
|
| 2 |
+
|
| 3 |
+
Run `python build_data.py` in the release directory. It uses the bundled, pinned sources and writes `data/examples.jsonl`, the train/eval subsets, and `windows.sqlite`. The data can also be used independently of GPUless. The paired examples contain the full text shown to the model in `prompt` and the desired continuation in `answer`. Training includes the end token after each answer.
|
| 4 |
+
|
| 5 |
+
For the native run, use the Flash-capable Belikewater runtime with the matching prepared checkpoint, expert bank and hot-expert list. Set those paths in a local JSON settings file under `inputs`, `flat_cache` and `hot_experts_file`. The served capture uses `map_flat_cache: true` and `capture_cache_slots: 2048`. Launch:
|
| 6 |
+
|
| 7 |
+
```sh
|
| 8 |
+
python training/capture.py settings.json data/examples.jsonl features
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
On the GPUless host, point `GPULESS_ROOT` at the checkout containing the native C libraries, Python bridge, PEFT exporter and compact training-space code:
|
| 12 |
+
|
| 13 |
+
```sh
|
| 14 |
+
export PYTHONPATH="$GPULESS_ROOT/src:$GPULESS_ROOT/labs/knowledge_strategies"
|
| 15 |
+
export GPULESS_NATIVE_LIB="$GPULESS_ROOT/build/lib/libgpuless.so"
|
| 16 |
+
export GPULESS_PTPU_LIB="$GPULESS_ROOT/build/lib/libptpu_lora.so"
|
| 17 |
+
OPENBLAS_NUM_THREADS=2 OMP_NUM_THREADS=2 MKL_NUM_THREADS=2 CUDA_VISIBLE_DEVICES="" \
|
| 18 |
+
"$GPULESS_ROOT/venv/bin/python" training/fit.py features data/examples.jsonl fit
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
The GPU phase captures frozen activations and logits. GPUless's CPU-native MeZO optimizer trains the compact adapter matrices, then expands them into the normal PEFT tensor shapes. The portable adapter config identifies the upstream Hugging Face base. Its companion GPUless provenance records the exact native packed base fingerprint for GPUless/Flash reload.
|
adapter_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"peft_type": "LORA",
|
| 3 |
+
"task_type": "CAUSAL_LM",
|
| 4 |
+
"inference_mode": true,
|
| 5 |
+
"base_model_name_or_path": "Qwen/Qwen3-Coder-Next",
|
| 6 |
+
"revision": "a7fbcb5c0e12d62a448eaa0e260346bf5dcc0feb",
|
| 7 |
+
"r": 4,
|
| 8 |
+
"lora_alpha": 4.0,
|
| 9 |
+
"lora_dropout": 0.0,
|
| 10 |
+
"bias": "none",
|
| 11 |
+
"fan_in_fan_out": false,
|
| 12 |
+
"use_rslora": false,
|
| 13 |
+
"use_dora": false,
|
| 14 |
+
"target_modules": [
|
| 15 |
+
"lm_head"
|
| 16 |
+
],
|
| 17 |
+
"rank_pattern": {},
|
| 18 |
+
"alpha_pattern": {}
|
| 19 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f161a35e82e3edf364e69736e673334de469eaa4fd9a0e1cc8b4ccfefa16955
|
| 3 |
+
size 2463992
|
ask_transformers.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Run the released adapter with the public Transformers base and local Windows references."""
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
import torch
|
| 7 |
+
from peft import PeftModel
|
| 8 |
+
from runtime.reference import evidence_prompt, retrieve
|
| 9 |
+
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
|
| 10 |
+
|
| 11 |
+
BASE = "Qwen/Qwen3-Coder-Next"
|
| 12 |
+
REVISION = "a7fbcb5c0e12d62a448eaa0e260346bf5dcc0feb"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@torch.inference_mode()
|
| 16 |
+
def ask(root, question, maximum):
|
| 17 |
+
config = AutoConfig.from_pretrained(BASE, revision=REVISION)
|
| 18 |
+
config.num_experts_per_tok = 6
|
| 19 |
+
tokenizer = AutoTokenizer.from_pretrained(BASE, revision=REVISION)
|
| 20 |
+
base = AutoModelForCausalLM.from_pretrained(
|
| 21 |
+
BASE, revision=REVISION, config=config, dtype=torch.bfloat16, device_map="auto"
|
| 22 |
+
)
|
| 23 |
+
model = PeftModel.from_pretrained(base, str(root)).eval()
|
| 24 |
+
hits = retrieve(root / "windows.sqlite", question)
|
| 25 |
+
conversation = [{"role": "user", "content": evidence_prompt(question, hits)}]
|
| 26 |
+
prompt = tokenizer.apply_chat_template(
|
| 27 |
+
conversation, tokenize=False, add_generation_prompt=True
|
| 28 |
+
)
|
| 29 |
+
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(
|
| 30 |
+
base.get_input_embeddings().weight.device
|
| 31 |
+
)
|
| 32 |
+
ids = model.generate(**inputs, max_new_tokens=maximum, do_sample=False)
|
| 33 |
+
print(
|
| 34 |
+
tokenizer.decode(ids[0, inputs.input_ids.shape[1] :], skip_special_tokens=True)
|
| 35 |
+
)
|
| 36 |
+
print("Retrieved:", ", ".join(h["url"] for h in hits))
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
if __name__ == "__main__":
|
| 40 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 41 |
+
parser.add_argument("question")
|
| 42 |
+
parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parent)
|
| 43 |
+
parser.add_argument("--max-tokens", type=int, default=160)
|
| 44 |
+
args = parser.parse_args()
|
| 45 |
+
ask(args.root, args.question, args.max_tokens)
|
build_data.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Build the downloadable Windows reference index and exact GPUless examples."""
|
| 2 |
+
|
| 3 |
+
import csv
|
| 4 |
+
import hashlib
|
| 5 |
+
import json
|
| 6 |
+
import re
|
| 7 |
+
import sqlite3
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
|
| 10 |
+
from runtime.reference import evidence_prompt, retrieve
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def sections(raw):
|
| 14 |
+
text = raw.split("\n---\n", 1)[-1]
|
| 15 |
+
text = re.sub(r"```.*?```", "", text, flags=re.S)
|
| 16 |
+
text = re.sub(r"!\[[^\]]*\]\([^)]*\)", "", text)
|
| 17 |
+
text = re.sub(r"\[([^\]]+)\]\([^)]*\)", r"\1", text)
|
| 18 |
+
text = text.replace("**", "").replace("\xa0", " ")
|
| 19 |
+
title = re.search(r"^# (.+)", text, re.M)[1].strip()
|
| 20 |
+
pending = []
|
| 21 |
+
for block in re.split(r"\n\s*\n", text):
|
| 22 |
+
block = " ".join(block.split()).strip()
|
| 23 |
+
if not block or block.startswith(("#", "<", "[!")):
|
| 24 |
+
continue
|
| 25 |
+
# Windows docs have long list and table paragraphs. Keep words intact.
|
| 26 |
+
words = block.split()
|
| 27 |
+
while words:
|
| 28 |
+
take = min(125 - len(pending), len(words))
|
| 29 |
+
pending += words[:take]
|
| 30 |
+
words = words[take:]
|
| 31 |
+
if len(pending) == 125:
|
| 32 |
+
yield title, " ".join(pending)
|
| 33 |
+
pending = []
|
| 34 |
+
if len(pending) >= 65:
|
| 35 |
+
yield title, " ".join(pending)
|
| 36 |
+
pending = []
|
| 37 |
+
if pending:
|
| 38 |
+
yield title, " ".join(pending)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def build(root):
|
| 42 |
+
sources = json.loads((root / "sources.json").read_text())
|
| 43 |
+
path = root / "windows.sqlite"
|
| 44 |
+
temp = path.with_suffix(".new")
|
| 45 |
+
if temp.exists():
|
| 46 |
+
raise FileExistsError(temp)
|
| 47 |
+
with sqlite3.connect(temp) as db:
|
| 48 |
+
db.execute(
|
| 49 |
+
"CREATE VIRTUAL TABLE passages USING fts5(title,body,url UNINDEXED,source UNINDEXED,tokenize='porter unicode61')"
|
| 50 |
+
)
|
| 51 |
+
for doc in sources:
|
| 52 |
+
db.executemany(
|
| 53 |
+
"INSERT INTO passages VALUES(?,?,?,?)",
|
| 54 |
+
(
|
| 55 |
+
(t, b, doc["url"], doc["id"])
|
| 56 |
+
for t, b in sections((root / doc["file"]).read_text())
|
| 57 |
+
),
|
| 58 |
+
)
|
| 59 |
+
db.commit()
|
| 60 |
+
db.close()
|
| 61 |
+
temp.replace(path)
|
| 62 |
+
records = []
|
| 63 |
+
with (root / "data/questions.tsv").open() as stream:
|
| 64 |
+
questions = list(csv.DictReader(stream, delimiter="\t"))
|
| 65 |
+
train_sources = {r["source"] for r in questions if r["split"] == "train"}
|
| 66 |
+
for row in questions:
|
| 67 |
+
q = row["question"]
|
| 68 |
+
for condition in ("closed", "rag"):
|
| 69 |
+
hits = retrieve(path, q) if condition == "rag" else []
|
| 70 |
+
gold = row["source"]
|
| 71 |
+
# Training retrieval uses training references only. The released index
|
| 72 |
+
# covers the full reference collection, including held-out sources.
|
| 73 |
+
if row["split"] == "train" and condition == "rag":
|
| 74 |
+
hits = [h for h in hits if h["id"] in train_sources]
|
| 75 |
+
target = row["answer"]
|
| 76 |
+
if condition == "rag":
|
| 77 |
+
match = next((h for h in hits if h["id"] == gold), None)
|
| 78 |
+
if match:
|
| 79 |
+
target += f" [{match['title']}]({match['url']})"
|
| 80 |
+
elif row["split"] == "train":
|
| 81 |
+
target = (
|
| 82 |
+
"The retrieved references do not establish that. I need a source on "
|
| 83 |
+
+ gold.replace("-", " ")
|
| 84 |
+
+ "."
|
| 85 |
+
)
|
| 86 |
+
records.append(
|
| 87 |
+
{
|
| 88 |
+
"id": hashlib.sha256(q.encode()).hexdigest()[:16],
|
| 89 |
+
"split": row["split"],
|
| 90 |
+
"passage": gold,
|
| 91 |
+
"condition": condition,
|
| 92 |
+
"question": q,
|
| 93 |
+
"answer": target,
|
| 94 |
+
"prompt": evidence_prompt(q, hits)
|
| 95 |
+
if condition == "rag"
|
| 96 |
+
else "Answer the Windows question concisely.\nQuestion: " + q,
|
| 97 |
+
"retrieved": [h["id"] for h in hits],
|
| 98 |
+
}
|
| 99 |
+
)
|
| 100 |
+
for name, rows in [
|
| 101 |
+
("examples", records),
|
| 102 |
+
("train", [r for r in records if r["split"] == "train"]),
|
| 103 |
+
("eval", [r for r in records if r["split"] == "test"]),
|
| 104 |
+
]:
|
| 105 |
+
(root / "data" / (name + ".jsonl")).write_text(
|
| 106 |
+
"".join(json.dumps(r, ensure_ascii=False) + "\n" for r in rows)
|
| 107 |
+
)
|
| 108 |
+
# Additional operator-written notes ship with the inference pack. They
|
| 109 |
+
# are added after freezing examples and cannot change a training prompt.
|
| 110 |
+
with sqlite3.connect(path) as db:
|
| 111 |
+
for card in json.loads((root / "data/additional-references.json").read_text()):
|
| 112 |
+
db.execute(
|
| 113 |
+
"INSERT INTO passages VALUES(?,?,?,?)",
|
| 114 |
+
(card["title"], card["body"], card["url"], card["id"]),
|
| 115 |
+
)
|
| 116 |
+
db.close()
|
| 117 |
+
print(len(sources), "sources;", len(records), "examples")
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
if __name__ == "__main__":
|
| 121 |
+
build(Path(__file__).resolve().parent)
|
data/additional-references.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{"id":"thread-standby-state","title":"Thread states and the standby thread per logical processor","url":"https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.threadstate","body":"A processor can have one thread selected to run next. Windows calls that thread standby. Several threads can be ready, waiting for CPU time, while at most one thread is on standby for a given logical processor. A thread reported as running is already executing. These state observations are for diagnostics, and are unsuitable for synchronizing application threads."},
|
| 3 |
+
{"id":"page-file-sizing","title":"Sizing a Windows paging file for commit and crash dumps","url":"https://learn.microsoft.com/en-us/troubleshoot/windows-client/performance/how-to-determine-the-appropriate-page-file-size-for-64-bit-versions-of-windows","body":"Page file sizing depends on the workload’s peak system commit charge and the size required for the configured crash dump. A fixed multiple of installed memory cannot capture both requirements for every computer. Check the dump policy and observe peak commit under representative load before choosing a manual size."}
|
| 4 |
+
]
|
data/eval.jsonl
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"id": "d497b19680efa90f", "split": "test", "passage": "event-objects", "condition": "closed", "question": "What happens to a manual-reset event after it releases a waiter?", "answer": "It stays signaled until explicitly reset, allowing other waiting threads to proceed.", "prompt": "Answer the Windows question concisely.\nQuestion: What happens to a manual-reset event after it releases a waiter?", "retrieved": []}
|
| 2 |
+
{"id": "d497b19680efa90f", "split": "test", "passage": "event-objects", "condition": "rag", "question": "What happens to a manual-reset event after it releases a waiter?", "answer": "It stays signaled until explicitly reset, allowing other waiting threads to proceed. [Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)\nAn *event object* is a synchronization object whose state can be explicitly set to signaled by use of the SetEvent function. Following are the two types of event object. | Object | Description | |--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Manual-reset event | An event object whose state remains signaled until it is explicitly reset to nonsignaled by the ResetEvent function. While it is signaled, any number of waiting threads, or threads that subsequently specify the same event object in one of the wait functions, can be released. | | Auto-reset event | An event object whose state remains signaled until a single waiting thread is released, at which time the system automatically sets the state to nonsignaled. If no threads are waiting, the event object's state remains signaled.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nEvery other standard driver routine executes in an arbitrary thread context: that of whatever thread happens to be current when the driver routine is called to process a queued operation or to handle a device interrupt. Moreover, most standard driver routines are run at a raised IRQL, either at DISPATCH_LEVEL, or for device drivers, at DIRQL. If necessary, a driver can create a device-dedicated thread, which can wait for the driver's other routines (except an ISR or *SynchCritSection* routine) to set a dispatcher object to the Signaled state and reset to the Not-Signaled state.\n\nQuestion: What happens to a manual-reset event after it releases a waiter?", "retrieved": ["event-objects", "introduction-to-kernel-dispatcher-objects"]}
|
| 3 |
+
{"id": "28d7a921a876ccfd", "split": "test", "passage": "event-objects", "condition": "closed", "question": "No thread was waiting when an auto-reset event was signaled. Does a later waiter see it?", "answer": "Yes. It stays signaled until it releases a waiting thread, then resets automatically.", "prompt": "Answer the Windows question concisely.\nQuestion: No thread was waiting when an auto-reset event was signaled. Does a later waiter see it?", "retrieved": []}
|
| 4 |
+
{"id": "28d7a921a876ccfd", "split": "test", "passage": "event-objects", "condition": "rag", "question": "No thread was waiting when an auto-reset event was signaled. Does a later waiter see it?", "answer": "Yes. It stays signaled until it releases a waiting thread, then resets automatically. [Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)\nAn *event object* is a synchronization object whose state can be explicitly set to signaled by use of the SetEvent function. Following are the two types of event object. | Object | Description | |--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Manual-reset event | An event object whose state remains signaled until it is explicitly reset to nonsignaled by the ResetEvent function. While it is signaled, any number of waiting threads, or threads that subsequently specify the same event object in one of the wait functions, can be released. | | Auto-reset event | An event object whose state remains signaled until a single waiting thread is released, at which time the system automatically sets the state to nonsignaled. If no threads are waiting, the event object's state remains signaled.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nWhenever a dispatcher object is set to the Signaled state, the kernel changes the state of any thread waiting for that object to *ready*. (Synchronization timers and synchronization events are exceptions to this rule; when a synchronization event or timer is signaled, only one waiting thread is set to the ready state. For more information, see Timer Objects and DPCs and Event Objects.) A thread in the ready state will be scheduled to run according to its current run-time thread priority and the current availability of processors for any thread with that priority.\n\nQuestion: No thread was waiting when an auto-reset event was signaled. Does a later waiter see it?", "retrieved": ["event-objects", "introduction-to-kernel-dispatcher-objects"]}
|
| 5 |
+
{"id": "71fba3d72f092acc", "split": "test", "passage": "condition-variables", "condition": "closed", "question": "Why should a Windows condition-variable wait recheck its predicate after waking?", "answer": "Spurious and stolen wakeups are possible. After reacquiring the lock, retest the predicate in a loop.", "prompt": "Answer the Windows question concisely.\nQuestion: Why should a Windows condition-variable wait recheck its predicate after waking?", "retrieved": []}
|
| 6 |
+
{"id": "71fba3d72f092acc", "split": "test", "passage": "condition-variables", "condition": "rag", "question": "Why should a Windows condition-variable wait recheck its predicate after waking?", "answer": "Spurious and stolen wakeups are possible. After reacquiring the lock, retest the predicate in a loop. [Condition Variables](https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Condition Variables](https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables)\nWakes a single thread waiting on the specified condition variable. | The following pseudocode demonstrates the typical usage pattern of condition variables. For example, in an implementation of a reader/writer lock, the `TestPredicate` function would verify that the current lock request is compatible with the existing owners. If it is, acquire the lock; otherwise, sleep. For a more detailed example, see Using Condition Variables. Condition variables are subject to spurious wakeups (those not associated with an explicit wake) and stolen wakeups (another thread manages to run before the woken thread). Therefore, you should recheck a predicate (typically in a while loop) after a sleep operation returns.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nIf more than one thread is waiting on a mutex, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order. After a thread obtains ownership of a mutex, it can specify the same mutex in repeated calls to the wait-functions without blocking its execution. This prevents a thread from deadlocking itself while waiting for a mutex that it already owns. To release its ownership under such circumstances, the thread must call ReleaseMutex once for each time that the mutex satisfied the conditions of a wait function.\n\nQuestion: Why should a Windows condition-variable wait recheck its predicate after waking?", "retrieved": ["condition-variables", "mutex-objects"]}
|
| 7 |
+
{"id": "8d0cd1227652f084", "split": "test", "passage": "condition-variables", "condition": "closed", "question": "Which condition-variable operation wakes every waiting thread?", "answer": "WakeAllConditionVariable wakes all waiters on that condition variable. Each must still reacquire the lock and check its predicate.", "prompt": "Answer the Windows question concisely.\nQuestion: Which condition-variable operation wakes every waiting thread?", "retrieved": []}
|
| 8 |
+
{"id": "8d0cd1227652f084", "split": "test", "passage": "condition-variables", "condition": "rag", "question": "Which condition-variable operation wakes every waiting thread?", "answer": "WakeAllConditionVariable wakes all waiters on that condition variable. Each must still reacquire the lock and check its predicate. [Condition Variables](https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Condition Variables](https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables)\nCondition variables are synchronization primitives that enable threads to wait until a particular condition occurs. Condition variables are user-mode objects that cannot be shared across processes. Condition variables enable threads to atomically release a lock and enter the sleeping state. They can be used with critical sections or slim reader/writer (SRW) locks. Condition variables support operations that \"wake one\" or \"wake all\" waiting threads. After a thread is woken, it re-acquires the lock it released when the thread entered the sleeping state.\n\n[I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)\nThe I/O completion port handle and every file handle associated with that particular I/O completion port are known as *references to the I/O completion port*. The I/O completion port is released when there are no more references to it. Therefore, all of these handles must be properly closed to release the I/O completion port and its associated system resources. After these conditions are satisfied, an application should close the I/O completion port handle by calling the CloseHandle function.\n\nQuestion: Which condition-variable operation wakes every waiting thread?", "retrieved": ["condition-variables", "i-o-completion-ports"]}
|
| 9 |
+
{"id": "10a12e19289b92e2", "split": "test", "passage": "i-o-completion-ports", "condition": "closed", "question": "How do the queue orders for completion packets and waiting completion-port threads differ?", "answer": "Packets are queued first-in, first-out. Threads blocked on the port are released in last-in, first-out order subject to the concurrency limit.", "prompt": "Answer the Windows question concisely.\nQuestion: How do the queue orders for completion packets and waiting completion-port threads differ?", "retrieved": []}
|
| 10 |
+
{"id": "10a12e19289b92e2", "split": "test", "passage": "i-o-completion-ports", "condition": "rag", "question": "How do the queue orders for completion packets and waiting completion-port threads differ?", "answer": "Packets are queued first-in, first-out. Threads blocked on the port are released in last-in, first-out order subject to the concurrency limit. [I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)\nThe CreateIoCompletionPort function creates an I/O completion port and associates one or more file handles with that port. When an asynchronous I/O operation on one of these file handles completes, an I/O completion packet is queued in first-in-first-out (FIFO) order to the associated I/O completion port. One powerful use for this mechanism is to combine the synchronization point for multiple file handles into a single object, although there are also other useful applications. Please note that while the packets are queued in FIFO order they may be dequeued in a different order.\n\n[Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)\nIf more than one thread is waiting, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order.<br/> | The event object is useful in sending a signal to a thread indicating that a particular event has occurred. For example, in overlapped input and output, the system sets a specified event object to the signaled state when the overlapped operation has been completed. A single thread can specify different event objects in several simultaneous overlapped operations, then use one of the multiple-object wait functions to wait for the state of any one of the event objects to be signaled.\n\nQuestion: How do the queue orders for completion packets and waiting completion-port threads differ?", "retrieved": ["i-o-completion-ports", "event-objects"]}
|
| 11 |
+
{"id": "33a8e51629783b38", "split": "test", "passage": "i-o-completion-ports", "condition": "closed", "question": "What does the concurrency value on an I/O completion port control?", "answer": "It limits the number of runnable threads associated with the port, allowing other waiting workers to remain blocked.", "prompt": "Answer the Windows question concisely.\nQuestion: What does the concurrency value on an I/O completion port control?", "retrieved": []}
|
| 12 |
+
{"id": "33a8e51629783b38", "split": "test", "passage": "i-o-completion-ports", "condition": "rag", "question": "What does the concurrency value on an I/O completion port control?", "answer": "It limits the number of runnable threads associated with the port, allowing other waiting workers to remain blocked. [I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)\n> [!NOTE] > An I/O completion port is associated with the process that created it and is not sharable between processes. However, a single handle is sharable between threads in the same process. The most important property of an I/O completion port to consider carefully is the concurrency value. The concurrency value of a completion port is specified when it is created with CreateIoCompletionPort via the *NumberOfConcurrentThreads* parameter. This value limits the number of runnable threads associated with the completion port. When the total number of runnable threads associated with the completion port reaches the concurrency value, the system blocks the execution of any subsequent threads associated with that completion port until the number of runnable threads drops below the concurrency value.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\n- Driver dispatch routines servicing read/write requests generally cannot wait for a dispatcher object to be set to the Signaled state. - A dispatch routine for a device I/O control request can wait for a dispatcher object to be set to the Signaled state only if the transfer type for the I/O control code is METHOD_BUFFERED. - SCSI miniport drivers should not use kernel dispatcher objects. SCSI miniport drivers should call only SCSI Port Driver Support Routines.\n\nQuestion: What does the concurrency value on an I/O completion port control?", "retrieved": ["i-o-completion-ports", "introduction-to-kernel-dispatcher-objects"]}
|
| 13 |
+
{"id": "39c7787f32b15d1e", "split": "test", "passage": "canceling-irps", "condition": "closed", "question": "What kernel routine begins cancellation of an I/O request packet?", "answer": "IoCancelIrp initiates cancellation. The cancellation path must complete the request while maintaining system integrity.", "prompt": "Answer the Windows question concisely.\nQuestion: What kernel routine begins cancellation of an I/O request packet?", "retrieved": []}
|
| 14 |
+
{"id": "39c7787f32b15d1e", "split": "test", "passage": "canceling-irps", "condition": "rag", "question": "What kernel routine begins cancellation of an I/O request packet?", "answer": "IoCancelIrp initiates cancellation. The cancellation path must complete the request while maintaining system integrity. [Canceling IRPs](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Canceling IRPs](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps)\nTo \"cancel an IRP\" means to complete the IRP as quickly as possible while still maintaining system integrity. For a general discussion of IRP completion, see Completing IRPs. The cancellation process begins when either the system or a driver calls IoCancelIrp. This routine is called for each IRP that is associated with the thread that has not yet fully completed. The system cancels unprocessed IRPs if the thread that initiated the I/O request exits. Drivers can cancel only IRPs that they have created (see Creating IRPs for Lower-Level Drivers.)\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\ncommon file handle. To cancel all pending asynchronous I/O operations, use either: - CancelIo: This function only cancels operations issued by the calling thread for the specified file handle. - CancelIoEx: This function cancels all operations issued by the threads for the specified file handle. Use CancelSynchronousIo to cancel pending synchronous I/O operations. The ReadFileEx and WriteFileEx functions enable an application to specify a routine to execute (see FileIOCompletionRoutine) when the asynchronous I/O request is completed.\n\nQuestion: What kernel routine begins cancellation of an I/O request packet?", "retrieved": ["canceling-irps", "synchronous-and-asynchronous-i-o"]}
|
| 15 |
+
{"id": "52f1f9c35c67a5c0", "split": "test", "passage": "canceling-irps", "condition": "closed", "question": "Is there a Windows facility for drivers that need a queue of cancelable IRPs?", "answer": "Yes. A cancel-safe IRP queue provides cancellation support for drivers that queue requests.", "prompt": "Answer the Windows question concisely.\nQuestion: Is there a Windows facility for drivers that need a queue of cancelable IRPs?", "retrieved": []}
|
| 16 |
+
{"id": "52f1f9c35c67a5c0", "split": "test", "passage": "canceling-irps", "condition": "rag", "question": "Is there a Windows facility for drivers that need a queue of cancelable IRPs?", "answer": "Yes. A cancel-safe IRP queue provides cancellation support for drivers that queue requests. [Canceling IRPs](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Canceling IRPs](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps)\nDrivers in which IRPs might remain queued for an indefinite interval (so a user could cancel a previously submitted I/O request) must have one or more *Cancel* routines to complete user-canceled I/O requests. For example, keyboard, mouse, parallel, serial, and sound device drivers (or drivers layered over them) and file system drivers should have *Cancel* routines. Drivers for Microsoft Windows XP and later operating systems can use cancel-safe IRP queues rather than implement their own *Cancel* routines.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nAs a general guideline, if you expect that your new device driver will often need to stall for longer than 50 microseconds while it waits for device-state changes during I/O operations, consider implementing a driver with a device-dedicated thread. If the device driver is also a highest-level driver, consider using system worker threads and implementing one or more worker-thread callback routines. See PsCreateSystemThread and Managing Interlocked Queues with a Driver-Created Thread.\n\nQuestion: Is there a Windows facility for drivers that need a queue of cancelable IRPs?", "retrieved": ["canceling-irps", "introduction-to-kernel-dispatcher-objects"]}
|
data/examples.jsonl
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"id": "26727884ca7fc53a", "split": "train", "passage": "context-switches", "condition": "closed", "question": "Why did a thread give up the CPU before its time slice ran out?", "answer": "A running thread that starts waiting gives up the rest of its time slice. A newly ready higher-priority thread can also trigger a switch.", "prompt": "Answer the Windows question concisely.\nQuestion: Why did a thread give up the CPU before its time slice ran out?", "retrieved": []}
|
| 2 |
+
{"id": "26727884ca7fc53a", "split": "train", "passage": "context-switches", "condition": "rag", "question": "Why did a thread give up the CPU before its time slice ran out?", "answer": "A running thread that starts waiting gives up the rest of its time slice. A newly ready higher-priority thread can also trigger a switch. [Context Switches](https://learn.microsoft.com/en-us/windows/win32/procthread/context-switches)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Context Switches](https://learn.microsoft.com/en-us/windows/win32/procthread/context-switches)\n- The time slice has elapsed. - A thread with a higher priority has become ready to run. - A running thread needs to wait. When a running thread needs to wait, it relinquishes the remainder of its time slice.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nA thread can decrement a semaphore's count more than once by repeatedly specifying the same semaphore object in calls to any of the wait functions. However, calling one of the multiple-object wait functions with an array that contains multiple handles of the same semaphore does not result in multiple decrements. When you have finished using the semaphore object, call the CloseHandle function to close the handle. The semaphore object is destroyed when its last handle has been closed. Closing the handle does not affect the semaphore count; therefore, be sure to call ReleaseSemaphore before closing the handle or before the process terminates. Otherwise, pending wait operations will either time out or continue indefinitely, depending on whether a time-out value has been specified.\n\nQuestion: Why did a thread give up the CPU before its time slice ran out?", "retrieved": ["context-switches", "semaphore-objects"]}
|
| 3 |
+
{"id": "135713966a6f127b", "split": "train", "passage": "context-switches", "condition": "closed", "question": "Will raising the priority of a blocked thread give it CPU time right away?", "answer": "The scheduler can run the thread once it becomes ready. Raising its priority alone leaves the wait in place.", "prompt": "Answer the Windows question concisely.\nQuestion: Will raising the priority of a blocked thread give it CPU time right away?", "retrieved": []}
|
| 4 |
+
{"id": "135713966a6f127b", "split": "train", "passage": "context-switches", "condition": "rag", "question": "Will raising the priority of a blocked thread give it CPU time right away?", "answer": "The retrieved references do not establish that. I need a source on context switches.", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nProcesses that monitor the system, such as screen savers or applications that periodically update a display, should use IDLE\\_PRIORITY\\_CLASS. This prevents the threads of this process, which do not have high priority, from interfering with higher priority threads. Use HIGH\\_PRIORITY\\_CLASS with care. If a thread runs at the highest priority level for extended periods, other threads in the system will not get processor time. If several threads are set at high priority at the same time, the threads lose their effectiveness. The high-priority class should be reserved for threads that must respond to time-critical events. If your application performs one task that requires the high-priority class while the rest of its tasks are normal priority, use SetPriorityClass to raise the priority class of the application\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\na notification when they are exceeded but allow the job to continue to run. To set limits for a job, use the SetInformationJobObject function. For a list of possible limits that can be set for a job, see the following topics: - JOBOBJECT\\_BASIC\\_LIMIT\\_INFORMATION - JOBOBJECT\\_BASIC\\_UI\\_RESTRICTIONS - JOBOBJECT\\_CPU\\_RATE\\_CONTROL\\_INFORMATION - JOBOBJECT\\_EXTENDED\\_LIMIT\\_INFORMATION - JOBOBJECT\\_NOTIFICATION\\_LIMIT\\_INFORMATION Security limits must be set individually for each process associated with a job object. For more information, see Process Security and Access Rights.\n\nQuestion: Will raising the priority of a blocked thread give it CPU time right away?", "retrieved": ["scheduling-priorities", "job-objects"]}
|
| 5 |
+
{"id": "a46efb9bef14e278", "split": "train", "passage": "thread-local-storage", "condition": "closed", "question": "Can two threads use the same TLS index and still see different data?", "answer": "Yes. The index selects a separate slot in each thread, so each thread can store its own value.", "prompt": "Answer the Windows question concisely.\nQuestion: Can two threads use the same TLS index and still see different data?", "retrieved": []}
|
| 6 |
+
{"id": "a46efb9bef14e278", "split": "train", "passage": "thread-local-storage", "condition": "rag", "question": "Can two threads use the same TLS index and still see different data?", "answer": "Yes. The index selects a separate slot in each thread, so each thread can store its own value. [Thread Local Storage](https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Thread Local Storage](https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage)\nto allocate separate storage, consolidate the data, and minimize the number of TLS slots in use. The following diagram illustrates how TLS works. For a code example illustrating the use of thread local storage, see Using Thread Local Storage. The process has two threads, Thread 1 and Thread 2. It allocates two indexes for use with TLS, gdwTlsIndex1 and gdwTlsIndex2. Each thread allocates two memory blocks (one for each index) in which to store the data, and stores the pointers to these memory blocks in the corresponding TLS slots. To access the data associated with an index, the thread retrieves the pointer to the memory block from the TLS slot and stores it in the lpvData local variable.\n\nQuestion: Can two threads use the same TLS index and still see different data?", "retrieved": ["thread-local-storage"]}
|
| 7 |
+
{"id": "ee4857c32a20fd9a", "split": "train", "passage": "thread-local-storage", "condition": "closed", "question": "Do worker threads need a distinct TLS index apiece for the same per-thread field?", "answer": "One allocated index can identify the field across the process. Each thread accesses its own slot at that index.", "prompt": "Answer the Windows question concisely.\nQuestion: Do worker threads need a distinct TLS index apiece for the same per-thread field?", "retrieved": []}
|
| 8 |
+
{"id": "ee4857c32a20fd9a", "split": "train", "passage": "thread-local-storage", "condition": "rag", "question": "Do worker threads need a distinct TLS index apiece for the same per-thread field?", "answer": "One allocated index can identify the field across the process. Each thread accesses its own slot at that index. [Thread Local Storage](https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Thread Local Storage](https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage)\nThe constant TLS\\_MINIMUM\\_AVAILABLE defines the minimum number of TLS indexes available in each process. This minimum is guaranteed to be at least 64 for all systems. The maximum number of indexes per process is 1,088. When the threads are created, the system allocates an array of LPVOID values for TLS, which are initialized to NULL. Before an index can be used, it must be allocated by one of the threads. Each thread stores its data for a TLS index in a *TLS slot* in the array. If the data associated with an index will fit in an LPVOID value, you can store the data directly in the TLS slot. However, if you are using a large number of indexes in this way, it is better\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nAs a general guideline, if you expect that your new device driver will often need to stall for longer than 50 microseconds while it waits for device-state changes during I/O operations, consider implementing a driver with a device-dedicated thread. If the device driver is also a highest-level driver, consider using system worker threads and implementing one or more worker-thread callback routines. See PsCreateSystemThread and Managing Interlocked Queues with a Driver-Created Thread.\n\nQuestion: Do worker threads need a distinct TLS index apiece for the same per-thread field?", "retrieved": ["thread-local-storage", "introduction-to-kernel-dispatcher-objects"]}
|
| 9 |
+
{"id": "ac937ed63b06141e", "split": "train", "passage": "job-objects", "condition": "closed", "question": "What Windows object lets a supervisor apply resource limits to a group of processes?", "answer": "A job object groups processes so the supervisor can set limits and collect accounting information for the group.", "prompt": "Answer the Windows question concisely.\nQuestion: What Windows object lets a supervisor apply resource limits to a group of processes?", "retrieved": []}
|
| 10 |
+
{"id": "ac937ed63b06141e", "split": "train", "passage": "job-objects", "condition": "rag", "question": "What Windows object lets a supervisor apply resource limits to a group of processes?", "answer": "A job object groups processes so the supervisor can set limits and collect accounting information for the group. [Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\nA *job object* allows groups of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of the processes associated with them. Operations performed on a job object affect all processes associated with the job object. Examples include enforcing limits such as working set size and process priority or terminating all processes associated with a job. - Creating Jobs - Managing Processes in Jobs - Job Limits and Notifications - Resource Accounting for Jobs - Managing Job Objects - Managing a Process Tree that Uses Job Objects\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nThe semaphore object is useful in controlling a shared resource that can support a limited number of users. It acts as a gate that limits the number of threads sharing the resource to a specified maximum number. For example, an application might place a limit on the number of windows that it creates. It uses a semaphore with a maximum count equal to the window limit, decrementing the count whenever a window is created and incrementing it whenever a window is closed. The application specifies the semaphore object in call to one of the wait functions before each window is created. When the count is zero—indicating that the window limit has been reached—the wait function blocks execution of the window-creation code.\n\nQuestion: What Windows object lets a supervisor apply resource limits to a group of processes?", "retrieved": ["job-objects", "semaphore-objects"]}
|
| 11 |
+
{"id": "83bf2317b18d0b4b", "split": "train", "passage": "job-objects", "condition": "closed", "question": "How could a supervisor collect accounting for several related processes as a unit?", "answer": "Associate those processes with a job object and query the job's accounting information.", "prompt": "Answer the Windows question concisely.\nQuestion: How could a supervisor collect accounting for several related processes as a unit?", "retrieved": []}
|
| 12 |
+
{"id": "83bf2317b18d0b4b", "split": "train", "passage": "job-objects", "condition": "rag", "question": "How could a supervisor collect accounting for several related processes as a unit?", "answer": "Associate those processes with a job object and query the job's accounting information. [Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\nA *job object* allows groups of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of the processes associated with them. Operations performed on a job object affect all processes associated with the job object. Examples include enforcing limits such as working set size and process priority or terminating all processes associated with a job. - Creating Jobs - Managing Processes in Jobs - Job Limits and Notifications - Resource Accounting for Jobs - Managing Job Objects - Managing a Process Tree that Uses Job Objects\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nThe system does not maintain the file pointer on asynchronous handles to files and devices that support file pointers (that is, seeking devices), therefore the file position must be passed to the read and write functions in the related offset data members of the OVERLAPPED structure. For more information, see WriteFile and ReadFile. File pointer position for a synchronous handle is maintained by the system as data is read or written and can also be updated using the SetFilePointer or SetFilePointerEx function.\n\nQuestion: How could a supervisor collect accounting for several related processes as a unit?", "retrieved": ["job-objects", "synchronous-and-asynchronous-i-o"]}
|
| 13 |
+
{"id": "99bc41280df74db4", "split": "train", "passage": "process-handles-and-identifiers", "condition": "closed", "question": "My program knows a PID. What must it obtain to use APIs that take a process handle?", "answer": "Call OpenProcess with the process ID and the access rights needed for the intended operation.", "prompt": "Answer the Windows question concisely.\nQuestion: My program knows a PID. What must it obtain to use APIs that take a process handle?", "retrieved": []}
|
| 14 |
+
{"id": "99bc41280df74db4", "split": "train", "passage": "process-handles-and-identifiers", "condition": "rag", "question": "My program knows a PID. What must it obtain to use APIs that take a process handle?", "answer": "Call OpenProcess with the process ID and the access rights needed for the intended operation. [Process Handles and Identifiers](https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Process Handles and Identifiers](https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers)\nThe CreateProcess function also returns an identifier that uniquely identifies the process throughout the system. A process can use the GetCurrentProcessId function to get its own process identifier (also known as the process ID or PID). The identifier is valid from the time the process is created until the process has been terminated. A process can use the Process32First function to obtain the process identifier of its parent process.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\navailable. Each process has a minimum and maximum working set size that affect the virtual memory paging behavior of the process. To obtain the current size of the working set of a specified process, use the GetProcessMemoryInfo function. To obtain or change the minimum and maximum working set sizes, use the GetProcessWorkingSetSizeEx and SetProcessWorkingSetSizeEx functions. The process status application programming interface (PSAPI) provides a number of functions that return detailed information about the working set of a process. For details, see Working Set Information.\n\nQuestion: My program knows a PID. What must it obtain to use APIs that take a process handle?", "retrieved": ["process-handles-and-identifiers", "working-set"]}
|
| 15 |
+
{"id": "6c18488e1da9bdc1", "split": "train", "passage": "process-handles-and-identifiers", "condition": "closed", "question": "Can I treat a PID as a permanent identifier after a process terminates?", "answer": "A process ID is unique during the process lifetime. A later process can receive a reused ID.", "prompt": "Answer the Windows question concisely.\nQuestion: Can I treat a PID as a permanent identifier after a process terminates?", "retrieved": []}
|
| 16 |
+
{"id": "6c18488e1da9bdc1", "split": "train", "passage": "process-handles-and-identifiers", "condition": "rag", "question": "Can I treat a PID as a permanent identifier after a process terminates?", "answer": "A process ID is unique during the process lifetime. A later process can receive a reused ID. [Process Handles and Identifiers](https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Process Handles and Identifiers](https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers)\nThe CreateProcess function also returns an identifier that uniquely identifies the process throughout the system. A process can use the GetCurrentProcessId function to get its own process identifier (also known as the process ID or PID). The identifier is valid from the time the process is created until the process has been terminated. A process can use the Process32First function to obtain the process identifier of its parent process.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nThreads are scheduled to run based on their *scheduling priority*. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.) The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread becomes available to run, the system\n\nQuestion: Can I treat a PID as a permanent identifier after a process terminates?", "retrieved": ["process-handles-and-identifiers", "scheduling-priorities"]}
|
| 17 |
+
{"id": "b4cfb7ea53001996", "split": "train", "passage": "scheduling-priorities", "condition": "closed", "question": "What two settings contribute to the Windows base priority of a thread?", "answer": "The process priority class and the thread's priority within that class determine its base priority.", "prompt": "Answer the Windows question concisely.\nQuestion: What two settings contribute to the Windows base priority of a thread?", "retrieved": []}
|
| 18 |
+
{"id": "b4cfb7ea53001996", "split": "train", "passage": "scheduling-priorities", "condition": "rag", "question": "What two settings contribute to the Windows base priority of a thread?", "answer": "The process priority class and the thread's priority within that class determine its base priority. [Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nThe following table shows the base priority for combinations of process priority class and thread priority value.\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\nIf the job is nested, the breakaway settings of parent jobs in the hierarchy affect whether child processes are associated with another job in the hierarchy. For more information, see Nested Jobs. To determine if a process is running in a job, use the IsProcessInJob function. To terminate all processes currently associated with a job object, use the TerminateJobObject function. A job can enforce limits such as working set size, process priority, and end-of-job time limit on each process that is associated with the job. If a process associated with a job attempts to increase its working set size or process priority from the limit established by the job, the function calls succeed but are silently ignored. A job can also set limits that trigger\n\nQuestion: What two settings contribute to the Windows base priority of a thread?", "retrieved": ["scheduling-priorities", "job-objects"]}
|
| 19 |
+
{"id": "65f43834d750ddfb", "split": "train", "passage": "scheduling-priorities", "condition": "closed", "question": "If several ready threads share the highest priority, how is their CPU time divided?", "answer": "The scheduler gives ready threads at that priority time slices in round-robin order.", "prompt": "Answer the Windows question concisely.\nQuestion: If several ready threads share the highest priority, how is their CPU time divided?", "retrieved": []}
|
| 20 |
+
{"id": "65f43834d750ddfb", "split": "train", "passage": "scheduling-priorities", "condition": "rag", "question": "If several ready threads share the highest priority, how is their CPU time divided?", "answer": "The scheduler gives ready threads at that priority time slices in round-robin order. [Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nThreads are scheduled to run based on their *scheduling priority*. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.) The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread becomes available to run, the system\n\n[Context Switches](https://learn.microsoft.com/en-us/windows/win32/procthread/context-switches)\nThe scheduler maintains separate queues of executable threads for each priority level. These threads are known as *ready threads*. When a processor becomes available, the system performs a *context switch*. The steps in a context switch are: 1. Save the context of the thread that was preempted or voluntarily yielded by the processor. 2. If the thread remains in a ready state, place it at the end of the queue for its priority level. 3. Find the highest priority queue that contains ready threads. 4. Remove the thread at the head of the queue, restore its context, and resume execution.\n\nQuestion: If several ready threads share the highest priority, how is their CPU time divided?", "retrieved": ["scheduling-priorities", "context-switches"]}
|
| 21 |
+
{"id": "d497b19680efa90f", "split": "test", "passage": "event-objects", "condition": "closed", "question": "What happens to a manual-reset event after it releases a waiter?", "answer": "It stays signaled until explicitly reset, allowing other waiting threads to proceed.", "prompt": "Answer the Windows question concisely.\nQuestion: What happens to a manual-reset event after it releases a waiter?", "retrieved": []}
|
| 22 |
+
{"id": "d497b19680efa90f", "split": "test", "passage": "event-objects", "condition": "rag", "question": "What happens to a manual-reset event after it releases a waiter?", "answer": "It stays signaled until explicitly reset, allowing other waiting threads to proceed. [Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)\nAn *event object* is a synchronization object whose state can be explicitly set to signaled by use of the SetEvent function. Following are the two types of event object. | Object | Description | |--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Manual-reset event | An event object whose state remains signaled until it is explicitly reset to nonsignaled by the ResetEvent function. While it is signaled, any number of waiting threads, or threads that subsequently specify the same event object in one of the wait functions, can be released. | | Auto-reset event | An event object whose state remains signaled until a single waiting thread is released, at which time the system automatically sets the state to nonsignaled. If no threads are waiting, the event object's state remains signaled.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nEvery other standard driver routine executes in an arbitrary thread context: that of whatever thread happens to be current when the driver routine is called to process a queued operation or to handle a device interrupt. Moreover, most standard driver routines are run at a raised IRQL, either at DISPATCH_LEVEL, or for device drivers, at DIRQL. If necessary, a driver can create a device-dedicated thread, which can wait for the driver's other routines (except an ISR or *SynchCritSection* routine) to set a dispatcher object to the Signaled state and reset to the Not-Signaled state.\n\nQuestion: What happens to a manual-reset event after it releases a waiter?", "retrieved": ["event-objects", "introduction-to-kernel-dispatcher-objects"]}
|
| 23 |
+
{"id": "28d7a921a876ccfd", "split": "test", "passage": "event-objects", "condition": "closed", "question": "No thread was waiting when an auto-reset event was signaled. Does a later waiter see it?", "answer": "Yes. It stays signaled until it releases a waiting thread, then resets automatically.", "prompt": "Answer the Windows question concisely.\nQuestion: No thread was waiting when an auto-reset event was signaled. Does a later waiter see it?", "retrieved": []}
|
| 24 |
+
{"id": "28d7a921a876ccfd", "split": "test", "passage": "event-objects", "condition": "rag", "question": "No thread was waiting when an auto-reset event was signaled. Does a later waiter see it?", "answer": "Yes. It stays signaled until it releases a waiting thread, then resets automatically. [Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)\nAn *event object* is a synchronization object whose state can be explicitly set to signaled by use of the SetEvent function. Following are the two types of event object. | Object | Description | |--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Manual-reset event | An event object whose state remains signaled until it is explicitly reset to nonsignaled by the ResetEvent function. While it is signaled, any number of waiting threads, or threads that subsequently specify the same event object in one of the wait functions, can be released. | | Auto-reset event | An event object whose state remains signaled until a single waiting thread is released, at which time the system automatically sets the state to nonsignaled. If no threads are waiting, the event object's state remains signaled.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nWhenever a dispatcher object is set to the Signaled state, the kernel changes the state of any thread waiting for that object to *ready*. (Synchronization timers and synchronization events are exceptions to this rule; when a synchronization event or timer is signaled, only one waiting thread is set to the ready state. For more information, see Timer Objects and DPCs and Event Objects.) A thread in the ready state will be scheduled to run according to its current run-time thread priority and the current availability of processors for any thread with that priority.\n\nQuestion: No thread was waiting when an auto-reset event was signaled. Does a later waiter see it?", "retrieved": ["event-objects", "introduction-to-kernel-dispatcher-objects"]}
|
| 25 |
+
{"id": "a3ba187f17e1c64b", "split": "train", "passage": "mutex-objects", "condition": "closed", "question": "The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me?", "answer": "The waiter acquired the mutex, but the prior owner exited without releasing it. Check the protected data for consistency.", "prompt": "Answer the Windows question concisely.\nQuestion: The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me?", "retrieved": []}
|
| 26 |
+
{"id": "a3ba187f17e1c64b", "split": "train", "passage": "mutex-objects", "condition": "rag", "question": "The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me?", "answer": "The waiter acquired the mutex, but the prior owner exited without releasing it. Check the protected data for consistency. [Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nIf a thread terminates without releasing its ownership of a mutex object, the mutex object is considered to be abandoned. A waiting thread can acquire ownership of an abandoned mutex object, but the wait function will return WAIT\\_ABANDONED to indicate that the mutex object is abandoned. An abandoned mutex object indicates that an error has occurred and that any shared resource being protected by the mutex object is in an undefined state. If the thread proceeds as though the mutex object had not been abandoned, it is no longer considered abandoned after the thread releases its ownership. This restores normal behavior if a handle to the mutex object is subsequently specified in a wait function.\n\n[Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)\nA *critical section object* provides synchronization similar to that provided by a mutex object, except that a critical section can be used only by the threads of a single process. Critical section objects cannot be shared across processes. Event, mutex, and semaphore objects can also be used in a single-process application, but critical section objects provide a slightly faster, more efficient mechanism for mutual-exclusion synchronization (a processor-specific test and set instruction). Like a mutex object, a critical section object can be owned by only one thread at a time, which makes it useful for protecting a shared resource from simultaneous access. Unlike a mutex object, there is no way to tell whether a critical section has been abandoned.\n\nQuestion: The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me?", "retrieved": ["mutex-objects", "critical-section-objects"]}
|
| 27 |
+
{"id": "bc2537f2d6d54575", "split": "train", "passage": "mutex-objects", "condition": "closed", "question": "May a thread acquire the same mutex twice?", "answer": "Yes. The owning thread can acquire it recursively and must release it once per successful acquisition.", "prompt": "Answer the Windows question concisely.\nQuestion: May a thread acquire the same mutex twice?", "retrieved": []}
|
| 28 |
+
{"id": "bc2537f2d6d54575", "split": "train", "passage": "mutex-objects", "condition": "rag", "question": "May a thread acquire the same mutex twice?", "answer": "Yes. The owning thread can acquire it recursively and must release it once per successful acquisition. [Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nIf a thread terminates without releasing its ownership of a mutex object, the mutex object is considered to be abandoned. A waiting thread can acquire ownership of an abandoned mutex object, but the wait function will return WAIT\\_ABANDONED to indicate that the mutex object is abandoned. An abandoned mutex object indicates that an error has occurred and that any shared resource being protected by the mutex object is in an undefined state. If the thread proceeds as though the mutex object had not been abandoned, it is no longer considered abandoned after the thread releases its ownership. This restores normal behavior if a handle to the mutex object is subsequently specified in a wait function.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nA thread that owns a mutex object can wait repeatedly for the same mutex object to become signaled without its execution becoming blocked. A thread that waits repeatedly for the same semaphore object, however, decrements the semaphore's count each time a wait operation is completed; the thread is blocked when the count gets to zero. Similarly, only the thread that owns a mutex can successfully call the ReleaseMutex function, though any thread can use ReleaseSemaphore to increase the count of a semaphore object.\n\nQuestion: May a thread acquire the same mutex twice?", "retrieved": ["mutex-objects", "semaphore-objects"]}
|
| 29 |
+
{"id": "adef7ffbc7186548", "split": "train", "passage": "semaphore-objects", "condition": "closed", "question": "Why did the semaphore become nonsignaled after the last available permit was taken?", "answer": "A successful wait decrements the count. At zero the semaphore is nonsignaled until a release increases the count.", "prompt": "Answer the Windows question concisely.\nQuestion: Why did the semaphore become nonsignaled after the last available permit was taken?", "retrieved": []}
|
| 30 |
+
{"id": "adef7ffbc7186548", "split": "train", "passage": "semaphore-objects", "condition": "rag", "question": "Why did the semaphore become nonsignaled after the last available permit was taken?", "answer": "A successful wait decrements the count. At zero the semaphore is nonsignaled until a release increases the count. [Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nA *semaphore object* is a synchronization object that maintains a count between zero and a specified maximum value. The count is decremented each time a thread completes a wait for the semaphore object and incremented each time a thread releases the semaphore. When the count reaches zero, no more threads can successfully wait for the semaphore object state to become signaled. The state of a semaphore is set to signaled when its count is greater than zero, and nonsignaled when its count is zero.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nIf several processes share a page, removing the page from the working set of one process does not affect other processes. After a page is removed from the working sets of all processes that were using it, the page becomes a *transition page*. Transition pages remain cached in RAM until the page is either referenced again by some process or repurposed (for example, filled with zeros and given to another process). If a transition page has been modified since it was last written to disk (that is, if the page is \"dirty\"), then the page must be written to its backing store before it can be repurposed. The system may start writing dirty transition pages to their backing store as soon as such pages become\n\nQuestion: Why did the semaphore become nonsignaled after the last available permit was taken?", "retrieved": ["semaphore-objects", "working-set"]}
|
| 31 |
+
{"id": "ab0c352f8d26d689", "split": "train", "passage": "semaphore-objects", "condition": "closed", "question": "Can I assume Windows semaphore waiters get permits in arrival order?", "answer": "No. Waiting threads are selected without a guaranteed first-in, first-out order.", "prompt": "Answer the Windows question concisely.\nQuestion: Can I assume Windows semaphore waiters get permits in arrival order?", "retrieved": []}
|
| 32 |
+
{"id": "ab0c352f8d26d689", "split": "train", "passage": "semaphore-objects", "condition": "rag", "question": "Can I assume Windows semaphore waiters get permits in arrival order?", "answer": "No. Waiting threads are selected without a guaranteed first-in, first-out order. [Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nIf more than one thread is waiting on a semaphore, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order. Each time one of the wait functions returns because the state of a semaphore was set to signaled, the count of the semaphore is decreased by one. The ReleaseSemaphore function increases a semaphore's count by a specified amount. The count can never be less than zero or greater than the maximum value.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nIf more than one thread is waiting on a mutex, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order. After a thread obtains ownership of a mutex, it can specify the same mutex in repeated calls to the wait-functions without blocking its execution. This prevents a thread from deadlocking itself while waiting for a mutex that it already owns. To release its ownership under such circumstances, the thread must call ReleaseMutex once for each time that the mutex satisfied the conditions of a wait function.\n\nQuestion: Can I assume Windows semaphore waiters get permits in arrival order?", "retrieved": ["semaphore-objects", "mutex-objects"]}
|
| 33 |
+
{"id": "07fab401e0635f69", "split": "train", "passage": "critical-section-objects", "condition": "closed", "question": "Can two separate processes share a Windows critical section for mutual exclusion?", "answer": "A critical section coordinates threads within one process. A mutex can coordinate threads in different processes.", "prompt": "Answer the Windows question concisely.\nQuestion: Can two separate processes share a Windows critical section for mutual exclusion?", "retrieved": []}
|
| 34 |
+
{"id": "07fab401e0635f69", "split": "train", "passage": "critical-section-objects", "condition": "rag", "question": "Can two separate processes share a Windows critical section for mutual exclusion?", "answer": "A critical section coordinates threads within one process. A mutex can coordinate threads in different processes. [Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)\nA *critical section object* provides synchronization similar to that provided by a mutex object, except that a critical section can be used only by the threads of a single process. Critical section objects cannot be shared across processes. Event, mutex, and semaphore objects can also be used in a single-process application, but critical section objects provide a slightly faster, more efficient mechanism for mutual-exclusion synchronization (a processor-specific test and set instruction). Like a mutex object, a critical section object can be owned by only one thread at a time, which makes it useful for protecting a shared resource from simultaneous access. Unlike a mutex object, there is no way to tell whether a critical section has been abandoned.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nA *mutex object* is a synchronization object whose state is set to signaled when it is not owned by any thread, and nonsignaled when it is owned. Only one thread at a time can own a mutex object, whose name comes from the fact that it is useful in coordinating mutually exclusive access to a shared resource. For example, to prevent two threads from writing to shared memory at the same time, each thread waits for ownership of a mutex object before executing the code that accesses the memory. After writing to the shared memory, the thread releases the mutex object.\n\nQuestion: Can two separate processes share a Windows critical section for mutual exclusion?", "retrieved": ["critical-section-objects", "mutex-objects"]}
|
| 35 |
+
{"id": "a4a125c48a499822", "split": "train", "passage": "critical-section-objects", "condition": "closed", "question": "May a thread reenter a critical section it already owns?", "answer": "Yes. It must leave once for each successful entry before another thread can acquire it.", "prompt": "Answer the Windows question concisely.\nQuestion: May a thread reenter a critical section it already owns?", "retrieved": []}
|
| 36 |
+
{"id": "a4a125c48a499822", "split": "train", "passage": "critical-section-objects", "condition": "rag", "question": "May a thread reenter a critical section it already owns?", "answer": "Yes. It must leave once for each successful entry before another thread can acquire it. [Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)\nWhen a thread owns a critical section, it can make additional calls to EnterCriticalSection or TryEnterCriticalSection without blocking its execution. This prevents a thread from deadlocking itself while waiting for a critical section that it already owns. To release its ownership, the thread must call LeaveCriticalSection one time for each time that it entered the critical section. There is no guarantee about the order in which waiting threads will acquire ownership of the critical section.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nto block the execution of the waiting high-priority thread. To do this, use a wait function, critical section, or the Sleep function, SleepEx, or SwitchToThread function. This is preferable to having the thread execute a loop. Otherwise, the process may become deadlocked, because the thread with lower priority is never scheduled. To determine the current priority level of a thread, use the GetThreadPriority function. The process priority class and thread priority level are combined to form the base priority of each thread.\n\nQuestion: May a thread reenter a critical section it already owns?", "retrieved": ["critical-section-objects", "scheduling-priorities"]}
|
| 37 |
+
{"id": "71fba3d72f092acc", "split": "test", "passage": "condition-variables", "condition": "closed", "question": "Why should a Windows condition-variable wait recheck its predicate after waking?", "answer": "Spurious and stolen wakeups are possible. After reacquiring the lock, retest the predicate in a loop.", "prompt": "Answer the Windows question concisely.\nQuestion: Why should a Windows condition-variable wait recheck its predicate after waking?", "retrieved": []}
|
| 38 |
+
{"id": "71fba3d72f092acc", "split": "test", "passage": "condition-variables", "condition": "rag", "question": "Why should a Windows condition-variable wait recheck its predicate after waking?", "answer": "Spurious and stolen wakeups are possible. After reacquiring the lock, retest the predicate in a loop. [Condition Variables](https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Condition Variables](https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables)\nWakes a single thread waiting on the specified condition variable. | The following pseudocode demonstrates the typical usage pattern of condition variables. For example, in an implementation of a reader/writer lock, the `TestPredicate` function would verify that the current lock request is compatible with the existing owners. If it is, acquire the lock; otherwise, sleep. For a more detailed example, see Using Condition Variables. Condition variables are subject to spurious wakeups (those not associated with an explicit wake) and stolen wakeups (another thread manages to run before the woken thread). Therefore, you should recheck a predicate (typically in a while loop) after a sleep operation returns.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nIf more than one thread is waiting on a mutex, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order. After a thread obtains ownership of a mutex, it can specify the same mutex in repeated calls to the wait-functions without blocking its execution. This prevents a thread from deadlocking itself while waiting for a mutex that it already owns. To release its ownership under such circumstances, the thread must call ReleaseMutex once for each time that the mutex satisfied the conditions of a wait function.\n\nQuestion: Why should a Windows condition-variable wait recheck its predicate after waking?", "retrieved": ["condition-variables", "mutex-objects"]}
|
| 39 |
+
{"id": "8d0cd1227652f084", "split": "test", "passage": "condition-variables", "condition": "closed", "question": "Which condition-variable operation wakes every waiting thread?", "answer": "WakeAllConditionVariable wakes all waiters on that condition variable. Each must still reacquire the lock and check its predicate.", "prompt": "Answer the Windows question concisely.\nQuestion: Which condition-variable operation wakes every waiting thread?", "retrieved": []}
|
| 40 |
+
{"id": "8d0cd1227652f084", "split": "test", "passage": "condition-variables", "condition": "rag", "question": "Which condition-variable operation wakes every waiting thread?", "answer": "WakeAllConditionVariable wakes all waiters on that condition variable. Each must still reacquire the lock and check its predicate. [Condition Variables](https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Condition Variables](https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables)\nCondition variables are synchronization primitives that enable threads to wait until a particular condition occurs. Condition variables are user-mode objects that cannot be shared across processes. Condition variables enable threads to atomically release a lock and enter the sleeping state. They can be used with critical sections or slim reader/writer (SRW) locks. Condition variables support operations that \"wake one\" or \"wake all\" waiting threads. After a thread is woken, it re-acquires the lock it released when the thread entered the sleeping state.\n\n[I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)\nThe I/O completion port handle and every file handle associated with that particular I/O completion port are known as *references to the I/O completion port*. The I/O completion port is released when there are no more references to it. Therefore, all of these handles must be properly closed to release the I/O completion port and its associated system resources. After these conditions are satisfied, an application should close the I/O completion port handle by calling the CloseHandle function.\n\nQuestion: Which condition-variable operation wakes every waiting thread?", "retrieved": ["condition-variables", "i-o-completion-ports"]}
|
| 41 |
+
{"id": "73f578a54803cb1f", "split": "train", "passage": "working-set", "condition": "closed", "question": "What does a process working set count?", "answer": "It consists of the pageable virtual-memory pages currently resident in physical memory for the process.", "prompt": "Answer the Windows question concisely.\nQuestion: What does a process working set count?", "retrieved": []}
|
| 42 |
+
{"id": "73f578a54803cb1f", "split": "train", "passage": "working-set", "condition": "rag", "question": "What does a process working set count?", "answer": "It consists of the pageable virtual-memory pages currently resident in physical memory for the process. [Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\navailable. Each process has a minimum and maximum working set size that affect the virtual memory paging behavior of the process. To obtain the current size of the working set of a specified process, use the GetProcessMemoryInfo function. To obtain or change the minimum and maximum working set sizes, use the GetProcessWorkingSetSizeEx and SetProcessWorkingSetSizeEx functions. The process status application programming interface (PSAPI) provides a number of functions that return detailed information about the working set of a process. For details, see Working Set Information.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nThe initial count of a semaphore is typically set to the maximum value. The count is then decremented from that level as the protected resource is consumed. Alternatively, you can create a semaphore with an initial count of zero to block access to the protected resource while the application is being initialized. After initialization, you can use ReleaseSemaphore to increment the count to the maximum value.\n\nQuestion: What does a process working set count?", "retrieved": ["working-set", "semaphore-objects"]}
|
| 43 |
+
{"id": "5886e023585c0938", "split": "train", "passage": "working-set", "condition": "closed", "question": "Does every fault for a page outside the working set require a disk read?", "answer": "No. A soft fault can be resolved without reading backing storage. A hard fault requires reading the page from backing storage.", "prompt": "Answer the Windows question concisely.\nQuestion: Does every fault for a page outside the working set require a disk read?", "retrieved": []}
|
| 44 |
+
{"id": "5886e023585c0938", "split": "train", "passage": "working-set", "condition": "rag", "question": "Does every fault for a page outside the working set require a disk read?", "answer": "No. A soft fault can be resolved without reading backing storage. A hard fault requires reading the page from backing storage. [Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nA *hard page fault* must be resolved by reading page contents from the page's *backing store*, which is either the system paging file or a memory-mapped file created by the process. A *soft page fault* can be resolved without accessing the backing store. A soft page fault occurs when: - The page is in the working set of some other process, so it is already resident in memory. - The page is in transition, because it either has been removed from the working sets of all processes that were using the page and has not yet been repurposed, or it is already resident as a result of a memory manager prefetch operation. - A process references an allocated virtual page for the first time (sometimes\n\n[Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)\nphysical storage associated with it. It is available to be committed. <br/> A process can use the VirtualAlloc or VirtualAllocEx function to reserve pages of its address space and later to commit the reserved pages. It can use VirtualFree or VirtualFreeEx to decommit committed pages and return them to the reserved state.<br/> | | Committed | Memory charges have been allocated from the overall size of RAM and paging files on disk. The page is accessible and access is controlled by one of the memory protection constants. The system initializes and loads each committed page into physical memory only during the first attempt to read or write to that page. When the process terminates, the system releases the storage for committed pages. <br/> A process\n\nQuestion: Does every fault for a page outside the working set require a disk read?", "retrieved": ["working-set", "page-state"]}
|
| 45 |
+
{"id": "337696dff8cfe026", "split": "train", "passage": "page-state", "condition": "closed", "question": "Can my application write to an address range immediately after reserving it?", "answer": "Reservation sets aside virtual address space. The pages must be committed with suitable protection before they can be used.", "prompt": "Answer the Windows question concisely.\nQuestion: Can my application write to an address range immediately after reserving it?", "retrieved": []}
|
| 46 |
+
{"id": "337696dff8cfe026", "split": "train", "passage": "page-state", "condition": "rag", "question": "Can my application write to an address range immediately after reserving it?", "answer": "Reservation sets aside virtual address space. The pages must be committed with suitable protection before they can be used. [Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)\nThe pages of a process's virtual address space can be in one of the following states. | State | Description | |-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Free | The page is neither committed nor reserved. The page is not accessible to the process. It is available to be reserved, committed, or simultaneously reserved and committed. Attempting to read from or write to a free page results in an access violation exception. <br/> A process can use the VirtualFree or VirtualFreeEx function to release reserved or committed pages of its address space, returning them to the free state.<br/> | | Reserved | The page has been reserved for future use. The range of addresses cannot be used by other allocation functions. The page is not accessible and has no\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nHandles to directory objects are obtained by calling the CreateFile function with the FILE\\_FLAG\\_BACKUP\\_SEMANTICS attribute. Directory handles are almost never used—backup applications are one of the few applications that will typically use them. After opening the file object for asynchronous I/O, an OVERLAPPED structure must be properly created, initialized, and passed into each call to functions such as ReadFile and WriteFile. Keep the following in mind when using the OVERLAPPED structure in asynchronous read and write operations:\n\nQuestion: Can my application write to an address range immediately after reserving it?", "retrieved": ["page-state", "synchronous-and-asynchronous-i-o"]}
|
| 47 |
+
{"id": "7cd0368a0d148c67", "split": "train", "passage": "page-state", "condition": "closed", "question": "Does reserving virtual addresses reserve physical RAM for every page?", "answer": "No. Reservation sets aside addresses without allocating physical storage for the range.", "prompt": "Answer the Windows question concisely.\nQuestion: Does reserving virtual addresses reserve physical RAM for every page?", "retrieved": []}
|
| 48 |
+
{"id": "7cd0368a0d148c67", "split": "train", "passage": "page-state", "condition": "rag", "question": "Does reserving virtual addresses reserve physical RAM for every page?", "answer": "No. Reservation sets aside addresses without allocating physical storage for the range. [Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)\nphysical storage associated with it. It is available to be committed. <br/> A process can use the VirtualAlloc or VirtualAllocEx function to reserve pages of its address space and later to commit the reserved pages. It can use VirtualFree or VirtualFreeEx to decommit committed pages and return them to the reserved state.<br/> | | Committed | Memory charges have been allocated from the overall size of RAM and paging files on disk. The page is accessible and access is controlled by one of the memory protection constants. The system initializes and loads each committed page into physical memory only during the first attempt to read or write to that page. When the process terminates, the system releases the storage for committed pages. <br/> A process\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nThe working set of a process is the set of pages in the virtual address space of the process that are currently resident in physical memory. The working set contains only pageable memory allocations; nonpageable memory allocations such as Address Windowing Extensions (AWE) or large page allocations are not included in the working set. When a process references pageable memory that is not currently in its working set, a *page fault* occurs. The system page fault handler attempts to resolve the page fault and, if it succeeds, the page is added to the working set. (Accessing AWE or large page allocations never causes a page fault, because these allocations are not pageable.)\n\nQuestion: Does reserving virtual addresses reserve physical RAM for every page?", "retrieved": ["page-state", "working-set"]}
|
| 49 |
+
{"id": "0535c31f8d60ce73", "split": "train", "passage": "file-mapping", "condition": "closed", "question": "How does a process access a chosen portion of a file through memory mapping?", "answer": "Create or open a file-mapping object and map a view of the desired portion into the process address space.", "prompt": "Answer the Windows question concisely.\nQuestion: How does a process access a chosen portion of a file through memory mapping?", "retrieved": []}
|
| 50 |
+
{"id": "0535c31f8d60ce73", "split": "train", "passage": "file-mapping", "condition": "rag", "question": "How does a process access a chosen portion of a file through memory mapping?", "answer": "Create or open a file-mapping object and map a view of the desired portion into the process address space. [File Mapping](https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[File Mapping](https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping)\n*File mapping* is the association of a file's contents with a portion of the virtual address space of a process. The system creates a *file mapping object* (also known as a *section object*) to maintain this association. A *file view* is the portion of virtual address space that a process uses to access the file's contents. File mapping allows the process to use both random input and output (I/O) and sequential I/O. It also allows the process to work efficiently with a large data file, such as a database, without having to map the whole file into memory. Multiple processes can also use memory-mapped files to share data.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nA *hard page fault* must be resolved by reading page contents from the page's *backing store*, which is either the system paging file or a memory-mapped file created by the process. A *soft page fault* can be resolved without accessing the backing store. A soft page fault occurs when: - The page is in the working set of some other process, so it is already resident in memory. - The page is in transition, because it either has been removed from the working sets of all processes that were using the page and has not yet been repurposed, or it is already resident as a result of a memory manager prefetch operation. - A process references an allocated virtual page for the first time (sometimes\n\nQuestion: How does a process access a chosen portion of a file through memory mapping?", "retrieved": ["file-mapping", "working-set"]}
|
| 51 |
+
{"id": "4986e6425377db21", "split": "train", "passage": "file-mapping", "condition": "closed", "question": "Can multiple processes view the same data through one file-mapping object?", "answer": "Yes. Each process maps its own view of the shared mapping into its address space.", "prompt": "Answer the Windows question concisely.\nQuestion: Can multiple processes view the same data through one file-mapping object?", "retrieved": []}
|
| 52 |
+
{"id": "4986e6425377db21", "split": "train", "passage": "file-mapping", "condition": "rag", "question": "Can multiple processes view the same data through one file-mapping object?", "answer": "Yes. Each process maps its own view of the shared mapping into its address space. [File Mapping](https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[File Mapping](https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping)\nA file view can consist of all or only part of the file mapping object. A process manipulates the file through the file views. A process can create multiple views for a file mapping object. The file views created by each process reside in the virtual address space of that process. When the process needs data from a portion of the file other than what is in the current file view, it can unmap the current file view, then create a new file view.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\ncalled a *demand-zero fault*). Pages can be removed from a process working set as a result of the following actions: - The process reduces or empties the working set by calling the SetProcessWorkingSetSize, SetProcessWorkingSetSizeEx or EmptyWorkingSet function. - The process calls the VirtualUnlock function on a memory range that is not locked. - The process unmaps a mapped view of a file using the UnmapViewOfFile function. - The memory manager trims pages from the working set to create more available memory. - The memory manager must remove a page from the working set to make room for a new page (for example, because the working set is at its maximum size).\n\nQuestion: Can multiple processes view the same data through one file-mapping object?", "retrieved": ["file-mapping", "working-set"]}
|
| 53 |
+
{"id": "10a12e19289b92e2", "split": "test", "passage": "i-o-completion-ports", "condition": "closed", "question": "How do the queue orders for completion packets and waiting completion-port threads differ?", "answer": "Packets are queued first-in, first-out. Threads blocked on the port are released in last-in, first-out order subject to the concurrency limit.", "prompt": "Answer the Windows question concisely.\nQuestion: How do the queue orders for completion packets and waiting completion-port threads differ?", "retrieved": []}
|
| 54 |
+
{"id": "10a12e19289b92e2", "split": "test", "passage": "i-o-completion-ports", "condition": "rag", "question": "How do the queue orders for completion packets and waiting completion-port threads differ?", "answer": "Packets are queued first-in, first-out. Threads blocked on the port are released in last-in, first-out order subject to the concurrency limit. [I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)\nThe CreateIoCompletionPort function creates an I/O completion port and associates one or more file handles with that port. When an asynchronous I/O operation on one of these file handles completes, an I/O completion packet is queued in first-in-first-out (FIFO) order to the associated I/O completion port. One powerful use for this mechanism is to combine the synchronization point for multiple file handles into a single object, although there are also other useful applications. Please note that while the packets are queued in FIFO order they may be dequeued in a different order.\n\n[Event Objects (Synchronization)](https://learn.microsoft.com/en-us/windows/win32/sync/event-objects)\nIf more than one thread is waiting, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order.<br/> | The event object is useful in sending a signal to a thread indicating that a particular event has occurred. For example, in overlapped input and output, the system sets a specified event object to the signaled state when the overlapped operation has been completed. A single thread can specify different event objects in several simultaneous overlapped operations, then use one of the multiple-object wait functions to wait for the state of any one of the event objects to be signaled.\n\nQuestion: How do the queue orders for completion packets and waiting completion-port threads differ?", "retrieved": ["i-o-completion-ports", "event-objects"]}
|
| 55 |
+
{"id": "33a8e51629783b38", "split": "test", "passage": "i-o-completion-ports", "condition": "closed", "question": "What does the concurrency value on an I/O completion port control?", "answer": "It limits the number of runnable threads associated with the port, allowing other waiting workers to remain blocked.", "prompt": "Answer the Windows question concisely.\nQuestion: What does the concurrency value on an I/O completion port control?", "retrieved": []}
|
| 56 |
+
{"id": "33a8e51629783b38", "split": "test", "passage": "i-o-completion-ports", "condition": "rag", "question": "What does the concurrency value on an I/O completion port control?", "answer": "It limits the number of runnable threads associated with the port, allowing other waiting workers to remain blocked. [I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[I/O completion ports](https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports)\n> [!NOTE] > An I/O completion port is associated with the process that created it and is not sharable between processes. However, a single handle is sharable between threads in the same process. The most important property of an I/O completion port to consider carefully is the concurrency value. The concurrency value of a completion port is specified when it is created with CreateIoCompletionPort via the *NumberOfConcurrentThreads* parameter. This value limits the number of runnable threads associated with the completion port. When the total number of runnable threads associated with the completion port reaches the concurrency value, the system blocks the execution of any subsequent threads associated with that completion port until the number of runnable threads drops below the concurrency value.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\n- Driver dispatch routines servicing read/write requests generally cannot wait for a dispatcher object to be set to the Signaled state. - A dispatch routine for a device I/O control request can wait for a dispatcher object to be set to the Signaled state only if the transfer type for the I/O control code is METHOD_BUFFERED. - SCSI miniport drivers should not use kernel dispatcher objects. SCSI miniport drivers should call only SCSI Port Driver Support Routines.\n\nQuestion: What does the concurrency value on an I/O completion port control?", "retrieved": ["i-o-completion-ports", "introduction-to-kernel-dispatcher-objects"]}
|
| 57 |
+
{"id": "b8230e8f33f93be2", "split": "train", "passage": "synchronous-and-asynchronous-i-o", "condition": "closed", "question": "What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle?", "answer": "It opens the handle for overlapped I/O. The caller supplies a separate OVERLAPPED structure for each outstanding operation.", "prompt": "Answer the Windows question concisely.\nQuestion: What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle?", "retrieved": []}
|
| 58 |
+
{"id": "b8230e8f33f93be2", "split": "train", "passage": "synchronous-and-asynchronous-i-o", "condition": "rag", "question": "What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle?", "answer": "It opens the handle for overlapped I/O. The caller supplies a separate OVERLAPPED structure for each outstanding operation. [Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nA process opens a file for asynchronous I/O in its call to CreateFile by specifying the FILE\\_FLAG\\_OVERLAPPED flag in the *dwFlagsAndAttributes* parameter. If FILE\\_FLAG\\_OVERLAPPED is not specified, the file is opened for synchronous I/O. When the file has been opened for asynchronous I/O, a pointer to an OVERLAPPED structure is passed into the call to ReadFile and WriteFile. When performing synchronous I/O, this structure is not required in calls to ReadFile and WriteFile.\n\nQuestion: What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle?", "retrieved": ["synchronous-and-asynchronous-i-o"]}
|
| 59 |
+
{"id": "a1e6774ce4d5ae00", "split": "train", "passage": "synchronous-and-asynchronous-i-o", "condition": "closed", "question": "Does an asynchronous file operation always finish after the initiating call returns?", "answer": "No. An overlapped operation can complete immediately or remain pending. The caller must handle either result.", "prompt": "Answer the Windows question concisely.\nQuestion: Does an asynchronous file operation always finish after the initiating call returns?", "retrieved": []}
|
| 60 |
+
{"id": "a1e6774ce4d5ae00", "split": "train", "passage": "synchronous-and-asynchronous-i-o", "condition": "rag", "question": "Does an asynchronous file operation always finish after the initiating call returns?", "answer": "No. An overlapped operation can complete immediately or remain pending. The caller must handle either result. [Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nHandles to directory objects are obtained by calling the CreateFile function with the FILE\\_FLAG\\_BACKUP\\_SEMANTICS attribute. Directory handles are almost never used—backup applications are one of the few applications that will typically use them. After opening the file object for asynchronous I/O, an OVERLAPPED structure must be properly created, initialized, and passed into each call to functions such as ReadFile and WriteFile. Keep the following in mind when using the OVERLAPPED structure in asynchronous read and write operations:\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\n- The driver is performing a completely synchronous I/O request. That is, no driver queues any operations while handling the I/O request, and no driver returns until the driver below it has finished handling the request. Additionally, a driver cannot enter a wait state if it is executing at or above IRQL equal to DISPATCH_LEVEL. Based on these limitations, you must use the following rules:\n\nQuestion: Does an asynchronous file operation always finish after the initiating call returns?", "retrieved": ["synchronous-and-asynchronous-i-o", "introduction-to-kernel-dispatcher-objects"]}
|
| 61 |
+
{"id": "f9ca8e570dc1123e", "split": "train", "passage": "introduction-to-kernel-dispatcher-objects", "condition": "closed", "question": "What do waitable kernel dispatcher objects have in common?", "answer": "They have a signaled or nonsignaled state that the kernel uses when satisfying waits.", "prompt": "Answer the Windows question concisely.\nQuestion: What do waitable kernel dispatcher objects have in common?", "retrieved": []}
|
| 62 |
+
{"id": "f9ca8e570dc1123e", "split": "train", "passage": "introduction-to-kernel-dispatcher-objects", "condition": "rag", "question": "What do waitable kernel dispatcher objects have in common?", "answer": "They have a signaled or nonsignaled state that the kernel uses when satisfying waits. [Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nThe kernel defines a set of object types called *kernel dispatcher objects*, or just *dispatcher objects*. Dispatcher objects include timer objects, event objects, semaphore objects, mutex objects, and thread objects. Drivers can use dispatcher objects as synchronization mechanisms within a nonarbitrary thread context while executing at IRQL equal to PASSIVE_LEVEL. Every kernel-defined dispatcher object type has a state that is either set to Signaled or set to Not-Signaled.\n\nQuestion: What do waitable kernel dispatcher objects have in common?", "retrieved": ["introduction-to-kernel-dispatcher-objects"]}
|
| 63 |
+
{"id": "a3ebd8f64a063794", "split": "train", "passage": "introduction-to-kernel-dispatcher-objects", "condition": "closed", "question": "Does satisfying a kernel wait guarantee that the thread starts executing immediately?", "answer": "It makes the thread eligible to run. Actual execution depends on scheduling.", "prompt": "Answer the Windows question concisely.\nQuestion: Does satisfying a kernel wait guarantee that the thread starts executing immediately?", "retrieved": []}
|
| 64 |
+
{"id": "a3ebd8f64a063794", "split": "train", "passage": "introduction-to-kernel-dispatcher-objects", "condition": "rag", "question": "Does satisfying a kernel wait guarantee that the thread starts executing immediately?", "answer": "The retrieved references do not establish that. I need a source on introduction to kernel dispatcher objects.", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nAlso see I/O-related sample applications. There are two types of input/output (I/O) synchronization: synchronous I/O and asynchronous I/O. Asynchronous I/O is also referred to as overlapped I/O. In *synchronous file I/O*, a thread starts an I/O operation and immediately enters a wait state until the I/O request has completed. A thread performing *asynchronous file I/O* sends an I/O request to the kernel by calling an appropriate function. If the request is accepted by the kernel, the calling thread continues processing another job until the kernel signals to the thread that the I/O operation is complete. It then interrupts its current job and processes the data from the I/O operation as necessary.\n\nQuestion: Does satisfying a kernel wait guarantee that the thread starts executing immediately?", "retrieved": ["synchronous-and-asynchronous-i-o"]}
|
| 65 |
+
{"id": "39c7787f32b15d1e", "split": "test", "passage": "canceling-irps", "condition": "closed", "question": "What kernel routine begins cancellation of an I/O request packet?", "answer": "IoCancelIrp initiates cancellation. The cancellation path must complete the request while maintaining system integrity.", "prompt": "Answer the Windows question concisely.\nQuestion: What kernel routine begins cancellation of an I/O request packet?", "retrieved": []}
|
| 66 |
+
{"id": "39c7787f32b15d1e", "split": "test", "passage": "canceling-irps", "condition": "rag", "question": "What kernel routine begins cancellation of an I/O request packet?", "answer": "IoCancelIrp initiates cancellation. The cancellation path must complete the request while maintaining system integrity. [Canceling IRPs](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Canceling IRPs](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps)\nTo \"cancel an IRP\" means to complete the IRP as quickly as possible while still maintaining system integrity. For a general discussion of IRP completion, see Completing IRPs. The cancellation process begins when either the system or a driver calls IoCancelIrp. This routine is called for each IRP that is associated with the thread that has not yet fully completed. The system cancels unprocessed IRPs if the thread that initiated the I/O request exits. Drivers can cancel only IRPs that they have created (see Creating IRPs for Lower-Level Drivers.)\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\ncommon file handle. To cancel all pending asynchronous I/O operations, use either: - CancelIo: This function only cancels operations issued by the calling thread for the specified file handle. - CancelIoEx: This function cancels all operations issued by the threads for the specified file handle. Use CancelSynchronousIo to cancel pending synchronous I/O operations. The ReadFileEx and WriteFileEx functions enable an application to specify a routine to execute (see FileIOCompletionRoutine) when the asynchronous I/O request is completed.\n\nQuestion: What kernel routine begins cancellation of an I/O request packet?", "retrieved": ["canceling-irps", "synchronous-and-asynchronous-i-o"]}
|
| 67 |
+
{"id": "52f1f9c35c67a5c0", "split": "test", "passage": "canceling-irps", "condition": "closed", "question": "Is there a Windows facility for drivers that need a queue of cancelable IRPs?", "answer": "Yes. A cancel-safe IRP queue provides cancellation support for drivers that queue requests.", "prompt": "Answer the Windows question concisely.\nQuestion: Is there a Windows facility for drivers that need a queue of cancelable IRPs?", "retrieved": []}
|
| 68 |
+
{"id": "52f1f9c35c67a5c0", "split": "test", "passage": "canceling-irps", "condition": "rag", "question": "Is there a Windows facility for drivers that need a queue of cancelable IRPs?", "answer": "Yes. A cancel-safe IRP queue provides cancellation support for drivers that queue requests. [Canceling IRPs](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Canceling IRPs](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps)\nDrivers in which IRPs might remain queued for an indefinite interval (so a user could cancel a previously submitted I/O request) must have one or more *Cancel* routines to complete user-canceled I/O requests. For example, keyboard, mouse, parallel, serial, and sound device drivers (or drivers layered over them) and file system drivers should have *Cancel* routines. Drivers for Microsoft Windows XP and later operating systems can use cancel-safe IRP queues rather than implement their own *Cancel* routines.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nAs a general guideline, if you expect that your new device driver will often need to stall for longer than 50 microseconds while it waits for device-state changes during I/O operations, consider implementing a driver with a device-dedicated thread. If the device driver is also a highest-level driver, consider using system worker threads and implementing one or more worker-thread callback routines. See PsCreateSystemThread and Managing Interlocked Queues with a Driver-Created Thread.\n\nQuestion: Is there a Windows facility for drivers that need a queue of cancelable IRPs?", "retrieved": ["canceling-irps", "introduction-to-kernel-dispatcher-objects"]}
|
| 69 |
+
{"id": "6aa2ffae5d1dbd2e", "split": "train", "passage": "semaphore-objects", "condition": "closed", "question": "From the Windows semaphore rules, how many permits does my application's semaphore have right now?", "answer": "The rules explain how the count changes. Determining your live count requires information about that semaphore and its operations.", "prompt": "Answer the Windows question concisely.\nQuestion: From the Windows semaphore rules, how many permits does my application's semaphore have right now?", "retrieved": []}
|
| 70 |
+
{"id": "6aa2ffae5d1dbd2e", "split": "train", "passage": "semaphore-objects", "condition": "rag", "question": "From the Windows semaphore rules, how many permits does my application's semaphore have right now?", "answer": "The rules explain how the count changes. Determining your live count requires information about that semaphore and its operations. [Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nThe semaphore object is useful in controlling a shared resource that can support a limited number of users. It acts as a gate that limits the number of threads sharing the resource to a specified maximum number. For example, an application might place a limit on the number of windows that it creates. It uses a semaphore with a maximum count equal to the window limit, decrementing the count whenever a window is created and incrementing it whenever a window is closed. The application specifies the semaphore object in call to one of the wait functions before each window is created. When the count is zero—indicating that the window limit has been reached—the wait function blocks execution of the window-creation code.\n\nQuestion: From the Windows semaphore rules, how many permits does my application's semaphore have right now?", "retrieved": ["semaphore-objects"]}
|
| 71 |
+
{"id": "04541a599391cc1c", "split": "train", "passage": "job-objects", "condition": "closed", "question": "What exact memory cap has my service assigned to its job object?", "answer": "The reference describes available job limits. The actual cap depends on the job's configured limits.", "prompt": "Answer the Windows question concisely.\nQuestion: What exact memory cap has my service assigned to its job object?", "retrieved": []}
|
| 72 |
+
{"id": "04541a599391cc1c", "split": "train", "passage": "job-objects", "condition": "rag", "question": "What exact memory cap has my service assigned to its job object?", "answer": "The reference describes available job limits. The actual cap depends on the job's configured limits. [Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\nTo close a job object handle, use the CloseHandle function. The job is destroyed when its last handle has been closed and all associated processes have been terminated. However, if the job has the JOB\\_OBJECT\\_LIMIT\\_KILL\\_ON\\_JOB\\_CLOSE flag specified, closing the last job object handle terminates all associated processes and then destroys the job object itself. If a nested job has the JOB\\_OBJECT\\_LIMIT\\_KILL\\_ON\\_JOB\\_CLOSE flag specified, closing the last job object handle terminates all processes associated with the job and its child jobs in the hierarchy.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nThreads are scheduled to run based on their *scheduling priority*. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.) The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread becomes available to run, the system\n\nQuestion: What exact memory cap has my service assigned to its job object?", "retrieved": ["job-objects", "scheduling-priorities"]}
|
| 73 |
+
{"id": "14c29e15a357c5ed", "split": "train", "passage": "working-set", "condition": "closed", "question": "How many pages are in my process working set at this moment?", "answer": "The reference defines a working set. Answering for your process requires a current measurement.", "prompt": "Answer the Windows question concisely.\nQuestion: How many pages are in my process working set at this moment?", "retrieved": []}
|
| 74 |
+
{"id": "14c29e15a357c5ed", "split": "train", "passage": "working-set", "condition": "rag", "question": "How many pages are in my process working set at this moment?", "answer": "The reference defines a working set. Answering for your process requires a current measurement. [Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nThe working set of a process is the set of pages in the virtual address space of the process that are currently resident in physical memory. The working set contains only pageable memory allocations; nonpageable memory allocations such as Address Windowing Extensions (AWE) or large page allocations are not included in the working set. When a process references pageable memory that is not currently in its working set, a *page fault* occurs. The system page fault handler attempts to resolve the page fault and, if it succeeds, the page is added to the working set. (Accessing AWE or large page allocations never causes a page fault, because these allocations are not pageable.)\n\n[Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)\ncan use VirtualAlloc or VirtualAllocEx to commit physical pages from a reserved region. They can also simultaneously reserve and commit pages.<br/> The GlobalAlloc and LocalAlloc functions allocate committed pages with read/write access.<br/> |\n\nQuestion: How many pages are in my process working set at this moment?", "retrieved": ["working-set", "page-state"]}
|
data/questions.tsv
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
source split question answer
|
| 2 |
+
context-switches train Why did a thread give up the CPU before its time slice ran out? A running thread that starts waiting gives up the rest of its time slice. A newly ready higher-priority thread can also trigger a switch.
|
| 3 |
+
context-switches train Will raising the priority of a blocked thread give it CPU time right away? The scheduler can run the thread once it becomes ready. Raising its priority alone leaves the wait in place.
|
| 4 |
+
thread-local-storage train Can two threads use the same TLS index and still see different data? Yes. The index selects a separate slot in each thread, so each thread can store its own value.
|
| 5 |
+
thread-local-storage train Do worker threads need a distinct TLS index apiece for the same per-thread field? One allocated index can identify the field across the process. Each thread accesses its own slot at that index.
|
| 6 |
+
job-objects train What Windows object lets a supervisor apply resource limits to a group of processes? A job object groups processes so the supervisor can set limits and collect accounting information for the group.
|
| 7 |
+
job-objects train How could a supervisor collect accounting for several related processes as a unit? Associate those processes with a job object and query the job's accounting information.
|
| 8 |
+
process-handles-and-identifiers train My program knows a PID. What must it obtain to use APIs that take a process handle? Call OpenProcess with the process ID and the access rights needed for the intended operation.
|
| 9 |
+
process-handles-and-identifiers train Can I treat a PID as a permanent identifier after a process terminates? A process ID is unique during the process lifetime. A later process can receive a reused ID.
|
| 10 |
+
scheduling-priorities train What two settings contribute to the Windows base priority of a thread? The process priority class and the thread's priority within that class determine its base priority.
|
| 11 |
+
scheduling-priorities train If several ready threads share the highest priority, how is their CPU time divided? The scheduler gives ready threads at that priority time slices in round-robin order.
|
| 12 |
+
event-objects test What happens to a manual-reset event after it releases a waiter? It stays signaled until explicitly reset, allowing other waiting threads to proceed.
|
| 13 |
+
event-objects test No thread was waiting when an auto-reset event was signaled. Does a later waiter see it? Yes. It stays signaled until it releases a waiting thread, then resets automatically.
|
| 14 |
+
mutex-objects train The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me? The waiter acquired the mutex, but the prior owner exited without releasing it. Check the protected data for consistency.
|
| 15 |
+
mutex-objects train May a thread acquire the same mutex twice? Yes. The owning thread can acquire it recursively and must release it once per successful acquisition.
|
| 16 |
+
semaphore-objects train Why did the semaphore become nonsignaled after the last available permit was taken? A successful wait decrements the count. At zero the semaphore is nonsignaled until a release increases the count.
|
| 17 |
+
semaphore-objects train Can I assume Windows semaphore waiters get permits in arrival order? No. Waiting threads are selected without a guaranteed first-in, first-out order.
|
| 18 |
+
critical-section-objects train Can two separate processes share a Windows critical section for mutual exclusion? A critical section coordinates threads within one process. A mutex can coordinate threads in different processes.
|
| 19 |
+
critical-section-objects train May a thread reenter a critical section it already owns? Yes. It must leave once for each successful entry before another thread can acquire it.
|
| 20 |
+
condition-variables test Why should a Windows condition-variable wait recheck its predicate after waking? Spurious and stolen wakeups are possible. After reacquiring the lock, retest the predicate in a loop.
|
| 21 |
+
condition-variables test Which condition-variable operation wakes every waiting thread? WakeAllConditionVariable wakes all waiters on that condition variable. Each must still reacquire the lock and check its predicate.
|
| 22 |
+
working-set train What does a process working set count? It consists of the pageable virtual-memory pages currently resident in physical memory for the process.
|
| 23 |
+
working-set train Does every fault for a page outside the working set require a disk read? No. A soft fault can be resolved without reading backing storage. A hard fault requires reading the page from backing storage.
|
| 24 |
+
page-state train Can my application write to an address range immediately after reserving it? Reservation sets aside virtual address space. The pages must be committed with suitable protection before they can be used.
|
| 25 |
+
page-state train Does reserving virtual addresses reserve physical RAM for every page? No. Reservation sets aside addresses without allocating physical storage for the range.
|
| 26 |
+
file-mapping train How does a process access a chosen portion of a file through memory mapping? Create or open a file-mapping object and map a view of the desired portion into the process address space.
|
| 27 |
+
file-mapping train Can multiple processes view the same data through one file-mapping object? Yes. Each process maps its own view of the shared mapping into its address space.
|
| 28 |
+
i-o-completion-ports test How do the queue orders for completion packets and waiting completion-port threads differ? Packets are queued first-in, first-out. Threads blocked on the port are released in last-in, first-out order subject to the concurrency limit.
|
| 29 |
+
i-o-completion-ports test What does the concurrency value on an I/O completion port control? It limits the number of runnable threads associated with the port, allowing other waiting workers to remain blocked.
|
| 30 |
+
synchronous-and-asynchronous-i-o train What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle? It opens the handle for overlapped I/O. The caller supplies a separate OVERLAPPED structure for each outstanding operation.
|
| 31 |
+
synchronous-and-asynchronous-i-o train Does an asynchronous file operation always finish after the initiating call returns? No. An overlapped operation can complete immediately or remain pending. The caller must handle either result.
|
| 32 |
+
introduction-to-kernel-dispatcher-objects train What do waitable kernel dispatcher objects have in common? They have a signaled or nonsignaled state that the kernel uses when satisfying waits.
|
| 33 |
+
introduction-to-kernel-dispatcher-objects train Does satisfying a kernel wait guarantee that the thread starts executing immediately? It makes the thread eligible to run. Actual execution depends on scheduling.
|
| 34 |
+
canceling-irps test What kernel routine begins cancellation of an I/O request packet? IoCancelIrp initiates cancellation. The cancellation path must complete the request while maintaining system integrity.
|
| 35 |
+
canceling-irps test Is there a Windows facility for drivers that need a queue of cancelable IRPs? Yes. A cancel-safe IRP queue provides cancellation support for drivers that queue requests.
|
| 36 |
+
semaphore-objects train From the Windows semaphore rules, how many permits does my application's semaphore have right now? The rules explain how the count changes. Determining your live count requires information about that semaphore and its operations.
|
| 37 |
+
job-objects train What exact memory cap has my service assigned to its job object? The reference describes available job limits. The actual cap depends on the job's configured limits.
|
| 38 |
+
working-set train How many pages are in my process working set at this moment? The reference defines a working set. Answering for your process requires a current measurement.
|
data/train.jsonl
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"id": "26727884ca7fc53a", "split": "train", "passage": "context-switches", "condition": "closed", "question": "Why did a thread give up the CPU before its time slice ran out?", "answer": "A running thread that starts waiting gives up the rest of its time slice. A newly ready higher-priority thread can also trigger a switch.", "prompt": "Answer the Windows question concisely.\nQuestion: Why did a thread give up the CPU before its time slice ran out?", "retrieved": []}
|
| 2 |
+
{"id": "26727884ca7fc53a", "split": "train", "passage": "context-switches", "condition": "rag", "question": "Why did a thread give up the CPU before its time slice ran out?", "answer": "A running thread that starts waiting gives up the rest of its time slice. A newly ready higher-priority thread can also trigger a switch. [Context Switches](https://learn.microsoft.com/en-us/windows/win32/procthread/context-switches)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Context Switches](https://learn.microsoft.com/en-us/windows/win32/procthread/context-switches)\n- The time slice has elapsed. - A thread with a higher priority has become ready to run. - A running thread needs to wait. When a running thread needs to wait, it relinquishes the remainder of its time slice.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nA thread can decrement a semaphore's count more than once by repeatedly specifying the same semaphore object in calls to any of the wait functions. However, calling one of the multiple-object wait functions with an array that contains multiple handles of the same semaphore does not result in multiple decrements. When you have finished using the semaphore object, call the CloseHandle function to close the handle. The semaphore object is destroyed when its last handle has been closed. Closing the handle does not affect the semaphore count; therefore, be sure to call ReleaseSemaphore before closing the handle or before the process terminates. Otherwise, pending wait operations will either time out or continue indefinitely, depending on whether a time-out value has been specified.\n\nQuestion: Why did a thread give up the CPU before its time slice ran out?", "retrieved": ["context-switches", "semaphore-objects"]}
|
| 3 |
+
{"id": "135713966a6f127b", "split": "train", "passage": "context-switches", "condition": "closed", "question": "Will raising the priority of a blocked thread give it CPU time right away?", "answer": "The scheduler can run the thread once it becomes ready. Raising its priority alone leaves the wait in place.", "prompt": "Answer the Windows question concisely.\nQuestion: Will raising the priority of a blocked thread give it CPU time right away?", "retrieved": []}
|
| 4 |
+
{"id": "135713966a6f127b", "split": "train", "passage": "context-switches", "condition": "rag", "question": "Will raising the priority of a blocked thread give it CPU time right away?", "answer": "The retrieved references do not establish that. I need a source on context switches.", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nProcesses that monitor the system, such as screen savers or applications that periodically update a display, should use IDLE\\_PRIORITY\\_CLASS. This prevents the threads of this process, which do not have high priority, from interfering with higher priority threads. Use HIGH\\_PRIORITY\\_CLASS with care. If a thread runs at the highest priority level for extended periods, other threads in the system will not get processor time. If several threads are set at high priority at the same time, the threads lose their effectiveness. The high-priority class should be reserved for threads that must respond to time-critical events. If your application performs one task that requires the high-priority class while the rest of its tasks are normal priority, use SetPriorityClass to raise the priority class of the application\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\na notification when they are exceeded but allow the job to continue to run. To set limits for a job, use the SetInformationJobObject function. For a list of possible limits that can be set for a job, see the following topics: - JOBOBJECT\\_BASIC\\_LIMIT\\_INFORMATION - JOBOBJECT\\_BASIC\\_UI\\_RESTRICTIONS - JOBOBJECT\\_CPU\\_RATE\\_CONTROL\\_INFORMATION - JOBOBJECT\\_EXTENDED\\_LIMIT\\_INFORMATION - JOBOBJECT\\_NOTIFICATION\\_LIMIT\\_INFORMATION Security limits must be set individually for each process associated with a job object. For more information, see Process Security and Access Rights.\n\nQuestion: Will raising the priority of a blocked thread give it CPU time right away?", "retrieved": ["scheduling-priorities", "job-objects"]}
|
| 5 |
+
{"id": "a46efb9bef14e278", "split": "train", "passage": "thread-local-storage", "condition": "closed", "question": "Can two threads use the same TLS index and still see different data?", "answer": "Yes. The index selects a separate slot in each thread, so each thread can store its own value.", "prompt": "Answer the Windows question concisely.\nQuestion: Can two threads use the same TLS index and still see different data?", "retrieved": []}
|
| 6 |
+
{"id": "a46efb9bef14e278", "split": "train", "passage": "thread-local-storage", "condition": "rag", "question": "Can two threads use the same TLS index and still see different data?", "answer": "Yes. The index selects a separate slot in each thread, so each thread can store its own value. [Thread Local Storage](https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Thread Local Storage](https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage)\nto allocate separate storage, consolidate the data, and minimize the number of TLS slots in use. The following diagram illustrates how TLS works. For a code example illustrating the use of thread local storage, see Using Thread Local Storage. The process has two threads, Thread 1 and Thread 2. It allocates two indexes for use with TLS, gdwTlsIndex1 and gdwTlsIndex2. Each thread allocates two memory blocks (one for each index) in which to store the data, and stores the pointers to these memory blocks in the corresponding TLS slots. To access the data associated with an index, the thread retrieves the pointer to the memory block from the TLS slot and stores it in the lpvData local variable.\n\nQuestion: Can two threads use the same TLS index and still see different data?", "retrieved": ["thread-local-storage"]}
|
| 7 |
+
{"id": "ee4857c32a20fd9a", "split": "train", "passage": "thread-local-storage", "condition": "closed", "question": "Do worker threads need a distinct TLS index apiece for the same per-thread field?", "answer": "One allocated index can identify the field across the process. Each thread accesses its own slot at that index.", "prompt": "Answer the Windows question concisely.\nQuestion: Do worker threads need a distinct TLS index apiece for the same per-thread field?", "retrieved": []}
|
| 8 |
+
{"id": "ee4857c32a20fd9a", "split": "train", "passage": "thread-local-storage", "condition": "rag", "question": "Do worker threads need a distinct TLS index apiece for the same per-thread field?", "answer": "One allocated index can identify the field across the process. Each thread accesses its own slot at that index. [Thread Local Storage](https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Thread Local Storage](https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage)\nThe constant TLS\\_MINIMUM\\_AVAILABLE defines the minimum number of TLS indexes available in each process. This minimum is guaranteed to be at least 64 for all systems. The maximum number of indexes per process is 1,088. When the threads are created, the system allocates an array of LPVOID values for TLS, which are initialized to NULL. Before an index can be used, it must be allocated by one of the threads. Each thread stores its data for a TLS index in a *TLS slot* in the array. If the data associated with an index will fit in an LPVOID value, you can store the data directly in the TLS slot. However, if you are using a large number of indexes in this way, it is better\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nAs a general guideline, if you expect that your new device driver will often need to stall for longer than 50 microseconds while it waits for device-state changes during I/O operations, consider implementing a driver with a device-dedicated thread. If the device driver is also a highest-level driver, consider using system worker threads and implementing one or more worker-thread callback routines. See PsCreateSystemThread and Managing Interlocked Queues with a Driver-Created Thread.\n\nQuestion: Do worker threads need a distinct TLS index apiece for the same per-thread field?", "retrieved": ["thread-local-storage", "introduction-to-kernel-dispatcher-objects"]}
|
| 9 |
+
{"id": "ac937ed63b06141e", "split": "train", "passage": "job-objects", "condition": "closed", "question": "What Windows object lets a supervisor apply resource limits to a group of processes?", "answer": "A job object groups processes so the supervisor can set limits and collect accounting information for the group.", "prompt": "Answer the Windows question concisely.\nQuestion: What Windows object lets a supervisor apply resource limits to a group of processes?", "retrieved": []}
|
| 10 |
+
{"id": "ac937ed63b06141e", "split": "train", "passage": "job-objects", "condition": "rag", "question": "What Windows object lets a supervisor apply resource limits to a group of processes?", "answer": "A job object groups processes so the supervisor can set limits and collect accounting information for the group. [Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\nA *job object* allows groups of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of the processes associated with them. Operations performed on a job object affect all processes associated with the job object. Examples include enforcing limits such as working set size and process priority or terminating all processes associated with a job. - Creating Jobs - Managing Processes in Jobs - Job Limits and Notifications - Resource Accounting for Jobs - Managing Job Objects - Managing a Process Tree that Uses Job Objects\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nThe semaphore object is useful in controlling a shared resource that can support a limited number of users. It acts as a gate that limits the number of threads sharing the resource to a specified maximum number. For example, an application might place a limit on the number of windows that it creates. It uses a semaphore with a maximum count equal to the window limit, decrementing the count whenever a window is created and incrementing it whenever a window is closed. The application specifies the semaphore object in call to one of the wait functions before each window is created. When the count is zero—indicating that the window limit has been reached—the wait function blocks execution of the window-creation code.\n\nQuestion: What Windows object lets a supervisor apply resource limits to a group of processes?", "retrieved": ["job-objects", "semaphore-objects"]}
|
| 11 |
+
{"id": "83bf2317b18d0b4b", "split": "train", "passage": "job-objects", "condition": "closed", "question": "How could a supervisor collect accounting for several related processes as a unit?", "answer": "Associate those processes with a job object and query the job's accounting information.", "prompt": "Answer the Windows question concisely.\nQuestion: How could a supervisor collect accounting for several related processes as a unit?", "retrieved": []}
|
| 12 |
+
{"id": "83bf2317b18d0b4b", "split": "train", "passage": "job-objects", "condition": "rag", "question": "How could a supervisor collect accounting for several related processes as a unit?", "answer": "Associate those processes with a job object and query the job's accounting information. [Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\nA *job object* allows groups of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of the processes associated with them. Operations performed on a job object affect all processes associated with the job object. Examples include enforcing limits such as working set size and process priority or terminating all processes associated with a job. - Creating Jobs - Managing Processes in Jobs - Job Limits and Notifications - Resource Accounting for Jobs - Managing Job Objects - Managing a Process Tree that Uses Job Objects\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nThe system does not maintain the file pointer on asynchronous handles to files and devices that support file pointers (that is, seeking devices), therefore the file position must be passed to the read and write functions in the related offset data members of the OVERLAPPED structure. For more information, see WriteFile and ReadFile. File pointer position for a synchronous handle is maintained by the system as data is read or written and can also be updated using the SetFilePointer or SetFilePointerEx function.\n\nQuestion: How could a supervisor collect accounting for several related processes as a unit?", "retrieved": ["job-objects", "synchronous-and-asynchronous-i-o"]}
|
| 13 |
+
{"id": "99bc41280df74db4", "split": "train", "passage": "process-handles-and-identifiers", "condition": "closed", "question": "My program knows a PID. What must it obtain to use APIs that take a process handle?", "answer": "Call OpenProcess with the process ID and the access rights needed for the intended operation.", "prompt": "Answer the Windows question concisely.\nQuestion: My program knows a PID. What must it obtain to use APIs that take a process handle?", "retrieved": []}
|
| 14 |
+
{"id": "99bc41280df74db4", "split": "train", "passage": "process-handles-and-identifiers", "condition": "rag", "question": "My program knows a PID. What must it obtain to use APIs that take a process handle?", "answer": "Call OpenProcess with the process ID and the access rights needed for the intended operation. [Process Handles and Identifiers](https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Process Handles and Identifiers](https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers)\nThe CreateProcess function also returns an identifier that uniquely identifies the process throughout the system. A process can use the GetCurrentProcessId function to get its own process identifier (also known as the process ID or PID). The identifier is valid from the time the process is created until the process has been terminated. A process can use the Process32First function to obtain the process identifier of its parent process.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\navailable. Each process has a minimum and maximum working set size that affect the virtual memory paging behavior of the process. To obtain the current size of the working set of a specified process, use the GetProcessMemoryInfo function. To obtain or change the minimum and maximum working set sizes, use the GetProcessWorkingSetSizeEx and SetProcessWorkingSetSizeEx functions. The process status application programming interface (PSAPI) provides a number of functions that return detailed information about the working set of a process. For details, see Working Set Information.\n\nQuestion: My program knows a PID. What must it obtain to use APIs that take a process handle?", "retrieved": ["process-handles-and-identifiers", "working-set"]}
|
| 15 |
+
{"id": "6c18488e1da9bdc1", "split": "train", "passage": "process-handles-and-identifiers", "condition": "closed", "question": "Can I treat a PID as a permanent identifier after a process terminates?", "answer": "A process ID is unique during the process lifetime. A later process can receive a reused ID.", "prompt": "Answer the Windows question concisely.\nQuestion: Can I treat a PID as a permanent identifier after a process terminates?", "retrieved": []}
|
| 16 |
+
{"id": "6c18488e1da9bdc1", "split": "train", "passage": "process-handles-and-identifiers", "condition": "rag", "question": "Can I treat a PID as a permanent identifier after a process terminates?", "answer": "A process ID is unique during the process lifetime. A later process can receive a reused ID. [Process Handles and Identifiers](https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Process Handles and Identifiers](https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers)\nThe CreateProcess function also returns an identifier that uniquely identifies the process throughout the system. A process can use the GetCurrentProcessId function to get its own process identifier (also known as the process ID or PID). The identifier is valid from the time the process is created until the process has been terminated. A process can use the Process32First function to obtain the process identifier of its parent process.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nThreads are scheduled to run based on their *scheduling priority*. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.) The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread becomes available to run, the system\n\nQuestion: Can I treat a PID as a permanent identifier after a process terminates?", "retrieved": ["process-handles-and-identifiers", "scheduling-priorities"]}
|
| 17 |
+
{"id": "b4cfb7ea53001996", "split": "train", "passage": "scheduling-priorities", "condition": "closed", "question": "What two settings contribute to the Windows base priority of a thread?", "answer": "The process priority class and the thread's priority within that class determine its base priority.", "prompt": "Answer the Windows question concisely.\nQuestion: What two settings contribute to the Windows base priority of a thread?", "retrieved": []}
|
| 18 |
+
{"id": "b4cfb7ea53001996", "split": "train", "passage": "scheduling-priorities", "condition": "rag", "question": "What two settings contribute to the Windows base priority of a thread?", "answer": "The process priority class and the thread's priority within that class determine its base priority. [Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nThe following table shows the base priority for combinations of process priority class and thread priority value.\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\nIf the job is nested, the breakaway settings of parent jobs in the hierarchy affect whether child processes are associated with another job in the hierarchy. For more information, see Nested Jobs. To determine if a process is running in a job, use the IsProcessInJob function. To terminate all processes currently associated with a job object, use the TerminateJobObject function. A job can enforce limits such as working set size, process priority, and end-of-job time limit on each process that is associated with the job. If a process associated with a job attempts to increase its working set size or process priority from the limit established by the job, the function calls succeed but are silently ignored. A job can also set limits that trigger\n\nQuestion: What two settings contribute to the Windows base priority of a thread?", "retrieved": ["scheduling-priorities", "job-objects"]}
|
| 19 |
+
{"id": "65f43834d750ddfb", "split": "train", "passage": "scheduling-priorities", "condition": "closed", "question": "If several ready threads share the highest priority, how is their CPU time divided?", "answer": "The scheduler gives ready threads at that priority time slices in round-robin order.", "prompt": "Answer the Windows question concisely.\nQuestion: If several ready threads share the highest priority, how is their CPU time divided?", "retrieved": []}
|
| 20 |
+
{"id": "65f43834d750ddfb", "split": "train", "passage": "scheduling-priorities", "condition": "rag", "question": "If several ready threads share the highest priority, how is their CPU time divided?", "answer": "The scheduler gives ready threads at that priority time slices in round-robin order. [Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nThreads are scheduled to run based on their *scheduling priority*. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.) The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread becomes available to run, the system\n\n[Context Switches](https://learn.microsoft.com/en-us/windows/win32/procthread/context-switches)\nThe scheduler maintains separate queues of executable threads for each priority level. These threads are known as *ready threads*. When a processor becomes available, the system performs a *context switch*. The steps in a context switch are: 1. Save the context of the thread that was preempted or voluntarily yielded by the processor. 2. If the thread remains in a ready state, place it at the end of the queue for its priority level. 3. Find the highest priority queue that contains ready threads. 4. Remove the thread at the head of the queue, restore its context, and resume execution.\n\nQuestion: If several ready threads share the highest priority, how is their CPU time divided?", "retrieved": ["scheduling-priorities", "context-switches"]}
|
| 21 |
+
{"id": "a3ba187f17e1c64b", "split": "train", "passage": "mutex-objects", "condition": "closed", "question": "The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me?", "answer": "The waiter acquired the mutex, but the prior owner exited without releasing it. Check the protected data for consistency.", "prompt": "Answer the Windows question concisely.\nQuestion: The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me?", "retrieved": []}
|
| 22 |
+
{"id": "a3ba187f17e1c64b", "split": "train", "passage": "mutex-objects", "condition": "rag", "question": "The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me?", "answer": "The waiter acquired the mutex, but the prior owner exited without releasing it. Check the protected data for consistency. [Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nIf a thread terminates without releasing its ownership of a mutex object, the mutex object is considered to be abandoned. A waiting thread can acquire ownership of an abandoned mutex object, but the wait function will return WAIT\\_ABANDONED to indicate that the mutex object is abandoned. An abandoned mutex object indicates that an error has occurred and that any shared resource being protected by the mutex object is in an undefined state. If the thread proceeds as though the mutex object had not been abandoned, it is no longer considered abandoned after the thread releases its ownership. This restores normal behavior if a handle to the mutex object is subsequently specified in a wait function.\n\n[Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)\nA *critical section object* provides synchronization similar to that provided by a mutex object, except that a critical section can be used only by the threads of a single process. Critical section objects cannot be shared across processes. Event, mutex, and semaphore objects can also be used in a single-process application, but critical section objects provide a slightly faster, more efficient mechanism for mutual-exclusion synchronization (a processor-specific test and set instruction). Like a mutex object, a critical section object can be owned by only one thread at a time, which makes it useful for protecting a shared resource from simultaneous access. Unlike a mutex object, there is no way to tell whether a critical section has been abandoned.\n\nQuestion: The previous owner of a Windows mutex died. What does an abandoned-mutex wait tell me?", "retrieved": ["mutex-objects", "critical-section-objects"]}
|
| 23 |
+
{"id": "bc2537f2d6d54575", "split": "train", "passage": "mutex-objects", "condition": "closed", "question": "May a thread acquire the same mutex twice?", "answer": "Yes. The owning thread can acquire it recursively and must release it once per successful acquisition.", "prompt": "Answer the Windows question concisely.\nQuestion: May a thread acquire the same mutex twice?", "retrieved": []}
|
| 24 |
+
{"id": "bc2537f2d6d54575", "split": "train", "passage": "mutex-objects", "condition": "rag", "question": "May a thread acquire the same mutex twice?", "answer": "Yes. The owning thread can acquire it recursively and must release it once per successful acquisition. [Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nIf a thread terminates without releasing its ownership of a mutex object, the mutex object is considered to be abandoned. A waiting thread can acquire ownership of an abandoned mutex object, but the wait function will return WAIT\\_ABANDONED to indicate that the mutex object is abandoned. An abandoned mutex object indicates that an error has occurred and that any shared resource being protected by the mutex object is in an undefined state. If the thread proceeds as though the mutex object had not been abandoned, it is no longer considered abandoned after the thread releases its ownership. This restores normal behavior if a handle to the mutex object is subsequently specified in a wait function.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nA thread that owns a mutex object can wait repeatedly for the same mutex object to become signaled without its execution becoming blocked. A thread that waits repeatedly for the same semaphore object, however, decrements the semaphore's count each time a wait operation is completed; the thread is blocked when the count gets to zero. Similarly, only the thread that owns a mutex can successfully call the ReleaseMutex function, though any thread can use ReleaseSemaphore to increase the count of a semaphore object.\n\nQuestion: May a thread acquire the same mutex twice?", "retrieved": ["mutex-objects", "semaphore-objects"]}
|
| 25 |
+
{"id": "adef7ffbc7186548", "split": "train", "passage": "semaphore-objects", "condition": "closed", "question": "Why did the semaphore become nonsignaled after the last available permit was taken?", "answer": "A successful wait decrements the count. At zero the semaphore is nonsignaled until a release increases the count.", "prompt": "Answer the Windows question concisely.\nQuestion: Why did the semaphore become nonsignaled after the last available permit was taken?", "retrieved": []}
|
| 26 |
+
{"id": "adef7ffbc7186548", "split": "train", "passage": "semaphore-objects", "condition": "rag", "question": "Why did the semaphore become nonsignaled after the last available permit was taken?", "answer": "A successful wait decrements the count. At zero the semaphore is nonsignaled until a release increases the count. [Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nA *semaphore object* is a synchronization object that maintains a count between zero and a specified maximum value. The count is decremented each time a thread completes a wait for the semaphore object and incremented each time a thread releases the semaphore. When the count reaches zero, no more threads can successfully wait for the semaphore object state to become signaled. The state of a semaphore is set to signaled when its count is greater than zero, and nonsignaled when its count is zero.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nIf several processes share a page, removing the page from the working set of one process does not affect other processes. After a page is removed from the working sets of all processes that were using it, the page becomes a *transition page*. Transition pages remain cached in RAM until the page is either referenced again by some process or repurposed (for example, filled with zeros and given to another process). If a transition page has been modified since it was last written to disk (that is, if the page is \"dirty\"), then the page must be written to its backing store before it can be repurposed. The system may start writing dirty transition pages to their backing store as soon as such pages become\n\nQuestion: Why did the semaphore become nonsignaled after the last available permit was taken?", "retrieved": ["semaphore-objects", "working-set"]}
|
| 27 |
+
{"id": "ab0c352f8d26d689", "split": "train", "passage": "semaphore-objects", "condition": "closed", "question": "Can I assume Windows semaphore waiters get permits in arrival order?", "answer": "No. Waiting threads are selected without a guaranteed first-in, first-out order.", "prompt": "Answer the Windows question concisely.\nQuestion: Can I assume Windows semaphore waiters get permits in arrival order?", "retrieved": []}
|
| 28 |
+
{"id": "ab0c352f8d26d689", "split": "train", "passage": "semaphore-objects", "condition": "rag", "question": "Can I assume Windows semaphore waiters get permits in arrival order?", "answer": "No. Waiting threads are selected without a guaranteed first-in, first-out order. [Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nIf more than one thread is waiting on a semaphore, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order. Each time one of the wait functions returns because the state of a semaphore was set to signaled, the count of the semaphore is decreased by one. The ReleaseSemaphore function increases a semaphore's count by a specified amount. The count can never be less than zero or greater than the maximum value.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nIf more than one thread is waiting on a mutex, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order. After a thread obtains ownership of a mutex, it can specify the same mutex in repeated calls to the wait-functions without blocking its execution. This prevents a thread from deadlocking itself while waiting for a mutex that it already owns. To release its ownership under such circumstances, the thread must call ReleaseMutex once for each time that the mutex satisfied the conditions of a wait function.\n\nQuestion: Can I assume Windows semaphore waiters get permits in arrival order?", "retrieved": ["semaphore-objects", "mutex-objects"]}
|
| 29 |
+
{"id": "07fab401e0635f69", "split": "train", "passage": "critical-section-objects", "condition": "closed", "question": "Can two separate processes share a Windows critical section for mutual exclusion?", "answer": "A critical section coordinates threads within one process. A mutex can coordinate threads in different processes.", "prompt": "Answer the Windows question concisely.\nQuestion: Can two separate processes share a Windows critical section for mutual exclusion?", "retrieved": []}
|
| 30 |
+
{"id": "07fab401e0635f69", "split": "train", "passage": "critical-section-objects", "condition": "rag", "question": "Can two separate processes share a Windows critical section for mutual exclusion?", "answer": "A critical section coordinates threads within one process. A mutex can coordinate threads in different processes. [Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)\nA *critical section object* provides synchronization similar to that provided by a mutex object, except that a critical section can be used only by the threads of a single process. Critical section objects cannot be shared across processes. Event, mutex, and semaphore objects can also be used in a single-process application, but critical section objects provide a slightly faster, more efficient mechanism for mutual-exclusion synchronization (a processor-specific test and set instruction). Like a mutex object, a critical section object can be owned by only one thread at a time, which makes it useful for protecting a shared resource from simultaneous access. Unlike a mutex object, there is no way to tell whether a critical section has been abandoned.\n\n[Mutex Objects](https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects)\nA *mutex object* is a synchronization object whose state is set to signaled when it is not owned by any thread, and nonsignaled when it is owned. Only one thread at a time can own a mutex object, whose name comes from the fact that it is useful in coordinating mutually exclusive access to a shared resource. For example, to prevent two threads from writing to shared memory at the same time, each thread waits for ownership of a mutex object before executing the code that accesses the memory. After writing to the shared memory, the thread releases the mutex object.\n\nQuestion: Can two separate processes share a Windows critical section for mutual exclusion?", "retrieved": ["critical-section-objects", "mutex-objects"]}
|
| 31 |
+
{"id": "a4a125c48a499822", "split": "train", "passage": "critical-section-objects", "condition": "closed", "question": "May a thread reenter a critical section it already owns?", "answer": "Yes. It must leave once for each successful entry before another thread can acquire it.", "prompt": "Answer the Windows question concisely.\nQuestion: May a thread reenter a critical section it already owns?", "retrieved": []}
|
| 32 |
+
{"id": "a4a125c48a499822", "split": "train", "passage": "critical-section-objects", "condition": "rag", "question": "May a thread reenter a critical section it already owns?", "answer": "Yes. It must leave once for each successful entry before another thread can acquire it. [Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Critical Section Objects](https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects)\nWhen a thread owns a critical section, it can make additional calls to EnterCriticalSection or TryEnterCriticalSection without blocking its execution. This prevents a thread from deadlocking itself while waiting for a critical section that it already owns. To release its ownership, the thread must call LeaveCriticalSection one time for each time that it entered the critical section. There is no guarantee about the order in which waiting threads will acquire ownership of the critical section.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nto block the execution of the waiting high-priority thread. To do this, use a wait function, critical section, or the Sleep function, SleepEx, or SwitchToThread function. This is preferable to having the thread execute a loop. Otherwise, the process may become deadlocked, because the thread with lower priority is never scheduled. To determine the current priority level of a thread, use the GetThreadPriority function. The process priority class and thread priority level are combined to form the base priority of each thread.\n\nQuestion: May a thread reenter a critical section it already owns?", "retrieved": ["critical-section-objects", "scheduling-priorities"]}
|
| 33 |
+
{"id": "73f578a54803cb1f", "split": "train", "passage": "working-set", "condition": "closed", "question": "What does a process working set count?", "answer": "It consists of the pageable virtual-memory pages currently resident in physical memory for the process.", "prompt": "Answer the Windows question concisely.\nQuestion: What does a process working set count?", "retrieved": []}
|
| 34 |
+
{"id": "73f578a54803cb1f", "split": "train", "passage": "working-set", "condition": "rag", "question": "What does a process working set count?", "answer": "It consists of the pageable virtual-memory pages currently resident in physical memory for the process. [Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\navailable. Each process has a minimum and maximum working set size that affect the virtual memory paging behavior of the process. To obtain the current size of the working set of a specified process, use the GetProcessMemoryInfo function. To obtain or change the minimum and maximum working set sizes, use the GetProcessWorkingSetSizeEx and SetProcessWorkingSetSizeEx functions. The process status application programming interface (PSAPI) provides a number of functions that return detailed information about the working set of a process. For details, see Working Set Information.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nThe initial count of a semaphore is typically set to the maximum value. The count is then decremented from that level as the protected resource is consumed. Alternatively, you can create a semaphore with an initial count of zero to block access to the protected resource while the application is being initialized. After initialization, you can use ReleaseSemaphore to increment the count to the maximum value.\n\nQuestion: What does a process working set count?", "retrieved": ["working-set", "semaphore-objects"]}
|
| 35 |
+
{"id": "5886e023585c0938", "split": "train", "passage": "working-set", "condition": "closed", "question": "Does every fault for a page outside the working set require a disk read?", "answer": "No. A soft fault can be resolved without reading backing storage. A hard fault requires reading the page from backing storage.", "prompt": "Answer the Windows question concisely.\nQuestion: Does every fault for a page outside the working set require a disk read?", "retrieved": []}
|
| 36 |
+
{"id": "5886e023585c0938", "split": "train", "passage": "working-set", "condition": "rag", "question": "Does every fault for a page outside the working set require a disk read?", "answer": "No. A soft fault can be resolved without reading backing storage. A hard fault requires reading the page from backing storage. [Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nA *hard page fault* must be resolved by reading page contents from the page's *backing store*, which is either the system paging file or a memory-mapped file created by the process. A *soft page fault* can be resolved without accessing the backing store. A soft page fault occurs when: - The page is in the working set of some other process, so it is already resident in memory. - The page is in transition, because it either has been removed from the working sets of all processes that were using the page and has not yet been repurposed, or it is already resident as a result of a memory manager prefetch operation. - A process references an allocated virtual page for the first time (sometimes\n\n[Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)\nphysical storage associated with it. It is available to be committed. <br/> A process can use the VirtualAlloc or VirtualAllocEx function to reserve pages of its address space and later to commit the reserved pages. It can use VirtualFree or VirtualFreeEx to decommit committed pages and return them to the reserved state.<br/> | | Committed | Memory charges have been allocated from the overall size of RAM and paging files on disk. The page is accessible and access is controlled by one of the memory protection constants. The system initializes and loads each committed page into physical memory only during the first attempt to read or write to that page. When the process terminates, the system releases the storage for committed pages. <br/> A process\n\nQuestion: Does every fault for a page outside the working set require a disk read?", "retrieved": ["working-set", "page-state"]}
|
| 37 |
+
{"id": "337696dff8cfe026", "split": "train", "passage": "page-state", "condition": "closed", "question": "Can my application write to an address range immediately after reserving it?", "answer": "Reservation sets aside virtual address space. The pages must be committed with suitable protection before they can be used.", "prompt": "Answer the Windows question concisely.\nQuestion: Can my application write to an address range immediately after reserving it?", "retrieved": []}
|
| 38 |
+
{"id": "337696dff8cfe026", "split": "train", "passage": "page-state", "condition": "rag", "question": "Can my application write to an address range immediately after reserving it?", "answer": "Reservation sets aside virtual address space. The pages must be committed with suitable protection before they can be used. [Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)\nThe pages of a process's virtual address space can be in one of the following states. | State | Description | |-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Free | The page is neither committed nor reserved. The page is not accessible to the process. It is available to be reserved, committed, or simultaneously reserved and committed. Attempting to read from or write to a free page results in an access violation exception. <br/> A process can use the VirtualFree or VirtualFreeEx function to release reserved or committed pages of its address space, returning them to the free state.<br/> | | Reserved | The page has been reserved for future use. The range of addresses cannot be used by other allocation functions. The page is not accessible and has no\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nHandles to directory objects are obtained by calling the CreateFile function with the FILE\\_FLAG\\_BACKUP\\_SEMANTICS attribute. Directory handles are almost never used—backup applications are one of the few applications that will typically use them. After opening the file object for asynchronous I/O, an OVERLAPPED structure must be properly created, initialized, and passed into each call to functions such as ReadFile and WriteFile. Keep the following in mind when using the OVERLAPPED structure in asynchronous read and write operations:\n\nQuestion: Can my application write to an address range immediately after reserving it?", "retrieved": ["page-state", "synchronous-and-asynchronous-i-o"]}
|
| 39 |
+
{"id": "7cd0368a0d148c67", "split": "train", "passage": "page-state", "condition": "closed", "question": "Does reserving virtual addresses reserve physical RAM for every page?", "answer": "No. Reservation sets aside addresses without allocating physical storage for the range.", "prompt": "Answer the Windows question concisely.\nQuestion: Does reserving virtual addresses reserve physical RAM for every page?", "retrieved": []}
|
| 40 |
+
{"id": "7cd0368a0d148c67", "split": "train", "passage": "page-state", "condition": "rag", "question": "Does reserving virtual addresses reserve physical RAM for every page?", "answer": "No. Reservation sets aside addresses without allocating physical storage for the range. [Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)\nphysical storage associated with it. It is available to be committed. <br/> A process can use the VirtualAlloc or VirtualAllocEx function to reserve pages of its address space and later to commit the reserved pages. It can use VirtualFree or VirtualFreeEx to decommit committed pages and return them to the reserved state.<br/> | | Committed | Memory charges have been allocated from the overall size of RAM and paging files on disk. The page is accessible and access is controlled by one of the memory protection constants. The system initializes and loads each committed page into physical memory only during the first attempt to read or write to that page. When the process terminates, the system releases the storage for committed pages. <br/> A process\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nThe working set of a process is the set of pages in the virtual address space of the process that are currently resident in physical memory. The working set contains only pageable memory allocations; nonpageable memory allocations such as Address Windowing Extensions (AWE) or large page allocations are not included in the working set. When a process references pageable memory that is not currently in its working set, a *page fault* occurs. The system page fault handler attempts to resolve the page fault and, if it succeeds, the page is added to the working set. (Accessing AWE or large page allocations never causes a page fault, because these allocations are not pageable.)\n\nQuestion: Does reserving virtual addresses reserve physical RAM for every page?", "retrieved": ["page-state", "working-set"]}
|
| 41 |
+
{"id": "0535c31f8d60ce73", "split": "train", "passage": "file-mapping", "condition": "closed", "question": "How does a process access a chosen portion of a file through memory mapping?", "answer": "Create or open a file-mapping object and map a view of the desired portion into the process address space.", "prompt": "Answer the Windows question concisely.\nQuestion: How does a process access a chosen portion of a file through memory mapping?", "retrieved": []}
|
| 42 |
+
{"id": "0535c31f8d60ce73", "split": "train", "passage": "file-mapping", "condition": "rag", "question": "How does a process access a chosen portion of a file through memory mapping?", "answer": "Create or open a file-mapping object and map a view of the desired portion into the process address space. [File Mapping](https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[File Mapping](https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping)\n*File mapping* is the association of a file's contents with a portion of the virtual address space of a process. The system creates a *file mapping object* (also known as a *section object*) to maintain this association. A *file view* is the portion of virtual address space that a process uses to access the file's contents. File mapping allows the process to use both random input and output (I/O) and sequential I/O. It also allows the process to work efficiently with a large data file, such as a database, without having to map the whole file into memory. Multiple processes can also use memory-mapped files to share data.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nA *hard page fault* must be resolved by reading page contents from the page's *backing store*, which is either the system paging file or a memory-mapped file created by the process. A *soft page fault* can be resolved without accessing the backing store. A soft page fault occurs when: - The page is in the working set of some other process, so it is already resident in memory. - The page is in transition, because it either has been removed from the working sets of all processes that were using the page and has not yet been repurposed, or it is already resident as a result of a memory manager prefetch operation. - A process references an allocated virtual page for the first time (sometimes\n\nQuestion: How does a process access a chosen portion of a file through memory mapping?", "retrieved": ["file-mapping", "working-set"]}
|
| 43 |
+
{"id": "4986e6425377db21", "split": "train", "passage": "file-mapping", "condition": "closed", "question": "Can multiple processes view the same data through one file-mapping object?", "answer": "Yes. Each process maps its own view of the shared mapping into its address space.", "prompt": "Answer the Windows question concisely.\nQuestion: Can multiple processes view the same data through one file-mapping object?", "retrieved": []}
|
| 44 |
+
{"id": "4986e6425377db21", "split": "train", "passage": "file-mapping", "condition": "rag", "question": "Can multiple processes view the same data through one file-mapping object?", "answer": "Yes. Each process maps its own view of the shared mapping into its address space. [File Mapping](https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[File Mapping](https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping)\nA file view can consist of all or only part of the file mapping object. A process manipulates the file through the file views. A process can create multiple views for a file mapping object. The file views created by each process reside in the virtual address space of that process. When the process needs data from a portion of the file other than what is in the current file view, it can unmap the current file view, then create a new file view.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\ncalled a *demand-zero fault*). Pages can be removed from a process working set as a result of the following actions: - The process reduces or empties the working set by calling the SetProcessWorkingSetSize, SetProcessWorkingSetSizeEx or EmptyWorkingSet function. - The process calls the VirtualUnlock function on a memory range that is not locked. - The process unmaps a mapped view of a file using the UnmapViewOfFile function. - The memory manager trims pages from the working set to create more available memory. - The memory manager must remove a page from the working set to make room for a new page (for example, because the working set is at its maximum size).\n\nQuestion: Can multiple processes view the same data through one file-mapping object?", "retrieved": ["file-mapping", "working-set"]}
|
| 45 |
+
{"id": "b8230e8f33f93be2", "split": "train", "passage": "synchronous-and-asynchronous-i-o", "condition": "closed", "question": "What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle?", "answer": "It opens the handle for overlapped I/O. The caller supplies a separate OVERLAPPED structure for each outstanding operation.", "prompt": "Answer the Windows question concisely.\nQuestion: What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle?", "retrieved": []}
|
| 46 |
+
{"id": "b8230e8f33f93be2", "split": "train", "passage": "synchronous-and-asynchronous-i-o", "condition": "rag", "question": "What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle?", "answer": "It opens the handle for overlapped I/O. The caller supplies a separate OVERLAPPED structure for each outstanding operation. [Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nA process opens a file for asynchronous I/O in its call to CreateFile by specifying the FILE\\_FLAG\\_OVERLAPPED flag in the *dwFlagsAndAttributes* parameter. If FILE\\_FLAG\\_OVERLAPPED is not specified, the file is opened for synchronous I/O. When the file has been opened for asynchronous I/O, a pointer to an OVERLAPPED structure is passed into the call to ReadFile and WriteFile. When performing synchronous I/O, this structure is not required in calls to ReadFile and WriteFile.\n\nQuestion: What does FILE_FLAG_OVERLAPPED tell Windows about I/O on a file handle?", "retrieved": ["synchronous-and-asynchronous-i-o"]}
|
| 47 |
+
{"id": "a1e6774ce4d5ae00", "split": "train", "passage": "synchronous-and-asynchronous-i-o", "condition": "closed", "question": "Does an asynchronous file operation always finish after the initiating call returns?", "answer": "No. An overlapped operation can complete immediately or remain pending. The caller must handle either result.", "prompt": "Answer the Windows question concisely.\nQuestion: Does an asynchronous file operation always finish after the initiating call returns?", "retrieved": []}
|
| 48 |
+
{"id": "a1e6774ce4d5ae00", "split": "train", "passage": "synchronous-and-asynchronous-i-o", "condition": "rag", "question": "Does an asynchronous file operation always finish after the initiating call returns?", "answer": "No. An overlapped operation can complete immediately or remain pending. The caller must handle either result. [Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nHandles to directory objects are obtained by calling the CreateFile function with the FILE\\_FLAG\\_BACKUP\\_SEMANTICS attribute. Directory handles are almost never used—backup applications are one of the few applications that will typically use them. After opening the file object for asynchronous I/O, an OVERLAPPED structure must be properly created, initialized, and passed into each call to functions such as ReadFile and WriteFile. Keep the following in mind when using the OVERLAPPED structure in asynchronous read and write operations:\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\n- The driver is performing a completely synchronous I/O request. That is, no driver queues any operations while handling the I/O request, and no driver returns until the driver below it has finished handling the request. Additionally, a driver cannot enter a wait state if it is executing at or above IRQL equal to DISPATCH_LEVEL. Based on these limitations, you must use the following rules:\n\nQuestion: Does an asynchronous file operation always finish after the initiating call returns?", "retrieved": ["synchronous-and-asynchronous-i-o", "introduction-to-kernel-dispatcher-objects"]}
|
| 49 |
+
{"id": "f9ca8e570dc1123e", "split": "train", "passage": "introduction-to-kernel-dispatcher-objects", "condition": "closed", "question": "What do waitable kernel dispatcher objects have in common?", "answer": "They have a signaled or nonsignaled state that the kernel uses when satisfying waits.", "prompt": "Answer the Windows question concisely.\nQuestion: What do waitable kernel dispatcher objects have in common?", "retrieved": []}
|
| 50 |
+
{"id": "f9ca8e570dc1123e", "split": "train", "passage": "introduction-to-kernel-dispatcher-objects", "condition": "rag", "question": "What do waitable kernel dispatcher objects have in common?", "answer": "They have a signaled or nonsignaled state that the kernel uses when satisfying waits. [Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Introduction to Kernel Dispatcher Objects](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects)\nThe kernel defines a set of object types called *kernel dispatcher objects*, or just *dispatcher objects*. Dispatcher objects include timer objects, event objects, semaphore objects, mutex objects, and thread objects. Drivers can use dispatcher objects as synchronization mechanisms within a nonarbitrary thread context while executing at IRQL equal to PASSIVE_LEVEL. Every kernel-defined dispatcher object type has a state that is either set to Signaled or set to Not-Signaled.\n\nQuestion: What do waitable kernel dispatcher objects have in common?", "retrieved": ["introduction-to-kernel-dispatcher-objects"]}
|
| 51 |
+
{"id": "a3ebd8f64a063794", "split": "train", "passage": "introduction-to-kernel-dispatcher-objects", "condition": "closed", "question": "Does satisfying a kernel wait guarantee that the thread starts executing immediately?", "answer": "It makes the thread eligible to run. Actual execution depends on scheduling.", "prompt": "Answer the Windows question concisely.\nQuestion: Does satisfying a kernel wait guarantee that the thread starts executing immediately?", "retrieved": []}
|
| 52 |
+
{"id": "a3ebd8f64a063794", "split": "train", "passage": "introduction-to-kernel-dispatcher-objects", "condition": "rag", "question": "Does satisfying a kernel wait guarantee that the thread starts executing immediately?", "answer": "The retrieved references do not establish that. I need a source on introduction to kernel dispatcher objects.", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Synchronous and asynchronous I/O](https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o)\nAlso see I/O-related sample applications. There are two types of input/output (I/O) synchronization: synchronous I/O and asynchronous I/O. Asynchronous I/O is also referred to as overlapped I/O. In *synchronous file I/O*, a thread starts an I/O operation and immediately enters a wait state until the I/O request has completed. A thread performing *asynchronous file I/O* sends an I/O request to the kernel by calling an appropriate function. If the request is accepted by the kernel, the calling thread continues processing another job until the kernel signals to the thread that the I/O operation is complete. It then interrupts its current job and processes the data from the I/O operation as necessary.\n\nQuestion: Does satisfying a kernel wait guarantee that the thread starts executing immediately?", "retrieved": ["synchronous-and-asynchronous-i-o"]}
|
| 53 |
+
{"id": "6aa2ffae5d1dbd2e", "split": "train", "passage": "semaphore-objects", "condition": "closed", "question": "From the Windows semaphore rules, how many permits does my application's semaphore have right now?", "answer": "The rules explain how the count changes. Determining your live count requires information about that semaphore and its operations.", "prompt": "Answer the Windows question concisely.\nQuestion: From the Windows semaphore rules, how many permits does my application's semaphore have right now?", "retrieved": []}
|
| 54 |
+
{"id": "6aa2ffae5d1dbd2e", "split": "train", "passage": "semaphore-objects", "condition": "rag", "question": "From the Windows semaphore rules, how many permits does my application's semaphore have right now?", "answer": "The rules explain how the count changes. Determining your live count requires information about that semaphore and its operations. [Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Semaphore Objects](https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects)\nThe semaphore object is useful in controlling a shared resource that can support a limited number of users. It acts as a gate that limits the number of threads sharing the resource to a specified maximum number. For example, an application might place a limit on the number of windows that it creates. It uses a semaphore with a maximum count equal to the window limit, decrementing the count whenever a window is created and incrementing it whenever a window is closed. The application specifies the semaphore object in call to one of the wait functions before each window is created. When the count is zero—indicating that the window limit has been reached—the wait function blocks execution of the window-creation code.\n\nQuestion: From the Windows semaphore rules, how many permits does my application's semaphore have right now?", "retrieved": ["semaphore-objects"]}
|
| 55 |
+
{"id": "04541a599391cc1c", "split": "train", "passage": "job-objects", "condition": "closed", "question": "What exact memory cap has my service assigned to its job object?", "answer": "The reference describes available job limits. The actual cap depends on the job's configured limits.", "prompt": "Answer the Windows question concisely.\nQuestion: What exact memory cap has my service assigned to its job object?", "retrieved": []}
|
| 56 |
+
{"id": "04541a599391cc1c", "split": "train", "passage": "job-objects", "condition": "rag", "question": "What exact memory cap has my service assigned to its job object?", "answer": "The reference describes available job limits. The actual cap depends on the job's configured limits. [Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)\nTo close a job object handle, use the CloseHandle function. The job is destroyed when its last handle has been closed and all associated processes have been terminated. However, if the job has the JOB\\_OBJECT\\_LIMIT\\_KILL\\_ON\\_JOB\\_CLOSE flag specified, closing the last job object handle terminates all associated processes and then destroys the job object itself. If a nested job has the JOB\\_OBJECT\\_LIMIT\\_KILL\\_ON\\_JOB\\_CLOSE flag specified, closing the last job object handle terminates all processes associated with the job and its child jobs in the hierarchy.\n\n[Scheduling Priorities](https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities)\nThreads are scheduled to run based on their *scheduling priority*. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.) The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread becomes available to run, the system\n\nQuestion: What exact memory cap has my service assigned to its job object?", "retrieved": ["job-objects", "scheduling-priorities"]}
|
| 57 |
+
{"id": "14c29e15a357c5ed", "split": "train", "passage": "working-set", "condition": "closed", "question": "How many pages are in my process working set at this moment?", "answer": "The reference defines a working set. Answering for your process requires a current measurement.", "prompt": "Answer the Windows question concisely.\nQuestion: How many pages are in my process working set at this moment?", "retrieved": []}
|
| 58 |
+
{"id": "14c29e15a357c5ed", "split": "train", "passage": "working-set", "condition": "rag", "question": "How many pages are in my process working set at this moment?", "answer": "The reference defines a working set. Answering for your process requires a current measurement. [Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)", "prompt": "Answer the Windows question concisely. Use the applicable reference and cite its link. If the references do not establish the answer, identify the missing information.\n\n[Working Set](https://learn.microsoft.com/en-us/windows/win32/memory/working-set)\nThe working set of a process is the set of pages in the virtual address space of the process that are currently resident in physical memory. The working set contains only pageable memory allocations; nonpageable memory allocations such as Address Windowing Extensions (AWE) or large page allocations are not included in the working set. When a process references pageable memory that is not currently in its working set, a *page fault* occurs. The system page fault handler attempts to resolve the page fault and, if it succeeds, the page is added to the working set. (Accessing AWE or large page allocations never causes a page fault, because these allocations are not pageable.)\n\n[Page State](https://learn.microsoft.com/en-us/windows/win32/memory/page-state)\ncan use VirtualAlloc or VirtualAllocEx to commit physical pages from a reserved region. They can also simultaneously reserve and commit pages.<br/> The GlobalAlloc and LocalAlloc functions allocate committed pages with read/write access.<br/> |\n\nQuestion: How many pages are in my process working set at this moment?", "retrieved": ["working-set", "page-state"]}
|
gpuless_provenance.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "gpuless.peft-export/v1",
|
| 3 |
+
"native_sha256": "9ff1d164bafe7ff35c3a68dc223541c865884dc48a995e6360b6b16a22e3a644",
|
| 4 |
+
"model_id": "qwennifer-flash",
|
| 5 |
+
"model_revision": "93d418ec79ac09b75b11b995055cb3f3114d2df96cb25a560e7c3d8341cb0077",
|
| 6 |
+
"target_count": 1,
|
| 7 |
+
"targets": [
|
| 8 |
+
{
|
| 9 |
+
"model_id": "qwennifer-flash",
|
| 10 |
+
"model_revision": "93d418ec79ac09b75b11b995055cb3f3114d2df96cb25a560e7c3d8341cb0077",
|
| 11 |
+
"target_name": "lm_head",
|
| 12 |
+
"rank": 4,
|
| 13 |
+
"in_features": 2048,
|
| 14 |
+
"out_features": 151936,
|
| 15 |
+
"generation": 0,
|
| 16 |
+
"step": 0,
|
| 17 |
+
"alpha": 4.0,
|
| 18 |
+
"scale": 1.0,
|
| 19 |
+
"a_elements": 8192,
|
| 20 |
+
"b_elements": 607744,
|
| 21 |
+
"sha256": "9ff1d164bafe7ff35c3a68dc223541c865884dc48a995e6360b6b16a22e3a644"
|
| 22 |
+
}
|
| 23 |
+
],
|
| 24 |
+
"requires_original_base_model": true
|
| 25 |
+
}
|
release.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "cybermodels-windows",
|
| 3 |
+
"version": "0.1",
|
| 4 |
+
"base": "Qwen/Qwen3-Coder-Next",
|
| 5 |
+
"upstream_revision": "a7fbcb5c0e12d62a448eaa0e260346bf5dcc0feb",
|
| 6 |
+
"base_revision": "93d418ec79ac09b75b11b995055cb3f3114d2df96cb25a560e7c3d8341cb0077",
|
| 7 |
+
"experts_per_token": 6,
|
| 8 |
+
"training_recipe": "GPUless rank-4 lm_head",
|
| 9 |
+
"sha256": {
|
| 10 |
+
"adapter_model.safetensors": "7f161a35e82e3edf364e69736e673334de469eaa4fd9a0e1cc8b4ccfefa16955",
|
| 11 |
+
"adapter_config.json": "6c3ee1dbe41073d730d0a3fa094d9a222bbed42de0a1a5db172f0011769f0b77",
|
| 12 |
+
"windows.sqlite": "ec36f2cd13038441beb5479be561a2028745e1e8f8b6b6ad414dfa0d13d96032",
|
| 13 |
+
"data/train.jsonl": "aa9bb2aca3d62756888f5693ae52d3d59064a1f1bfd0ec1c80caedabfb440899",
|
| 14 |
+
"data/eval.jsonl": "f120445e8bf9eb0a8c56eee027a8073d2df6ea8e578854549a24fd05eb76f636",
|
| 15 |
+
"data/examples.jsonl": "e562a828fef5418e194728b34552dde77d5d8021782eb5693a656bb2792b987c",
|
| 16 |
+
"runtime/reference.py": "045d315cf5f5e9220170203c15efcb1cef27d67791e169293d085fb7711dfe78",
|
| 17 |
+
"runtime/serve_windows.py": "6b29284f4c30072baac9893544123f58695847110eea22adea136a8b3ff39628",
|
| 18 |
+
"sources.json": "32708d7b48a182440cb7c3c89ef4162dfa4b6f3989fe8b7514cc40b6f3d9d11b"
|
| 19 |
+
}
|
| 20 |
+
}
|
runtime/flash_revision.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Fingerprint the prepared weights and packed Flash runner used by a head adapter."""
|
| 2 |
+
|
| 3 |
+
import hashlib
|
| 4 |
+
import inspect
|
| 5 |
+
import json
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
from belikewater_transformers.lib.execution.moe_cuda_graph import Qwen3NextGraphRunner
|
| 9 |
+
from belikewater_transformers.lib.execution.moe_mxfp4_bank import MoeMxfp4Bank
|
| 10 |
+
from belikewater_transformers.models.qwennifer.flash_serving import _load_spine_model
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def packed_revision(inputs):
|
| 14 |
+
components = {
|
| 15 |
+
"source_revision": json.loads(
|
| 16 |
+
(inputs / "prepared/checkpoint.json").read_text()
|
| 17 |
+
)["source_revision"],
|
| 18 |
+
"prepared_identity": json.loads(
|
| 19 |
+
(inputs / "prepared/checkpoint.json").read_text()
|
| 20 |
+
)["identity"],
|
| 21 |
+
"packed_identity": json.loads((inputs / "packed/manifest.json").read_text())[
|
| 22 |
+
"identity"
|
| 23 |
+
],
|
| 24 |
+
"top_k": 6,
|
| 25 |
+
"pack_spine": True,
|
| 26 |
+
"runtime_sources": {
|
| 27 |
+
item.__name__: hashlib.sha256(
|
| 28 |
+
Path(inspect.getfile(item)).read_bytes()
|
| 29 |
+
).hexdigest()
|
| 30 |
+
for item in (_load_spine_model, Qwen3NextGraphRunner, MoeMxfp4Bank)
|
| 31 |
+
},
|
| 32 |
+
}
|
| 33 |
+
return hashlib.sha256(json.dumps(components, sort_keys=True).encode()).hexdigest()
|
runtime/reference.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Bounded, offline retrieval for Windows Cybermodels."""
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
import sqlite3
|
| 5 |
+
from contextlib import closing
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
STOP = frozenset(
|
| 9 |
+
"""a an and are as at be by can could did do does for from how i if in is it its my of on one or
|
| 10 |
+
should tell that the their there these this to use was what when where which why will windows with would""".split()
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def retrieve(database: Path, question: str):
|
| 15 |
+
words = dict.fromkeys(
|
| 16 |
+
t
|
| 17 |
+
for t in re.findall(r"[a-z0-9_]+", question.lower())
|
| 18 |
+
if t not in STOP and len(t) > 1
|
| 19 |
+
)
|
| 20 |
+
if not words:
|
| 21 |
+
return []
|
| 22 |
+
query = " OR ".join(f'"{term}"' for term in list(words)[:64])
|
| 23 |
+
with closing(
|
| 24 |
+
sqlite3.connect(database.resolve().as_uri() + "?mode=ro", uri=True)
|
| 25 |
+
) as db:
|
| 26 |
+
rows = db.execute(
|
| 27 |
+
"SELECT title, body, url, source FROM passages WHERE passages MATCH ? "
|
| 28 |
+
"ORDER BY bm25(passages, 3, 1, 0, 0), rowid LIMIT 10",
|
| 29 |
+
(query,),
|
| 30 |
+
)
|
| 31 |
+
hits = []
|
| 32 |
+
for title, body, url, source in rows:
|
| 33 |
+
if any(hit["id"] == source for hit in hits):
|
| 34 |
+
continue
|
| 35 |
+
hits.append(dict(id=source, title=title, body=body, url=url))
|
| 36 |
+
if len(hits) == 2:
|
| 37 |
+
break
|
| 38 |
+
return hits
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def evidence_prompt(question, hits):
|
| 42 |
+
evidence = "\n\n".join(f"[{h['title']}]({h['url']})\n{h['body']}" for h in hits)
|
| 43 |
+
return (
|
| 44 |
+
"Answer the Windows question concisely. Use the applicable reference and cite its link. "
|
| 45 |
+
"If the references do not establish the answer, identify the missing information.\n\n"
|
| 46 |
+
+ (evidence or "(No matching reference.)")
|
| 47 |
+
+ "\n\nQuestion: "
|
| 48 |
+
+ question
|
| 49 |
+
)
|
runtime/serve_windows.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Serve the Windows PEFT adapter and local reference pack through the Flash HTTP worker."""
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import hashlib
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
import uvicorn
|
| 10 |
+
from belikewater_transformers.http_server import create_app
|
| 11 |
+
from belikewater_transformers.models.qwennifer.flash_serving import QwenniferFlashModel
|
| 12 |
+
from flash_revision import packed_revision
|
| 13 |
+
from reference import evidence_prompt, retrieve
|
| 14 |
+
from safetensors.torch import load_file
|
| 15 |
+
|
| 16 |
+
MODEL_ID = "cybermodels-windows"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class WindowsFlash(QwenniferFlashModel):
|
| 20 |
+
def prepare_chat_messages(self, conversation):
|
| 21 |
+
for message in reversed(conversation):
|
| 22 |
+
if message["role"] == "user":
|
| 23 |
+
question = message["content"]
|
| 24 |
+
hits = retrieve(self.reference_pack, question)
|
| 25 |
+
message["content"] = evidence_prompt(question, hits)
|
| 26 |
+
break
|
| 27 |
+
return conversation
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def configure_adapter(path, revision):
|
| 31 |
+
cfg = json.loads((path / "adapter_config.json").read_text())
|
| 32 |
+
provenance = json.loads((path / "gpuless_provenance.json").read_text())
|
| 33 |
+
if (
|
| 34 |
+
provenance["model_revision"] != revision
|
| 35 |
+
or cfg["target_modules"] != ["lm_head"]
|
| 36 |
+
or cfg.get("use_dora")
|
| 37 |
+
or cfg.get("use_rslora")
|
| 38 |
+
or cfg.get("bias") != "none"
|
| 39 |
+
):
|
| 40 |
+
raise ValueError(
|
| 41 |
+
"expected an ordinary head adapter for this packed Flash release"
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
def configure(model):
|
| 45 |
+
weights = load_file(str(path / "adapter_model.safetensors"), device="cuda:0")
|
| 46 |
+
a = weights["base_model.model.lm_head.lora_A.weight"]
|
| 47 |
+
b = weights["base_model.model.lm_head.lora_B.weight"]
|
| 48 |
+
# Only 256 output rows of this expanded PEFT adapter have nonzero deltas.
|
| 49 |
+
# The row selection is done once before CUDA graph capture.
|
| 50 |
+
rows = b.any(dim=1).nonzero().flatten()
|
| 51 |
+
compact = b.index_select(0, rows).T.contiguous()
|
| 52 |
+
scale = cfg["lora_alpha"] / cfg["r"]
|
| 53 |
+
|
| 54 |
+
def add_delta(_head, inputs, output):
|
| 55 |
+
logits = output.float()
|
| 56 |
+
delta = ((inputs[0].float() @ a.T) @ compact) * scale
|
| 57 |
+
return logits.index_add(-1, rows, delta)
|
| 58 |
+
|
| 59 |
+
model.lm_head.register_forward_hook(add_delta)
|
| 60 |
+
|
| 61 |
+
return configure
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def main(config_path):
|
| 65 |
+
cfg = json.loads(config_path.read_text())
|
| 66 |
+
settings = cfg["settings"]
|
| 67 |
+
root = Path(settings["assets"])
|
| 68 |
+
inputs = Path(settings["inputs"])
|
| 69 |
+
metadata = json.loads((root / "release.json").read_text())
|
| 70 |
+
fingerprint = hashlib.sha256((root / "release.json").read_bytes()).hexdigest()
|
| 71 |
+
if metadata["base_revision"] != packed_revision(inputs):
|
| 72 |
+
raise ValueError("installed Flash base does not match the Windows adapter")
|
| 73 |
+
token = Path(cfg["token_file"]).read_text().strip()
|
| 74 |
+
if not token or os.environ.get("CUDA_VISIBLE_DEVICES") != cfg["gpus"][0]:
|
| 75 |
+
raise RuntimeError("serving requires the assigned device and worker credential")
|
| 76 |
+
model = WindowsFlash(
|
| 77 |
+
inputs_dir=inputs,
|
| 78 |
+
flat_cache=Path(settings["flat_cache"]),
|
| 79 |
+
hot_experts_file=Path(settings["hot_experts_file"]),
|
| 80 |
+
configure_head=configure_adapter(root, metadata["base_revision"]),
|
| 81 |
+
map_flat_cache=True,
|
| 82 |
+
cache_slots=settings["cache_slots"],
|
| 83 |
+
max_context_tokens=settings["max_context_tokens"],
|
| 84 |
+
prefill_chunk_tokens=1024,
|
| 85 |
+
aliases=(MODEL_ID,),
|
| 86 |
+
routing_family=MODEL_ID,
|
| 87 |
+
compatibility_sha256=fingerprint,
|
| 88 |
+
)
|
| 89 |
+
model.reference_pack = root / "windows.sqlite"
|
| 90 |
+
app = create_app(
|
| 91 |
+
model=model,
|
| 92 |
+
api_key=token,
|
| 93 |
+
max_queue_size=12,
|
| 94 |
+
prompt_lookup_tokens=0,
|
| 95 |
+
usage_role="primary",
|
| 96 |
+
close_supplied_model=True,
|
| 97 |
+
)
|
| 98 |
+
uvicorn.run(app, host=settings["host"], port=settings["port"], workers=1)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
if __name__ == "__main__":
|
| 102 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 103 |
+
parser.add_argument("--config", type=Path, required=True)
|
| 104 |
+
main(parser.parse_args().config)
|
sources.json
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"id": "context-switches",
|
| 4 |
+
"file": "sources/MicrosoftDocs/win32/context-switches.md",
|
| 5 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/ProcThread/context-switches.md",
|
| 6 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/procthread/context-switches",
|
| 7 |
+
"license": "CC-BY-4.0"
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"id": "thread-local-storage",
|
| 11 |
+
"file": "sources/MicrosoftDocs/win32/thread-local-storage.md",
|
| 12 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/ProcThread/thread-local-storage.md",
|
| 13 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/procthread/thread-local-storage",
|
| 14 |
+
"license": "CC-BY-4.0"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"id": "job-objects",
|
| 18 |
+
"file": "sources/MicrosoftDocs/win32/job-objects.md",
|
| 19 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/ProcThread/job-objects.md",
|
| 20 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects",
|
| 21 |
+
"license": "CC-BY-4.0"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"id": "process-handles-and-identifiers",
|
| 25 |
+
"file": "sources/MicrosoftDocs/win32/process-handles-and-identifiers.md",
|
| 26 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/ProcThread/process-handles-and-identifiers.md",
|
| 27 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/procthread/process-handles-and-identifiers",
|
| 28 |
+
"license": "CC-BY-4.0"
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"id": "scheduling-priorities",
|
| 32 |
+
"file": "sources/MicrosoftDocs/win32/scheduling-priorities.md",
|
| 33 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/ProcThread/scheduling-priorities.md",
|
| 34 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities",
|
| 35 |
+
"license": "CC-BY-4.0"
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"id": "event-objects",
|
| 39 |
+
"file": "sources/MicrosoftDocs/win32/event-objects.md",
|
| 40 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/Sync/event-objects.md",
|
| 41 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/sync/event-objects",
|
| 42 |
+
"license": "CC-BY-4.0"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"id": "mutex-objects",
|
| 46 |
+
"file": "sources/MicrosoftDocs/win32/mutex-objects.md",
|
| 47 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/Sync/mutex-objects.md",
|
| 48 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/sync/mutex-objects",
|
| 49 |
+
"license": "CC-BY-4.0"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"id": "semaphore-objects",
|
| 53 |
+
"file": "sources/MicrosoftDocs/win32/semaphore-objects.md",
|
| 54 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/Sync/semaphore-objects.md",
|
| 55 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/sync/semaphore-objects",
|
| 56 |
+
"license": "CC-BY-4.0"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"id": "critical-section-objects",
|
| 60 |
+
"file": "sources/MicrosoftDocs/win32/critical-section-objects.md",
|
| 61 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/Sync/critical-section-objects.md",
|
| 62 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/sync/critical-section-objects",
|
| 63 |
+
"license": "CC-BY-4.0"
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"id": "condition-variables",
|
| 67 |
+
"file": "sources/MicrosoftDocs/win32/condition-variables.md",
|
| 68 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/Sync/condition-variables.md",
|
| 69 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/sync/condition-variables",
|
| 70 |
+
"license": "CC-BY-4.0"
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"id": "working-set",
|
| 74 |
+
"file": "sources/MicrosoftDocs/win32/working-set.md",
|
| 75 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/Memory/working-set.md",
|
| 76 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/memory/working-set",
|
| 77 |
+
"license": "CC-BY-4.0"
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"id": "page-state",
|
| 81 |
+
"file": "sources/MicrosoftDocs/win32/page-state.md",
|
| 82 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/Memory/page-state.md",
|
| 83 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/memory/page-state",
|
| 84 |
+
"license": "CC-BY-4.0"
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"id": "file-mapping",
|
| 88 |
+
"file": "sources/MicrosoftDocs/win32/file-mapping.md",
|
| 89 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/Memory/file-mapping.md",
|
| 90 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping",
|
| 91 |
+
"license": "CC-BY-4.0"
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"id": "i-o-completion-ports",
|
| 95 |
+
"file": "sources/MicrosoftDocs/win32/i-o-completion-ports.md",
|
| 96 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/FileIO/i-o-completion-ports.md",
|
| 97 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports",
|
| 98 |
+
"license": "CC-BY-4.0"
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"id": "synchronous-and-asynchronous-i-o",
|
| 102 |
+
"file": "sources/MicrosoftDocs/win32/synchronous-and-asynchronous-i-o.md",
|
| 103 |
+
"source": "https://github.com/MicrosoftDocs/win32/blob/bc82a65f74ef2c4f2f44a3d7db5f7cfebfdc3583/desktop-src/FileIO/synchronous-and-asynchronous-i-o.md",
|
| 104 |
+
"url": "https://learn.microsoft.com/en-us/windows/win32/fileio/synchronous-and-asynchronous-i-o",
|
| 105 |
+
"license": "CC-BY-4.0"
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"id": "introduction-to-kernel-dispatcher-objects",
|
| 109 |
+
"file": "sources/MicrosoftDocs/windows-driver-docs/introduction-to-kernel-dispatcher-objects.md",
|
| 110 |
+
"source": "https://github.com/MicrosoftDocs/windows-driver-docs/blob/7fd40adfd95e9728b95fa7df5230267157509d88/windows-driver-docs-pr/kernel/introduction-to-kernel-dispatcher-objects.md",
|
| 111 |
+
"url": "https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/introduction-to-kernel-dispatcher-objects",
|
| 112 |
+
"license": "CC-BY-4.0"
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"id": "canceling-irps",
|
| 116 |
+
"file": "sources/MicrosoftDocs/windows-driver-docs/canceling-irps.md",
|
| 117 |
+
"source": "https://github.com/MicrosoftDocs/windows-driver-docs/blob/7fd40adfd95e9728b95fa7df5230267157509d88/windows-driver-docs-pr/kernel/canceling-irps.md",
|
| 118 |
+
"url": "https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/canceling-irps",
|
| 119 |
+
"license": "CC-BY-4.0"
|
| 120 |
+
}
|
| 121 |
+
]
|
sources/MicrosoftDocs/win32/LICENSE
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Attribution 4.0 International
|
| 2 |
+
|
| 3 |
+
=======================================================================
|
| 4 |
+
|
| 5 |
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
| 6 |
+
does not provide legal services or legal advice. Distribution of
|
| 7 |
+
Creative Commons public licenses does not create a lawyer-client or
|
| 8 |
+
other relationship. Creative Commons makes its licenses and related
|
| 9 |
+
information available on an "as-is" basis. Creative Commons gives no
|
| 10 |
+
warranties regarding its licenses, any material licensed under their
|
| 11 |
+
terms and conditions, or any related information. Creative Commons
|
| 12 |
+
disclaims all liability for damages resulting from their use to the
|
| 13 |
+
fullest extent possible.
|
| 14 |
+
|
| 15 |
+
Using Creative Commons Public Licenses
|
| 16 |
+
|
| 17 |
+
Creative Commons public licenses provide a standard set of terms and
|
| 18 |
+
conditions that creators and other rights holders may use to share
|
| 19 |
+
original works of authorship and other material subject to copyright
|
| 20 |
+
and certain other rights specified in the public license below. The
|
| 21 |
+
following considerations are for informational purposes only, are not
|
| 22 |
+
exhaustive, and do not form part of our licenses.
|
| 23 |
+
|
| 24 |
+
Considerations for licensors: Our public licenses are
|
| 25 |
+
intended for use by those authorized to give the public
|
| 26 |
+
permission to use material in ways otherwise restricted by
|
| 27 |
+
copyright and certain other rights. Our licenses are
|
| 28 |
+
irrevocable. Licensors should read and understand the terms
|
| 29 |
+
and conditions of the license they choose before applying it.
|
| 30 |
+
Licensors should also secure all rights necessary before
|
| 31 |
+
applying our licenses so that the public can reuse the
|
| 32 |
+
material as expected. Licensors should clearly mark any
|
| 33 |
+
material not subject to the license. This includes other CC-
|
| 34 |
+
licensed material, or material used under an exception or
|
| 35 |
+
limitation to copyright. More considerations for licensors:
|
| 36 |
+
wiki.creativecommons.org/Considerations_for_licensors
|
| 37 |
+
|
| 38 |
+
Considerations for the public: By using one of our public
|
| 39 |
+
licenses, a licensor grants the public permission to use the
|
| 40 |
+
licensed material under specified terms and conditions. If
|
| 41 |
+
the licensor's permission is not necessary for any reason--for
|
| 42 |
+
example, because of any applicable exception or limitation to
|
| 43 |
+
copyright--then that use is not regulated by the license. Our
|
| 44 |
+
licenses grant only permissions under copyright and certain
|
| 45 |
+
other rights that a licensor has authority to grant. Use of
|
| 46 |
+
the licensed material may still be restricted for other
|
| 47 |
+
reasons, including because others have copyright or other
|
| 48 |
+
rights in the material. A licensor may make special requests,
|
| 49 |
+
such as asking that all changes be marked or described.
|
| 50 |
+
Although not required by our licenses, you are encouraged to
|
| 51 |
+
respect those requests where reasonable. More_considerations
|
| 52 |
+
for the public:
|
| 53 |
+
wiki.creativecommons.org/Considerations_for_licensees
|
| 54 |
+
|
| 55 |
+
=======================================================================
|
| 56 |
+
|
| 57 |
+
Creative Commons Attribution 4.0 International Public License
|
| 58 |
+
|
| 59 |
+
By exercising the Licensed Rights (defined below), You accept and agree
|
| 60 |
+
to be bound by the terms and conditions of this Creative Commons
|
| 61 |
+
Attribution 4.0 International Public License ("Public License"). To the
|
| 62 |
+
extent this Public License may be interpreted as a contract, You are
|
| 63 |
+
granted the Licensed Rights in consideration of Your acceptance of
|
| 64 |
+
these terms and conditions, and the Licensor grants You such rights in
|
| 65 |
+
consideration of benefits the Licensor receives from making the
|
| 66 |
+
Licensed Material available under these terms and conditions.
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
Section 1 -- Definitions.
|
| 70 |
+
|
| 71 |
+
a. Adapted Material means material subject to Copyright and Similar
|
| 72 |
+
Rights that is derived from or based upon the Licensed Material
|
| 73 |
+
and in which the Licensed Material is translated, altered,
|
| 74 |
+
arranged, transformed, or otherwise modified in a manner requiring
|
| 75 |
+
permission under the Copyright and Similar Rights held by the
|
| 76 |
+
Licensor. For purposes of this Public License, where the Licensed
|
| 77 |
+
Material is a musical work, performance, or sound recording,
|
| 78 |
+
Adapted Material is always produced where the Licensed Material is
|
| 79 |
+
synched in timed relation with a moving image.
|
| 80 |
+
|
| 81 |
+
b. Adapter's License means the license You apply to Your Copyright
|
| 82 |
+
and Similar Rights in Your contributions to Adapted Material in
|
| 83 |
+
accordance with the terms and conditions of this Public License.
|
| 84 |
+
|
| 85 |
+
c. Copyright and Similar Rights means copyright and/or similar rights
|
| 86 |
+
closely related to copyright including, without limitation,
|
| 87 |
+
performance, broadcast, sound recording, and Sui Generis Database
|
| 88 |
+
Rights, without regard to how the rights are labeled or
|
| 89 |
+
categorized. For purposes of this Public License, the rights
|
| 90 |
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
| 91 |
+
Rights.
|
| 92 |
+
|
| 93 |
+
d. Effective Technological Measures means those measures that, in the
|
| 94 |
+
absence of proper authority, may not be circumvented under laws
|
| 95 |
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
| 96 |
+
Treaty adopted on December 20, 1996, and/or similar international
|
| 97 |
+
agreements.
|
| 98 |
+
|
| 99 |
+
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
| 100 |
+
any other exception or limitation to Copyright and Similar Rights
|
| 101 |
+
that applies to Your use of the Licensed Material.
|
| 102 |
+
|
| 103 |
+
f. Licensed Material means the artistic or literary work, database,
|
| 104 |
+
or other material to which the Licensor applied this Public
|
| 105 |
+
License.
|
| 106 |
+
|
| 107 |
+
g. Licensed Rights means the rights granted to You subject to the
|
| 108 |
+
terms and conditions of this Public License, which are limited to
|
| 109 |
+
all Copyright and Similar Rights that apply to Your use of the
|
| 110 |
+
Licensed Material and that the Licensor has authority to license.
|
| 111 |
+
|
| 112 |
+
h. Licensor means the individual(s) or entity(ies) granting rights
|
| 113 |
+
under this Public License.
|
| 114 |
+
|
| 115 |
+
i. Share means to provide material to the public by any means or
|
| 116 |
+
process that requires permission under the Licensed Rights, such
|
| 117 |
+
as reproduction, public display, public performance, distribution,
|
| 118 |
+
dissemination, communication, or importation, and to make material
|
| 119 |
+
available to the public including in ways that members of the
|
| 120 |
+
public may access the material from a place and at a time
|
| 121 |
+
individually chosen by them.
|
| 122 |
+
|
| 123 |
+
j. Sui Generis Database Rights means rights other than copyright
|
| 124 |
+
resulting from Directive 96/9/EC of the European Parliament and of
|
| 125 |
+
the Council of 11 March 1996 on the legal protection of databases,
|
| 126 |
+
as amended and/or succeeded, as well as other essentially
|
| 127 |
+
equivalent rights anywhere in the world.
|
| 128 |
+
|
| 129 |
+
k. You means the individual or entity exercising the Licensed Rights
|
| 130 |
+
under this Public License. Your has a corresponding meaning.
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
Section 2 -- Scope.
|
| 134 |
+
|
| 135 |
+
a. License grant.
|
| 136 |
+
|
| 137 |
+
1. Subject to the terms and conditions of this Public License,
|
| 138 |
+
the Licensor hereby grants You a worldwide, royalty-free,
|
| 139 |
+
non-sublicensable, non-exclusive, irrevocable license to
|
| 140 |
+
exercise the Licensed Rights in the Licensed Material to:
|
| 141 |
+
|
| 142 |
+
a. reproduce and Share the Licensed Material, in whole or
|
| 143 |
+
in part; and
|
| 144 |
+
|
| 145 |
+
b. produce, reproduce, and Share Adapted Material.
|
| 146 |
+
|
| 147 |
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
| 148 |
+
Exceptions and Limitations apply to Your use, this Public
|
| 149 |
+
License does not apply, and You do not need to comply with
|
| 150 |
+
its terms and conditions.
|
| 151 |
+
|
| 152 |
+
3. Term. The term of this Public License is specified in Section
|
| 153 |
+
6(a).
|
| 154 |
+
|
| 155 |
+
4. Media and formats; technical modifications allowed. The
|
| 156 |
+
Licensor authorizes You to exercise the Licensed Rights in
|
| 157 |
+
all media and formats whether now known or hereafter created,
|
| 158 |
+
and to make technical modifications necessary to do so. The
|
| 159 |
+
Licensor waives and/or agrees not to assert any right or
|
| 160 |
+
authority to forbid You from making technical modifications
|
| 161 |
+
necessary to exercise the Licensed Rights, including
|
| 162 |
+
technical modifications necessary to circumvent Effective
|
| 163 |
+
Technological Measures. For purposes of this Public License,
|
| 164 |
+
simply making modifications authorized by this Section 2(a)
|
| 165 |
+
(4) never produces Adapted Material.
|
| 166 |
+
|
| 167 |
+
5. Downstream recipients.
|
| 168 |
+
|
| 169 |
+
a. Offer from the Licensor -- Licensed Material. Every
|
| 170 |
+
recipient of the Licensed Material automatically
|
| 171 |
+
receives an offer from the Licensor to exercise the
|
| 172 |
+
Licensed Rights under the terms and conditions of this
|
| 173 |
+
Public License.
|
| 174 |
+
|
| 175 |
+
b. No downstream restrictions. You may not offer or impose
|
| 176 |
+
any additional or different terms or conditions on, or
|
| 177 |
+
apply any Effective Technological Measures to, the
|
| 178 |
+
Licensed Material if doing so restricts exercise of the
|
| 179 |
+
Licensed Rights by any recipient of the Licensed
|
| 180 |
+
Material.
|
| 181 |
+
|
| 182 |
+
6. No endorsement. Nothing in this Public License constitutes or
|
| 183 |
+
may be construed as permission to assert or imply that You
|
| 184 |
+
are, or that Your use of the Licensed Material is, connected
|
| 185 |
+
with, or sponsored, endorsed, or granted official status by,
|
| 186 |
+
the Licensor or others designated to receive attribution as
|
| 187 |
+
provided in Section 3(a)(1)(A)(i).
|
| 188 |
+
|
| 189 |
+
b. Other rights.
|
| 190 |
+
|
| 191 |
+
1. Moral rights, such as the right of integrity, are not
|
| 192 |
+
licensed under this Public License, nor are publicity,
|
| 193 |
+
privacy, and/or other similar personality rights; however, to
|
| 194 |
+
the extent possible, the Licensor waives and/or agrees not to
|
| 195 |
+
assert any such rights held by the Licensor to the limited
|
| 196 |
+
extent necessary to allow You to exercise the Licensed
|
| 197 |
+
Rights, but not otherwise.
|
| 198 |
+
|
| 199 |
+
2. Patent and trademark rights are not licensed under this
|
| 200 |
+
Public License.
|
| 201 |
+
|
| 202 |
+
3. To the extent possible, the Licensor waives any right to
|
| 203 |
+
collect royalties from You for the exercise of the Licensed
|
| 204 |
+
Rights, whether directly or through a collecting society
|
| 205 |
+
under any voluntary or waivable statutory or compulsory
|
| 206 |
+
licensing scheme. In all other cases the Licensor expressly
|
| 207 |
+
reserves any right to collect such royalties.
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
Section 3 -- License Conditions.
|
| 211 |
+
|
| 212 |
+
Your exercise of the Licensed Rights is expressly made subject to the
|
| 213 |
+
following conditions.
|
| 214 |
+
|
| 215 |
+
a. Attribution.
|
| 216 |
+
|
| 217 |
+
1. If You Share the Licensed Material (including in modified
|
| 218 |
+
form), You must:
|
| 219 |
+
|
| 220 |
+
a. retain the following if it is supplied by the Licensor
|
| 221 |
+
with the Licensed Material:
|
| 222 |
+
|
| 223 |
+
i. identification of the creator(s) of the Licensed
|
| 224 |
+
Material and any others designated to receive
|
| 225 |
+
attribution, in any reasonable manner requested by
|
| 226 |
+
the Licensor (including by pseudonym if
|
| 227 |
+
designated);
|
| 228 |
+
|
| 229 |
+
ii. a copyright notice;
|
| 230 |
+
|
| 231 |
+
iii. a notice that refers to this Public License;
|
| 232 |
+
|
| 233 |
+
iv. a notice that refers to the disclaimer of
|
| 234 |
+
warranties;
|
| 235 |
+
|
| 236 |
+
v. a URI or hyperlink to the Licensed Material to the
|
| 237 |
+
extent reasonably practicable;
|
| 238 |
+
|
| 239 |
+
b. indicate if You modified the Licensed Material and
|
| 240 |
+
retain an indication of any previous modifications; and
|
| 241 |
+
|
| 242 |
+
c. indicate the Licensed Material is licensed under this
|
| 243 |
+
Public License, and include the text of, or the URI or
|
| 244 |
+
hyperlink to, this Public License.
|
| 245 |
+
|
| 246 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
| 247 |
+
reasonable manner based on the medium, means, and context in
|
| 248 |
+
which You Share the Licensed Material. For example, it may be
|
| 249 |
+
reasonable to satisfy the conditions by providing a URI or
|
| 250 |
+
hyperlink to a resource that includes the required
|
| 251 |
+
information.
|
| 252 |
+
|
| 253 |
+
3. If requested by the Licensor, You must remove any of the
|
| 254 |
+
information required by Section 3(a)(1)(A) to the extent
|
| 255 |
+
reasonably practicable.
|
| 256 |
+
|
| 257 |
+
4. If You Share Adapted Material You produce, the Adapter's
|
| 258 |
+
License You apply must not prevent recipients of the Adapted
|
| 259 |
+
Material from complying with this Public License.
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
Section 4 -- Sui Generis Database Rights.
|
| 263 |
+
|
| 264 |
+
Where the Licensed Rights include Sui Generis Database Rights that
|
| 265 |
+
apply to Your use of the Licensed Material:
|
| 266 |
+
|
| 267 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
| 268 |
+
to extract, reuse, reproduce, and Share all or a substantial
|
| 269 |
+
portion of the contents of the database;
|
| 270 |
+
|
| 271 |
+
b. if You include all or a substantial portion of the database
|
| 272 |
+
contents in a database in which You have Sui Generis Database
|
| 273 |
+
Rights, then the database in which You have Sui Generis Database
|
| 274 |
+
Rights (but not its individual contents) is Adapted Material; and
|
| 275 |
+
|
| 276 |
+
c. You must comply with the conditions in Section 3(a) if You Share
|
| 277 |
+
all or a substantial portion of the contents of the database.
|
| 278 |
+
|
| 279 |
+
For the avoidance of doubt, this Section 4 supplements and does not
|
| 280 |
+
replace Your obligations under this Public License where the Licensed
|
| 281 |
+
Rights include other Copyright and Similar Rights.
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
| 285 |
+
|
| 286 |
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
| 287 |
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
| 288 |
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
| 289 |
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
| 290 |
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
| 291 |
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
| 292 |
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
| 293 |
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
| 294 |
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
| 295 |
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
| 296 |
+
|
| 297 |
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
| 298 |
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
| 299 |
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
| 300 |
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
| 301 |
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
| 302 |
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
| 303 |
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
| 304 |
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
| 305 |
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
| 306 |
+
|
| 307 |
+
c. The disclaimer of warranties and limitation of liability provided
|
| 308 |
+
above shall be interpreted in a manner that, to the extent
|
| 309 |
+
possible, most closely approximates an absolute disclaimer and
|
| 310 |
+
waiver of all liability.
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
Section 6 -- Term and Termination.
|
| 314 |
+
|
| 315 |
+
a. This Public License applies for the term of the Copyright and
|
| 316 |
+
Similar Rights licensed here. However, if You fail to comply with
|
| 317 |
+
this Public License, then Your rights under this Public License
|
| 318 |
+
terminate automatically.
|
| 319 |
+
|
| 320 |
+
b. Where Your right to use the Licensed Material has terminated under
|
| 321 |
+
Section 6(a), it reinstates:
|
| 322 |
+
|
| 323 |
+
1. automatically as of the date the violation is cured, provided
|
| 324 |
+
it is cured within 30 days of Your discovery of the
|
| 325 |
+
violation; or
|
| 326 |
+
|
| 327 |
+
2. upon express reinstatement by the Licensor.
|
| 328 |
+
|
| 329 |
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
| 330 |
+
right the Licensor may have to seek remedies for Your violations
|
| 331 |
+
of this Public License.
|
| 332 |
+
|
| 333 |
+
c. For the avoidance of doubt, the Licensor may also offer the
|
| 334 |
+
Licensed Material under separate terms or conditions or stop
|
| 335 |
+
distributing the Licensed Material at any time; however, doing so
|
| 336 |
+
will not terminate this Public License.
|
| 337 |
+
|
| 338 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
| 339 |
+
License.
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
Section 7 -- Other Terms and Conditions.
|
| 343 |
+
|
| 344 |
+
a. The Licensor shall not be bound by any additional or different
|
| 345 |
+
terms or conditions communicated by You unless expressly agreed.
|
| 346 |
+
|
| 347 |
+
b. Any arrangements, understandings, or agreements regarding the
|
| 348 |
+
Licensed Material not stated herein are separate from and
|
| 349 |
+
independent of the terms and conditions of this Public License.
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
Section 8 -- Interpretation.
|
| 353 |
+
|
| 354 |
+
a. For the avoidance of doubt, this Public License does not, and
|
| 355 |
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
| 356 |
+
conditions on any use of the Licensed Material that could lawfully
|
| 357 |
+
be made without permission under this Public License.
|
| 358 |
+
|
| 359 |
+
b. To the extent possible, if any provision of this Public License is
|
| 360 |
+
deemed unenforceable, it shall be automatically reformed to the
|
| 361 |
+
minimum extent necessary to make it enforceable. If the provision
|
| 362 |
+
cannot be reformed, it shall be severed from this Public License
|
| 363 |
+
without affecting the enforceability of the remaining terms and
|
| 364 |
+
conditions.
|
| 365 |
+
|
| 366 |
+
c. No term or condition of this Public License will be waived and no
|
| 367 |
+
failure to comply consented to unless expressly agreed to by the
|
| 368 |
+
Licensor.
|
| 369 |
+
|
| 370 |
+
d. Nothing in this Public License constitutes or may be interpreted
|
| 371 |
+
as a limitation upon, or waiver of, any privileges and immunities
|
| 372 |
+
that apply to the Licensor or You, including from the legal
|
| 373 |
+
processes of any jurisdiction or authority.
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
=======================================================================
|
| 377 |
+
|
| 378 |
+
Creative Commons is not a party to its public
|
| 379 |
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
| 380 |
+
its public licenses to material it publishes and in those instances
|
| 381 |
+
will be considered the “Licensor.” The text of the Creative Commons
|
| 382 |
+
public licenses is dedicated to the public domain under the CC0 Public
|
| 383 |
+
Domain Dedication. Except for the limited purpose of indicating that
|
| 384 |
+
material is shared under a Creative Commons public license or as
|
| 385 |
+
otherwise permitted by the Creative Commons policies published at
|
| 386 |
+
creativecommons.org/policies, Creative Commons does not authorize the
|
| 387 |
+
use of the trademark "Creative Commons" or any other trademark or logo
|
| 388 |
+
of Creative Commons without its prior written consent including,
|
| 389 |
+
without limitation, in connection with any unauthorized modifications
|
| 390 |
+
to any of its public licenses or any other arrangements,
|
| 391 |
+
understandings, or agreements concerning use of licensed material. For
|
| 392 |
+
the avoidance of doubt, this paragraph does not form part of the
|
| 393 |
+
public licenses.
|
| 394 |
+
|
| 395 |
+
Creative Commons may be contacted at creativecommons.org.
|
sources/MicrosoftDocs/win32/LICENSE-CODE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
Copyright (c) Microsoft Corporation
|
| 3 |
+
|
| 4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
| 5 |
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
| 6 |
+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 7 |
+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
| 8 |
+
subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
| 11 |
+
portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
| 14 |
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 15 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| 16 |
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 17 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
sources/MicrosoftDocs/win32/condition-variables.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: Condition variables are synchronization primitives that enable threads to wait until a particular condition occurs. Condition variables are user-mode objects that cannot be shared across processes.
|
| 3 |
+
ms.assetid: fef9bab0-cd69-4812-869a-b43a10772d86
|
| 4 |
+
title: Condition Variables
|
| 5 |
+
ms.topic: reference
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Condition Variables
|
| 10 |
+
|
| 11 |
+
Condition variables are synchronization primitives that enable threads to wait until a particular condition occurs. Condition variables are user-mode objects that cannot be shared across processes.
|
| 12 |
+
|
| 13 |
+
Condition variables enable threads to atomically release a lock and enter the sleeping state. They can be used with critical sections or slim reader/writer (SRW) locks. Condition variables support operations that "wake one" or "wake all" waiting threads. After a thread is woken, it re-acquires the lock it released when the thread entered the sleeping state.
|
| 14 |
+
|
| 15 |
+
Note that the caller must allocate a **CONDITION\_VARIABLE** structure and initialize it by either calling [**InitializeConditionVariable**](/windows/win32/api/synchapi/nf-synchapi-initializeconditionvariable) (to initialize the structure dynamically) or assign the constant **CONDITION\_VARIABLE\_INIT** to the structure variable (to initialize the structure statically).
|
| 16 |
+
|
| 17 |
+
**Windows Server 2003 and Windows XP:** Condition variables are not supported.
|
| 18 |
+
|
| 19 |
+
The following are the condition variable functions.
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
| Condition variable function | Description |
|
| 24 |
+
|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
|
| 25 |
+
| [**InitializeConditionVariable**](/windows/win32/api/synchapi/nf-synchapi-initializeconditionvariable) | Initializes a condition variable. |
|
| 26 |
+
| [**SleepConditionVariableCS**](/windows/win32/api/synchapi/nf-synchapi-sleepconditionvariablecs) | Sleeps on the specified condition variable and releases the specified critical section as an atomic operation. |
|
| 27 |
+
| [**SleepConditionVariableSRW**](/windows/win32/api/synchapi/nf-synchapi-sleepconditionvariablesrw) | Sleeps on the specified condition variable and releases the specified SRW lock as an atomic operation. |
|
| 28 |
+
| [**WakeAllConditionVariable**](/windows/win32/api/synchapi/nf-synchapi-wakeallconditionvariable) | Wakes all threads waiting on the specified condition variable. |
|
| 29 |
+
| [**WakeConditionVariable**](/windows/win32/api/synchapi/nf-synchapi-wakeconditionvariable) | Wakes a single thread waiting on the specified condition variable. |
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
The following pseudocode demonstrates the typical usage pattern of condition variables.
|
| 36 |
+
|
| 37 |
+
``` syntax
|
| 38 |
+
CRITICAL_SECTION CritSection;
|
| 39 |
+
CONDITION_VARIABLE ConditionVar;
|
| 40 |
+
|
| 41 |
+
void PerformOperationOnSharedData()
|
| 42 |
+
{
|
| 43 |
+
EnterCriticalSection(&CritSection);
|
| 44 |
+
|
| 45 |
+
// Wait until the predicate is TRUE
|
| 46 |
+
|
| 47 |
+
while( TestPredicate() == FALSE )
|
| 48 |
+
{
|
| 49 |
+
SleepConditionVariableCS(&ConditionVar, &CritSection, INFINITE);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
// The data can be changed safely because we own the critical
|
| 53 |
+
// section and the predicate is TRUE
|
| 54 |
+
|
| 55 |
+
ChangeSharedData();
|
| 56 |
+
|
| 57 |
+
LeaveCriticalSection(&CritSection);
|
| 58 |
+
|
| 59 |
+
// If necessary, signal the condition variable by calling
|
| 60 |
+
// WakeConditionVariable or WakeAllConditionVariable so other
|
| 61 |
+
// threads can wake
|
| 62 |
+
}
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
For example, in an implementation of a reader/writer lock, the `TestPredicate` function would verify that the current lock request is compatible with the existing owners. If it is, acquire the lock; otherwise, sleep. For a more detailed example, see [Using Condition Variables](using-condition-variables.md).
|
| 66 |
+
|
| 67 |
+
Condition variables are subject to spurious wakeups (those not associated with an explicit wake) and stolen wakeups (another thread manages to run before the woken thread). Therefore, you should recheck a predicate (typically in a **while** loop) after a sleep operation returns.
|
| 68 |
+
|
| 69 |
+
You can wake other threads using [**WakeConditionVariable**](/windows/win32/api/synchapi/nf-synchapi-wakeconditionvariable) or [**WakeAllConditionVariable**](/windows/win32/api/synchapi/nf-synchapi-wakeallconditionvariable) either inside or outside the lock associated with the condition variable. It is usually better to release the lock before waking other threads to reduce the number of context switches.
|
| 70 |
+
|
| 71 |
+
It is often convenient to use more than one condition variable with the same lock. For example, an implementation of a reader/writer lock might use a single critical section but separate condition variables for readers and writers.
|
| 72 |
+
|
| 73 |
+
## Related topics
|
| 74 |
+
|
| 75 |
+
<dl> <dt>
|
| 76 |
+
|
| 77 |
+
[Using Condition Variables](using-condition-variables.md)
|
| 78 |
+
</dt> </dl>
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
|
sources/MicrosoftDocs/win32/context-switches.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: The scheduler maintains separate queues of executable threads for each priority level.
|
| 3 |
+
ms.assetid: 82463d71-9cef-4608-b997-25dc9c1e1c0a
|
| 4 |
+
title: Context Switches
|
| 5 |
+
ms.topic: reference
|
| 6 |
+
ms.date: 07/14/2025
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Context Switches
|
| 10 |
+
|
| 11 |
+
The scheduler maintains separate queues of executable threads for each priority level. These threads are known as *ready threads*. When a processor becomes available, the system performs a *context switch*. The steps in a context switch are:
|
| 12 |
+
|
| 13 |
+
1. Save the context of the thread that was preempted or voluntarily yielded by the processor.
|
| 14 |
+
2. If the thread remains in a ready state, place it at the end of the queue for its priority level.
|
| 15 |
+
3. Find the highest priority queue that contains ready threads.
|
| 16 |
+
4. Remove the thread at the head of the queue, restore its context, and resume execution.
|
| 17 |
+
|
| 18 |
+
The following classes of threads are not ready threads.
|
| 19 |
+
|
| 20 |
+
- Threads created with the CREATE\_SUSPENDED flag
|
| 21 |
+
- Threads halted during execution with the [**SuspendThread**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-suspendthread) or [**SwitchToThread**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-switchtothread) function
|
| 22 |
+
- Threads waiting for a synchronization object or input.
|
| 23 |
+
|
| 24 |
+
Until threads that are suspended or blocked become ready to run, the scheduler does not allocate any processor time to them, regardless of their priority.
|
| 25 |
+
|
| 26 |
+
The most common reasons for a context switch are:
|
| 27 |
+
|
| 28 |
+
- The time slice has elapsed.
|
| 29 |
+
- A thread with a higher priority has become ready to run.
|
| 30 |
+
- A running thread needs to wait.
|
| 31 |
+
|
| 32 |
+
When a running thread needs to wait, it relinquishes the remainder of its time slice.
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
sources/MicrosoftDocs/win32/critical-section-objects.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: A critical section object provides synchronization similar to that provided by a mutex object, except that a critical section can be used only by the threads of a single process.
|
| 3 |
+
ms.assetid: 2ec11a42-3d12-4d60-9dd7-dc38926d56e1
|
| 4 |
+
title: Critical Section Objects
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Critical Section Objects
|
| 10 |
+
|
| 11 |
+
A *critical section object* provides synchronization similar to that provided by a mutex object, except that a critical section can be used only by the threads of a single process. Critical section objects cannot be shared across processes.
|
| 12 |
+
|
| 13 |
+
Event, mutex, and semaphore objects can also be used in a single-process application, but critical section objects provide a slightly faster, more efficient mechanism for mutual-exclusion synchronization (a processor-specific test and set instruction). Like a mutex object, a critical section object can be owned by only one thread at a time, which makes it useful for protecting a shared resource from simultaneous access. Unlike a mutex object, there is no way to tell whether a critical section has been abandoned.
|
| 14 |
+
|
| 15 |
+
Starting with Windows Server 2003 with Service Pack 1 (SP1), threads waiting on a critical section do not acquire the critical section on a first-come, first-serve basis. This change increases performance significantly for most code. However, some applications depend on first-in, first-out (FIFO) ordering and may perform poorly or not at all on current versions of Windows (for example, applications that have been using critical sections as a rate-limiter). To ensure that your code continues to work correctly, you may need to add an additional level of synchronization. For example, suppose you have a producer thread and a consumer thread that are using a critical section object to synchronize their work. Create two event objects, one for each thread to use to signal that it is ready for the other thread to proceed. The consumer thread will wait for the producer to signal its event before entering the critical section, and the producer thread will wait for the consumer thread to signal its event before entering the critical section. After each thread leaves the critical section, it signals its event to release the other thread.
|
| 16 |
+
|
| 17 |
+
**Windows Server 2003 and Windows XP:** Threads that are waiting on a critical section are added to a wait queue; they are woken and generally acquire the critical section in the order in which they were added to the queue. However, if threads are added to this queue at a fast enough rate, performance can be degraded because of the time it takes to awaken each waiting thread.
|
| 18 |
+
|
| 19 |
+
The process is responsible for allocating the memory used by a critical section. Typically, this is done by simply declaring a variable of type **CRITICAL\_SECTION**. Before the threads of the process can use it, initialize the critical section by using the [**InitializeCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-initializecriticalsection) or [**InitializeCriticalSectionAndSpinCount**](/windows/win32/api/synchapi/nf-synchapi-initializecriticalsectionandspincount) function.
|
| 20 |
+
|
| 21 |
+
A thread uses the [**EnterCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-entercriticalsection) or [**TryEnterCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-tryentercriticalsection) function to request ownership of a critical section. It uses the [**LeaveCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-leavecriticalsection) function to release ownership of a critical section. If the critical section object is currently owned by another thread, **EnterCriticalSection** waits indefinitely for ownership. In contrast, when a mutex object is used for mutual exclusion, the [wait functions](wait-functions.md) accept a specified time-out interval. The **TryEnterCriticalSection** function attempts to enter a critical section without blocking the calling thread.
|
| 22 |
+
|
| 23 |
+
When a thread owns a critical section, it can make additional calls to [**EnterCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-entercriticalsection) or [**TryEnterCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-tryentercriticalsection) without blocking its execution. This prevents a thread from deadlocking itself while waiting for a critical section that it already owns. To release its ownership, the thread must call [**LeaveCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-leavecriticalsection) one time for each time that it entered the critical section. There is no guarantee about the order in which waiting threads will acquire ownership of the critical section.
|
| 24 |
+
|
| 25 |
+
A thread uses the [**InitializeCriticalSectionAndSpinCount**](/windows/win32/api/synchapi/nf-synchapi-initializecriticalsectionandspincount) or [**SetCriticalSectionSpinCount**](/windows/win32/api/synchapi/nf-synchapi-setcriticalsectionspincount) function to specify a spin count for the critical section object. Spinning means that when a thread tries to acquire a critical section that is locked, the thread enters a loop, checks to see if the lock is released, and if the lock is not released, the thread goes to sleep. On single-processor systems, the spin count is ignored and the critical section spin count is set to 0 (zero). On multiprocessor systems, if the critical section is unavailable, the calling thread spins *dwSpinCount* times before performing a wait operation on a semaphore that is associated with the critical section. If the critical section becomes free during the spin operation, the calling thread avoids the wait operation.
|
| 26 |
+
|
| 27 |
+
Any thread of the process can use the [**DeleteCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-deletecriticalsection) function to release the system resources that are allocated when the critical section object is initialized. After this function is called, the critical section object cannot be used for synchronization.
|
| 28 |
+
|
| 29 |
+
When a critical section object is owned, the only other threads affected are the threads that are waiting for ownership in a call to [**EnterCriticalSection**](/windows/win32/api/synchapi/nf-synchapi-entercriticalsection). Threads that are not waiting are free to continue running.
|
| 30 |
+
|
| 31 |
+
## Related topics
|
| 32 |
+
|
| 33 |
+
<dl> <dt>
|
| 34 |
+
|
| 35 |
+
[Mutex Objects](mutex-objects.md)
|
| 36 |
+
</dt> <dt>
|
| 37 |
+
|
| 38 |
+
[Using Critical Section Objects](using-critical-section-objects.md)
|
| 39 |
+
</dt> </dl>
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
sources/MicrosoftDocs/win32/event-objects.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: An event object is a synchronization object whose state can be explicitly set to signaled by use of the SetEvent function. Following are the two types of event object.
|
| 3 |
+
ms.assetid: 63dc2991-e070-4981-9e2d-90b4fdaaee7a
|
| 4 |
+
title: Event Objects (Synchronization)
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Event Objects (Synchronization)
|
| 10 |
+
|
| 11 |
+
An *event object* is a synchronization object whose state can be explicitly set to signaled by use of the [**SetEvent**](/windows/win32/api/synchapi/nf-synchapi-setevent) function. Following are the two types of event object.
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
| Object | Description |
|
| 16 |
+
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 17 |
+
| Manual-reset event | An event object whose state remains signaled until it is explicitly reset to nonsignaled by the [**ResetEvent**](/windows/win32/api/synchapi/nf-synchapi-resetevent) function. While it is signaled, any number of waiting threads, or threads that subsequently specify the same event object in one of the [wait functions](wait-functions.md), can be released. |
|
| 18 |
+
| Auto-reset event | An event object whose state remains signaled until a single waiting thread is released, at which time the system automatically sets the state to nonsignaled. If no threads are waiting, the event object's state remains signaled. If more than one thread is waiting, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order.<br/> |
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
The event object is useful in sending a signal to a thread indicating that a particular event has occurred. For example, in overlapped input and output, the system sets a specified event object to the signaled state when the overlapped operation has been completed. A single thread can specify different event objects in several simultaneous overlapped operations, then use one of the multiple-object [wait functions](wait-functions.md) to wait for the state of any one of the event objects to be signaled.
|
| 25 |
+
|
| 26 |
+
A thread uses the [**CreateEvent**](/windows/win32/api/synchapi/nf-synchapi-createeventa) or [**CreateEventEx**](/windows/win32/api/synchapi/nf-synchapi-createeventexa) function to create an event object. The creating thread specifies the initial state of the object and whether it is a manual-reset or auto-reset event object. The creating thread can also specify a name for the event object. Threads in other processes can open a handle to an existing event object by specifying its name in a call to the [**OpenEvent**](/windows/win32/api/synchapi/nf-synchapi-openeventa) function. For additional information about names for mutex, event, semaphore, and timer objects, see [Interprocess Synchronization](interprocess-synchronization.md).
|
| 27 |
+
|
| 28 |
+
## Related topics
|
| 29 |
+
|
| 30 |
+
<dl> <dt>
|
| 31 |
+
|
| 32 |
+
[Using Event Objects](using-event-objects.md)
|
| 33 |
+
</dt> </dl>
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
sources/MicrosoftDocs/win32/file-mapping.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: File mapping is the association of a file's contents with a portion of the virtual address space of a process.
|
| 3 |
+
ms.assetid: 86a8bc81-914d-46a2-99fd-65dfd03bbcdd
|
| 4 |
+
title: File Mapping
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# File Mapping
|
| 10 |
+
|
| 11 |
+
*File mapping* is the association of a file's contents with a portion of the virtual address space of a process. The system creates a *file mapping object* (also known as a *section object*) to maintain this association. A *file view* is the portion of virtual address space that a process uses to access the file's contents. File mapping allows the process to use both random input and output (I/O) and sequential I/O. It also allows the process to work efficiently with a large data file, such as a database, without having to map the whole file into memory. Multiple processes can also use memory-mapped files to share data.
|
| 12 |
+
|
| 13 |
+
Processes read from and write to the file view using pointers, just as they would with dynamically allocated memory. The use of file mapping improves efficiency because the file resides on disk, but the file view resides in memory. Processes can also manipulate the file view with the [**VirtualProtect**](/windows/win32/api/memoryapi/nf-memoryapi-virtualprotect) function.
|
| 14 |
+
|
| 15 |
+
The following illustration shows the relationship between the file on disk, a file mapping object, and a file view.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
|
| 19 |
+
The file on disk can be any file that you want to map into memory, or it can be the system page file. The file mapping object can consist of all or only part of the file. It is backed by the file on disk. This means that when the system swaps out pages of the file mapping object, any changes made to the file mapping object are written to the file. When the pages of the file mapping object are swapped back in, they are restored from the file.
|
| 20 |
+
|
| 21 |
+
A file view can consist of all or only part of the file mapping object. A process manipulates the file through the file views. A process can create multiple views for a file mapping object. The file views created by each process reside in the virtual address space of that process. When the process needs data from a portion of the file other than what is in the current file view, it can unmap the current file view, then create a new file view.
|
| 22 |
+
|
| 23 |
+
When multiple processes use the same file mapping object to create views for a local file, the data is coherent. That is, the views contain identical copies of the file on disk. The file cannot reside on a remote computer if you want to share memory between multiple processes.
|
| 24 |
+
|
| 25 |
+
For more information, see the following topics:
|
| 26 |
+
|
| 27 |
+
- [Creating a File Mapping Object](creating-a-file-mapping-object.md)
|
| 28 |
+
- [Creating a File View](creating-a-file-view.md)
|
| 29 |
+
- [Sharing Files and Memory](sharing-files-and-memory.md)
|
| 30 |
+
- [Reading and Writing From a File View](reading-and-writing-from-a-file-view.md)
|
| 31 |
+
- [Closing a File Mapping Object](closing-a-file-mapping-object.md)
|
| 32 |
+
- [File Mapping Security and Access Rights](file-mapping-security-and-access-rights.md)
|
| 33 |
+
- [Using File Mapping](using-file-mapping.md)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
sources/MicrosoftDocs/win32/i-o-completion-ports.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: I/O completion ports provide an efficient threading model for processing multiple asynchronous I/O requests on a multiprocessor system.
|
| 3 |
+
ms.assetid: 213c48e8-bb21-43ed-9c00-2a5cf8ac25f0
|
| 4 |
+
title: I/O Completion Ports
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
# customer intent: As a Windows app developer, I want to use I/O completion ports to efficiently handle multiple asynchronous I/O requests in my application, so that I can improve performance and responsiveness.
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# I/O completion ports
|
| 11 |
+
|
| 12 |
+
I/O completion ports provide an efficient threading model for processing multiple asynchronous I/O requests on a multiprocessor system. When a process creates an I/O completion port, the system creates an associated queue object for threads whose sole purpose is to service these requests. Processes that handle many concurrent asynchronous I/O requests can do so more quickly and efficiently by using I/O completion ports in conjunction with a pre-allocated thread pool than by creating threads at the time they receive an I/O request.
|
| 13 |
+
|
| 14 |
+
## How I/O completion ports work
|
| 15 |
+
|
| 16 |
+
The [CreateIoCompletionPort](createiocompletionport.md) function creates an I/O completion port and associates one or more file handles with that port. When an asynchronous I/O operation on one of these file handles completes, an I/O completion packet is queued in first-in-first-out (FIFO) order to the associated I/O completion port. One powerful use for this mechanism is to combine the synchronization point for multiple file handles into a single object, although there are also other useful applications. Please note that while the packets are queued in FIFO order they may be dequeued in a different order.
|
| 17 |
+
|
| 18 |
+
> [!NOTE]
|
| 19 |
+
> The term *file handle* as used here refers to a system abstraction representing an overlapped I/O endpoint, not only a file on disk. For example, it can be a network endpoint, TCP socket, named pipe, or mail slot. Any system object that supports overlapped I/O can be used. For a list of related I/O functions, see the end of this topic.
|
| 20 |
+
|
| 21 |
+
When a file handle is associated with a completion port, the status block passed in will not be updated until the packet is removed from the completion port. The only exception is if the original operation returns synchronously with an error. A thread (either one created by the main thread or the main thread itself) uses the [**GetQueuedCompletionStatus**](/windows/win32/api/ioapiset/nf-ioapiset-getqueuedcompletionstatus) function to wait for a completion packet to be queued to the I/O completion port, rather than waiting directly for the asynchronous I/O to complete. Threads that block their execution on an I/O completion port are released in last-in-first-out (LIFO) order, and the next completion packet is pulled from the I/O completion port's FIFO queue for that thread. This means that, when a completion packet is released to a thread, the system releases the last (most recent) thread associated with that port, passing it the completion information for the oldest I/O completion.
|
| 22 |
+
|
| 23 |
+
Although any number of threads can call [GetQueuedCompletionStatus](/windows/win32/api/ioapiset/nf-ioapiset-getqueuedcompletionstatus) for a specified I/O completion port, when a specified thread calls **GetQueuedCompletionStatus** the first time, it becomes associated with the specified I/O completion port until one of three things occurs: The thread exits, specifies a different I/O completion port, or closes the I/O completion port. In other words, a single thread can be associated with, at most, one I/O completion port.
|
| 24 |
+
|
| 25 |
+
When a completion packet is queued to an I/O completion port, the system first checks how many threads associated with that port are running. If the number of threads running is less than the concurrency value (discussed in the next section), one of the waiting threads (the most recent one) is allowed to process the completion packet. When a running thread completes its processing, it typically calls [GetQueuedCompletionStatus](/windows/win32/api/ioapiset/nf-ioapiset-getqueuedcompletionstatus) again, at which point it either returns with the next completion packet or waits if the queue is empty.
|
| 26 |
+
|
| 27 |
+
Threads can use the [PostQueuedCompletionStatus](postqueuedcompletionstatus.md) function to place completion packets in an I/O completion port's queue. By doing so, the completion port can be used to receive communications from other threads of the process, in addition to receiving I/O completion packets from the I/O system. The **PostQueuedCompletionStatus** function allows an application to queue its own special-purpose completion packets to the I/O completion port without starting an asynchronous I/O operation. This is useful for notifying worker threads of external events, for example.
|
| 28 |
+
|
| 29 |
+
The I/O completion port handle and every file handle associated with that particular I/O completion port are known as *references to the I/O completion port*. The I/O completion port is released when there are no more references to it. Therefore, all of these handles must be properly closed to release the I/O completion port and its associated system resources. After these conditions are satisfied, an application should close the I/O completion port handle by calling the [CloseHandle](/windows/win32/api/handleapi/nf-handleapi-closehandle) function.
|
| 30 |
+
|
| 31 |
+
> [!NOTE]
|
| 32 |
+
> An I/O completion port is associated with the process that created it and is not sharable between processes. However, a single handle is sharable between threads in the same process.
|
| 33 |
+
|
| 34 |
+
## Threads and Concurrency
|
| 35 |
+
|
| 36 |
+
The most important property of an I/O completion port to consider carefully is the concurrency value. The concurrency value of a completion port is specified when it is created with [CreateIoCompletionPort](createiocompletionport.md) via the *NumberOfConcurrentThreads* parameter. This value limits the number of runnable threads associated with the completion port. When the total number of runnable threads associated with the completion port reaches the concurrency value, the system blocks the execution of any subsequent threads associated with that completion port until the number of runnable threads drops below the concurrency value.
|
| 37 |
+
|
| 38 |
+
The most efficient scenario occurs when there are completion packets waiting in the queue, but no waits can be satisfied because the port has reached its concurrency limit. Consider what happens with a concurrency value of one and multiple threads waiting in the [GetQueuedCompletionStatus](/windows/win32/api/ioapiset/nf-ioapiset-getqueuedcompletionstatus) function call. In this case, if the queue always has completion packets waiting, when the running thread calls **GetQueuedCompletionStatus**, it will not block execution because, as mentioned earlier, the thread queue is LIFO. Instead, this thread will immediately pick up the next queued completion packet. No thread context switches will occur, because the running thread is continually picking up completion packets and the other threads are unable to run.
|
| 39 |
+
|
| 40 |
+
> [!NOTE]
|
| 41 |
+
> In the previous example, the extra threads appear to be useless and never run, but that assumes that the running thread never gets put in a wait state by some other mechanism, terminates, or otherwise closes its associated I/O completion port. Consider all such thread execution ramifications when designing the application.
|
| 42 |
+
|
| 43 |
+
The best overall maximum value to pick for the concurrency value is the number of CPUs on the computer. If your transaction required a lengthy computation, a larger concurrency value will allow more threads to run. Each completion packet may take longer to finish, but more completion packets will be processed at the same time. You can experiment with the concurrency value in conjunction with profiling tools to achieve the best effect for your application.
|
| 44 |
+
|
| 45 |
+
The system also allows a thread waiting in [GetQueuedCompletionStatus](/windows/win32/api/ioapiset/nf-ioapiset-getqueuedcompletionstatus) to process a completion packet if another running thread associated with the same I/O completion port enters a wait state for other reasons, for example the [SuspendThread](/windows/win32/api/processthreadsapi/nf-processthreadsapi-suspendthread) function. When the thread in the wait state begins running again, there may be a brief period when the number of active threads exceeds the concurrency value. However, the system quickly reduces this number by not allowing any new active threads until the number of active threads falls below the concurrency value. This is one reason to have your application create more threads in its thread pool than the concurrency value. Thread pool management is beyond the scope of this topic, but a good rule of thumb is to have a minimum of twice as many threads in the thread pool as there are processors on the system. For additional information about thread pooling, see [Thread Pools](/windows/win32/ProcThread/thread-pools).
|
| 46 |
+
|
| 47 |
+
## Supported I/O Functions
|
| 48 |
+
|
| 49 |
+
The following functions can be used to start I/O operations that complete by using I/O completion ports. You must pass the function an instance of the [OVERLAPPED](/windows/win32/api/minwinbase/ns-minwinbase-overlapped) structure and a file handle previously associated with an I/O completion port (by a call to [CreateIoCompletionPort](createiocompletionport.md)) to enable the I/O completion port mechanism:
|
| 50 |
+
|
| 51 |
+
- [AcceptEx](/windows/win32/api/mswsock/nf-mswsock-acceptex)
|
| 52 |
+
- [ConnectNamedPipe](/windows/win32/api/namedpipeapi/nf-namedpipeapi-connectnamedpipe)
|
| 53 |
+
- [DeviceIoControl](/windows/win32/api/ioapiset/nf-ioapiset-deviceiocontrol)
|
| 54 |
+
- [LockFileEx](/windows/win32/api/FileAPI/nf-fileapi-lockfileex)
|
| 55 |
+
- [ReadDirectoryChangesW](/windows/win32/api/WinBase/nf-winbase-readdirectorychangesw)
|
| 56 |
+
- [ReadFile](/windows/win32/api/FileAPI/nf-fileapi-readfile)
|
| 57 |
+
- [TransactNamedPipe](/windows/win32/api/namedpipeapi/nf-namedpipeapi-transactnamedpipe)
|
| 58 |
+
- [WaitCommEvent](/windows/win32/api/winbase/nf-winbase-waitcommevent)
|
| 59 |
+
- [WriteFile](/windows/win32/api/FileAPI/nf-fileapi-writefile)
|
| 60 |
+
- [WSASendMsg](/windows/win32/api/winsock2/nf-winsock2-wsasendmsg)
|
| 61 |
+
- [WSASendTo](/windows/win32/api/winsock2/nf-winsock2-wsasendto)
|
| 62 |
+
- [WSASend](/windows/win32/api/winsock2/nf-winsock2-wsasend)
|
| 63 |
+
- [WSARecvFrom](/windows/win32/api/winsock2/nf-winsock2-wsarecvfrom)
|
| 64 |
+
- [LPFN_WSARECVMSG (WSARecvMsg)](/windows/win32/api/mswsock/nc-mswsock-lpfn_wsarecvmsg)
|
| 65 |
+
- [WSARecv](/windows/win32/api/winsock2/nf-winsock2-wsarecv)
|
| 66 |
+
|
| 67 |
+
## Related topics
|
| 68 |
+
|
| 69 |
+
[About Processes and Threads](/windows/desktop/ProcThread/about-processes-and-threads)
|
| 70 |
+
|
| 71 |
+
[BindIoCompletionCallback](/windows/desktop/api/winbase/nf-winbase-bindiocompletioncallback)
|
| 72 |
+
|
| 73 |
+
[CreateIoCompletionPort](createiocompletionport.md)
|
sources/MicrosoftDocs/win32/job-objects.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: A job object allows groups of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of the processes associated with them.
|
| 3 |
+
ms.assetid: 59296384-5e78-44dd-8019-f1df6668928b
|
| 4 |
+
title: Job Objects
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 07/14/2025
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Job Objects
|
| 10 |
+
|
| 11 |
+
A *job object* allows groups of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of the processes associated with them. Operations performed on a job object affect all processes associated with the job object. Examples include enforcing limits such as working set size and process priority or terminating all processes associated with a job.
|
| 12 |
+
|
| 13 |
+
- [Creating Jobs](#creating-jobs)
|
| 14 |
+
- [Managing Processes in Jobs](#managing-processes-in-jobs)
|
| 15 |
+
- [Job Limits and Notifications](#job-limits-and-notifications)
|
| 16 |
+
- [Resource Accounting for Jobs](#resource-accounting-for-jobs)
|
| 17 |
+
- [Managing Job Objects](#managing-job-objects)
|
| 18 |
+
- [Managing a Process Tree that Uses Job Objects](#managing-a-process-tree-that-uses-job-objects)
|
| 19 |
+
|
| 20 |
+
## Creating Jobs
|
| 21 |
+
|
| 22 |
+
To create a job object, use the [**CreateJobObject**](/windows/desktop/api/WinBase/nf-winbase-createjobobjecta) function. When the job is created, no processes are associated with the job.
|
| 23 |
+
|
| 24 |
+
To associate a process with a job, use the [**AssignProcessToJobObject**](/windows/win32/api/jobapi2/nf-jobapi2-assignprocesstojobobject) function. After a process is associated with a job, the association cannot be broken. A process can be associated with more than one job in a hierarchy of nested jobs. For more information, see [Nested Jobs](nested-jobs.md).
|
| 25 |
+
|
| 26 |
+
**Windows 7, Windows Server 2008 R2, Windows XP with SP3, Windows Server 2008, Windows Vista and Windows Server 2003:** A process can be associated with only one job. Jobs cannot be nested. The ability to nest jobs was added in Windows 8 and Windows Server 2012.
|
| 27 |
+
|
| 28 |
+
You can specify a security descriptor for a job object when you call the [**CreateJobObject**](/windows/desktop/api/WinBase/nf-winbase-createjobobjecta) function. For more information, see [Job Object Security and Access Rights](job-object-security-and-access-rights.md).
|
| 29 |
+
|
| 30 |
+
## Managing Processes in Jobs
|
| 31 |
+
|
| 32 |
+
After a process is associated with a job, by default any child processes it creates using [**CreateProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa) are also associated with the job. (Child processes created using [**Win32\_Process.Create**](../cimwin32prov/create-method-in-class-win32-process.md) are not associated with the job.) This default behavior can be changed by setting the extended limit JOB\_OBJECT\_LIMIT\_BREAKAWAY\_OK or JOB\_OBJECT\_LIMIT\_SILENT\_BREAKAWAY\_OK for the job.
|
| 33 |
+
|
| 34 |
+
- If the job has the extended limit JOB\_OBJECT\_LIMIT\_BREAKAWAY\_OK and the parent process was created with the CREATE\_BREAKAWAY\_FROM\_JOB flag, then child processes of the parent process are not associated with the job.
|
| 35 |
+
- If the job has the extended limit JOB\_OBJECT\_LIMIT\_SILENT\_BREAKAWAY\_OK, then child processes of any parent process associated with the job are not associated with the job. It is not necessary for parent processes to be created with the CREATE\_BREAKAWAY\_FROM\_JOB flag.
|
| 36 |
+
|
| 37 |
+
If the job is nested, the breakaway settings of parent jobs in the hierarchy affect whether child processes are associated with another job in the hierarchy. For more information, see [Nested Jobs](nested-jobs.md).
|
| 38 |
+
|
| 39 |
+
To determine if a process is running in a job, use the [**IsProcessInJob**](/windows/win32/api/jobapi/nf-jobapi-isprocessinjob) function.
|
| 40 |
+
|
| 41 |
+
To terminate all processes currently associated with a job object, use the [**TerminateJobObject**](/windows/win32/api/jobapi2/nf-jobapi2-terminatejobobject) function.
|
| 42 |
+
|
| 43 |
+
## Job Limits and Notifications
|
| 44 |
+
|
| 45 |
+
A job can enforce limits such as working set size, process priority, and end-of-job time limit on each process that is associated with the job. If a process associated with a job attempts to increase its working set size or process priority from the limit established by the job, the function calls succeed but are silently ignored. A job can also set limits that trigger a notification when they are exceeded but allow the job to continue to run.
|
| 46 |
+
|
| 47 |
+
To set limits for a job, use the [**SetInformationJobObject**](/windows/win32/api/jobapi2/nf-jobapi2-setinformationjobobject) function. For a list of possible limits that can be set for a job, see the following topics:
|
| 48 |
+
|
| 49 |
+
- [**JOBOBJECT\_BASIC\_LIMIT\_INFORMATION**](/windows/desktop/api/WinNT/ns-winnt-jobobject_basic_limit_information)
|
| 50 |
+
- [**JOBOBJECT\_BASIC\_UI\_RESTRICTIONS**](/windows/desktop/api/WinNT/ns-winnt-jobobject_basic_ui_restrictions)
|
| 51 |
+
- [**JOBOBJECT\_CPU\_RATE\_CONTROL\_INFORMATION**](/windows/desktop/api/Winnt/ns-winnt-jobobject_cpu_rate_control_information)
|
| 52 |
+
- [**JOBOBJECT\_EXTENDED\_LIMIT\_INFORMATION**](/windows/desktop/api/WinNT/ns-winnt-jobobject_extended_limit_information)
|
| 53 |
+
- [**JOBOBJECT\_NOTIFICATION\_LIMIT\_INFORMATION**](/windows/desktop/api/WinNT/ns-winnt-jobobject_notification_limit_information)
|
| 54 |
+
|
| 55 |
+
Security limits must be set individually for each process associated with a job object. For more information, see [Process Security and Access Rights](process-security-and-access-rights.md).
|
| 56 |
+
|
| 57 |
+
**Windows XP with SP3 and Windows Server 2003:** The [**SetInformationJobObject**](/windows/win32/api/jobapi2/nf-jobapi2-setinformationjobobject) function can be used to set security limitations for all processes associated with a job object. Starting with Windows Vista, security limits must be set individually for each process associated with a job object.
|
| 58 |
+
|
| 59 |
+
If the job is nested, parent jobs in the hierarchy influence the limit that is enforced for the job. For more information, see [Nested Jobs](nested-jobs.md).
|
| 60 |
+
|
| 61 |
+
If the job has an associated I/O completion port, it can receive notifications when certain job limits are exceeded. The system sends messages to the completion port when a limit is exceeded or certain other events occur. To associate a completion port with a job, use the [**SetInformationJobObject**](/windows/win32/api/jobapi2/nf-jobapi2-setinformationjobobject) function with the job object information class **JobObjectAssociateCompletionPortInformation** and a pointer to a [**JOBOBJECT\_ASSOCIATE\_COMPLETION\_PORT**](/windows/desktop/api/WinNT/ns-winnt-jobobject_associate_completion_port) structure. It is best to do this when the job is inactive, to reduce the chance of missing notifications for processes whose states change during the association of the completion port.
|
| 62 |
+
|
| 63 |
+
All messages are sent directly from the job as if the job had called the [**PostQueuedCompletionStatus**](/windows/win32/api/ioapiset/nf-ioapiset-postqueuedcompletionstatus) function. A thread must monitor the completion port using the [**GetQueuedCompletionStatus**](/windows/win32/api/ioapiset/nf-ioapiset-getqueuedcompletionstatus) function to pick up the messages. Note that, with the exception of limits set with the **JobObjectNotificationLimitInformation** information class, delivery of messages to the completion port is not guaranteed; failure of a message to arrive does not necessarily mean that the event did not occur. Notifications for limits set with **JobObjectNotificationLimitInformation** are guaranteed to arrive at the completion port. For a list of possible messages, see [**JOBOBJECT\_ASSOCIATE\_COMPLETION\_PORT**](/windows/desktop/api/WinNT/ns-winnt-jobobject_associate_completion_port).
|
| 64 |
+
|
| 65 |
+
## Resource Accounting for Jobs
|
| 66 |
+
|
| 67 |
+
The job object records basic accounting information for all its associated processes, including those that have terminated. To retrieve this accounting information, use the [**QueryInformationJobObject**](/windows/win32/api/jobapi2/nf-jobapi2-queryinformationjobobject) function. For a list of the accounting information that is maintained for a job, see the following topics:
|
| 68 |
+
|
| 69 |
+
- [**JOBOBJECT\_BASIC\_ACCOUNTING\_INFORMATION**](/windows/desktop/api/WinNT/ns-winnt-jobobject_basic_accounting_information)
|
| 70 |
+
- [**JOBOBJECT\_BASIC\_AND\_IO\_ACCOUNTING\_INFORMATION**](/windows/desktop/api/WinNT/ns-winnt-jobobject_basic_and_io_accounting_information)
|
| 71 |
+
|
| 72 |
+
If the job object is nested, accounting information for each child job is aggregated in its parent job. For more information, see [Nested Jobs](nested-jobs.md).
|
| 73 |
+
|
| 74 |
+
## Managing Job Objects
|
| 75 |
+
|
| 76 |
+
The state of a job object is set to signaled when all of its processes are terminated because the specified end-of-job time limit has been exceeded. Use [**WaitForSingleObject**](/windows/win32/api/synchapi/nf-synchapi-waitforsingleobject) or [**WaitForSingleObjectEx**](/windows/win32/api/synchapi/nf-synchapi-waitforsingleobjectex) to monitor the job object for this event.
|
| 77 |
+
|
| 78 |
+
To obtain a handle for an existing job object, use the [**OpenJobObject**](/windows/desktop/api/WinBase/nf-winbase-openjobobjecta) function and specify the name given to the object when it was created. Only named job objects can be opened.
|
| 79 |
+
|
| 80 |
+
To close a job object handle, use the [**CloseHandle**](/windows/win32/api/handleapi/nf-handleapi-closehandle) function. The job is destroyed when its last handle has been closed and all associated processes have been terminated. However, if the job has the JOB\_OBJECT\_LIMIT\_KILL\_ON\_JOB\_CLOSE flag specified, closing the last job object handle terminates all associated processes and then destroys the job object itself. If a nested job has the JOB\_OBJECT\_LIMIT\_KILL\_ON\_JOB\_CLOSE flag specified, closing the last job object handle terminates all processes associated with the job and its child jobs in the hierarchy.
|
| 81 |
+
|
| 82 |
+
## Managing a Process Tree that Uses Job Objects
|
| 83 |
+
|
| 84 |
+
Starting with Windows 8 and Windows Server 2012, an application can use [nested jobs](nested-jobs.md) to manage a process tree that uses more than one job object. However, an application that must run on Windows 7, Windows Server 2008 R2, or earlier versions of Windows that do not support nested jobs must manage the process tree in other ways.
|
| 85 |
+
|
| 86 |
+
If a tool must manage a process tree that uses job objects and it is not possible to use nested jobs, both the tool and the members of the process tree must cooperate. Use one of the following options:
|
| 87 |
+
|
| 88 |
+
- Use the JOB\_OBJECT\_LIMIT\_SILENT\_BREAKAWAY\_OK limit. If the tool uses this limit, it cannot monitor an entire process tree. The tool can monitor only the processes it adds to the job. If these processes create child processes, they are not associated with the job. In this option, child processes can be associated with other job objects.
|
| 89 |
+
- Use the JOB\_OBJECT\_LIMIT\_BREAKAWAY\_OK limit. If the tool uses this limit, it can monitor the entire process tree, except for those processes that any member of the tree explicitly breaks away from the tree. A member of the tree can create a child process in a new job object by calling the [**CreateProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa) function with the CREATE\_BREAKAWAY\_FROM\_JOB flag, then calling the [**AssignProcessToJobObject**](/windows/win32/api/jobapi2/nf-jobapi2-assignprocesstojobobject) function. Otherwise, the member must handle cases in which **AssignProcessToJobObject** fails.
|
| 90 |
+
|
| 91 |
+
The CREATE\_BREAKAWAY\_FROM\_JOB flag has no effect if the tree is not being monitored by the tool. Therefore, this is the preferred option, but it requires advance knowledge of the processes being monitored.
|
| 92 |
+
|
| 93 |
+
- Prevent breakaways of any kind by setting neither the JOB\_OBJECT\_LIMIT\_BREAKAWAY\_OK nor the JOB\_OBJECT\_LIMIT\_SILENT\_BREAKAWAY\_OK limit. In this option, the tool can monitor the entire process tree. However, if a child process attempts to associate itself or another child process with a job by calling [**AssignProcessToJobObject**](/windows/win32/api/jobapi2/nf-jobapi2-assignprocesstojobobject), the call will fail. If the process was designed to be associated with a specific job, this failure may prevent the process from working properly.
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
|
sources/MicrosoftDocs/win32/mutex-objects.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: A mutex object is a synchronization object whose state is set to signaled when it is not owned by any thread, and nonsignaled when it is owned.
|
| 3 |
+
ms.assetid: eca0795a-1fd0-4034-9d61-9416670919cf
|
| 4 |
+
title: Mutex Objects
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Mutex Objects
|
| 10 |
+
|
| 11 |
+
A *mutex object* is a synchronization object whose state is set to signaled when it is not owned by any thread, and nonsignaled when it is owned. Only one thread at a time can own a mutex object, whose name comes from the fact that it is useful in coordinating mutually exclusive access to a shared resource. For example, to prevent two threads from writing to shared memory at the same time, each thread waits for ownership of a mutex object before executing the code that accesses the memory. After writing to the shared memory, the thread releases the mutex object.
|
| 12 |
+
|
| 13 |
+
A thread uses the [**CreateMutex**](/windows/win32/api/synchapi/nf-synchapi-createmutexa) or [**CreateMutexEx**](/windows/win32/api/synchapi/nf-synchapi-createmutexexa) function to create a mutex object. The creating thread can request immediate ownership of the mutex object and can also specify a name for the mutex object. It can also create an unnamed mutex. For additional information about names for mutex, event, semaphore, and timer objects, see [Interprocess Synchronization](interprocess-synchronization.md).
|
| 14 |
+
|
| 15 |
+
Threads in other processes can open a handle to an existing named mutex object by specifying its name in a call to the [**OpenMutex**](/windows/win32/api/synchapi/nf-synchapi-openmutexw) function. To pass a handle to an unnamed mutex to another process, use the [**DuplicateHandle**](/windows/win32/api/handleapi/nf-handleapi-duplicatehandle) function or parent-child handle inheritance.
|
| 16 |
+
|
| 17 |
+
Any thread with a handle to a mutex object can use one of the [wait functions](wait-functions.md) to request ownership of the mutex object. If the mutex object is owned by another thread, the wait function blocks the requesting thread until the owning thread releases the mutex object using the [**ReleaseMutex**](/windows/win32/api/synchapi/nf-synchapi-releasemutex) function. The return value of the wait function indicates whether the function returned for some reason other than the state of the mutex being set to signaled.
|
| 18 |
+
|
| 19 |
+
If more than one thread is waiting on a mutex, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order.
|
| 20 |
+
|
| 21 |
+
After a thread obtains ownership of a mutex, it can specify the same mutex in repeated calls to the [wait-functions](wait-functions.md) without blocking its execution. This prevents a thread from deadlocking itself while waiting for a mutex that it already owns. To release its ownership under such circumstances, the thread must call [**ReleaseMutex**](/windows/win32/api/synchapi/nf-synchapi-releasemutex) once for each time that the mutex satisfied the conditions of a wait function.
|
| 22 |
+
|
| 23 |
+
If a thread terminates without releasing its ownership of a mutex object, the mutex object is considered to be abandoned. A waiting thread can acquire ownership of an abandoned mutex object, but the wait function will return **WAIT\_ABANDONED** to indicate that the mutex object is abandoned. An abandoned mutex object indicates that an error has occurred and that any shared resource being protected by the mutex object is in an undefined state. If the thread proceeds as though the mutex object had not been abandoned, it is no longer considered abandoned after the thread releases its ownership. This restores normal behavior if a handle to the mutex object is subsequently specified in a wait function.
|
| 24 |
+
|
| 25 |
+
Note that [critical section objects](critical-section-objects.md) provide synchronization similar to that provided by mutex objects, except that critical section objects can be used only by the threads of a single process.
|
| 26 |
+
|
| 27 |
+
## Related topics
|
| 28 |
+
|
| 29 |
+
<dl> <dt>
|
| 30 |
+
|
| 31 |
+
[Using Mutex Objects](using-mutex-objects.md)
|
| 32 |
+
</dt> </dl>
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
sources/MicrosoftDocs/win32/page-state.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: The pages of a process's virtual address space can be in one of the following states.
|
| 3 |
+
ms.assetid: a6faa901-2966-4556-90ef-c113b1ba6c6d
|
| 4 |
+
title: Page State
|
| 5 |
+
ms.topic: reference
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Page State
|
| 10 |
+
|
| 11 |
+
The pages of a process's virtual address space can be in one of the following states.
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
| State | Description |
|
| 16 |
+
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 17 |
+
| Free | The page is neither committed nor reserved. The page is not accessible to the process. It is available to be reserved, committed, or simultaneously reserved and committed. Attempting to read from or write to a free page results in an access violation exception. <br/> A process can use the [**VirtualFree**](/windows/win32/api/memoryapi/nf-memoryapi-virtualfree) or [**VirtualFreeEx**](/windows/win32/api/memoryapi/nf-memoryapi-virtualfreeex) function to release reserved or committed pages of its address space, returning them to the free state.<br/> |
|
| 18 |
+
| Reserved | The page has been reserved for future use. The range of addresses cannot be used by other allocation functions. The page is not accessible and has no physical storage associated with it. It is available to be committed. <br/> A process can use the [**VirtualAlloc**](/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc) or [**VirtualAllocEx**](/windows/win32/api/memoryapi/nf-memoryapi-virtualallocex) function to reserve pages of its address space and later to commit the reserved pages. It can use [**VirtualFree**](/windows/win32/api/memoryapi/nf-memoryapi-virtualfree) or [**VirtualFreeEx**](/windows/win32/api/memoryapi/nf-memoryapi-virtualfreeex) to decommit committed pages and return them to the reserved state.<br/> |
|
| 19 |
+
| Committed | Memory charges have been allocated from the overall size of RAM and paging files on disk. The page is accessible and access is controlled by one of the [memory protection constants](memory-protection-constants.md). The system initializes and loads each committed page into physical memory only during the first attempt to read or write to that page. When the process terminates, the system releases the storage for committed pages. <br/> A process can use [**VirtualAlloc**](/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc) or [**VirtualAllocEx**](/windows/win32/api/memoryapi/nf-memoryapi-virtualallocex) to commit physical pages from a reserved region. They can also simultaneously reserve and commit pages.<br/> The [**GlobalAlloc**](/windows/desktop/api/WinBase/nf-winbase-globalalloc) and [**LocalAlloc**](/windows/desktop/api/WinBase/nf-winbase-localalloc) functions allocate committed pages with read/write access.<br/> |
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
sources/MicrosoftDocs/win32/process-handles-and-identifiers.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: When a new process is created by the CreateProcess function, handles of the new process and its primary thread are returned.
|
| 3 |
+
ms.assetid: cf6b80de-de02-4222-a414-e940ffaed8fe
|
| 4 |
+
title: Process Handles and Identifiers
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 07/14/2025
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Process Handles and Identifiers
|
| 10 |
+
|
| 11 |
+
When a new process is created by the [**CreateProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa) function, handles of the new process and its primary thread are returned. These handles are created with full access rights, and — subject to security access checking — can be used in any of the functions that accept thread or process handles. These handles can be inherited by child processes, depending on the inheritance flag specified when they are created. The handles are valid until closed, even after the process or thread they represent has been terminated.
|
| 12 |
+
|
| 13 |
+
The [**CreateProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa) function also returns an identifier that uniquely identifies the process throughout the system. A process can use the [**GetCurrentProcessId**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid) function to get its own process identifier (also known as the process ID or PID). The identifier is valid from the time the process is created until the process has been terminated. A process can use the [**Process32First**](/windows/win32/api/tlhelp32/nf-tlhelp32-process32first) function to obtain the process identifier of its parent process.
|
| 14 |
+
|
| 15 |
+
If you have a process identifier, you can get the process handle by calling the [**OpenProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-openprocess) function. **OpenProcess** enables you to specify the handle's access rights and whether it can be inherited.
|
| 16 |
+
|
| 17 |
+
A process can use the [**GetCurrentProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocess) function to retrieve a pseudo handle to its own process object. This pseudo handle is valid only for the calling process; it cannot be inherited or duplicated for use by other processes. To get the real handle to the process, call the [**DuplicateHandle**](/windows/win32/api/handleapi/nf-handleapi-duplicatehandle) function.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
sources/MicrosoftDocs/win32/scheduling-priorities.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: Threads are scheduled to run based on their scheduling priority.
|
| 3 |
+
ms.assetid: 8710cd56-6bf3-4317-a1f6-1a159394ce2a
|
| 4 |
+
title: Scheduling Priorities
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 07/14/2025
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Scheduling Priorities
|
| 10 |
+
|
| 11 |
+
Threads are scheduled to run based on their *scheduling priority*. Each thread is assigned a scheduling priority. The priority levels range from zero (lowest priority) to 31 (highest priority). Only the zero-page thread can have a priority of zero. (The zero-page thread is a system thread responsible for zeroing any free pages when there are no other threads that need to run.)
|
| 12 |
+
|
| 13 |
+
The system treats all threads with the same priority as equal. The system assigns time slices in a round-robin fashion to all threads with the highest priority. If none of these threads are ready to run, the system assigns time slices in a round-robin fashion to all threads with the next highest priority. If a higher-priority thread becomes available to run, the system ceases to execute the lower-priority thread (without allowing it to finish using its time slice) and assigns a full time slice to the higher-priority thread. For more information, see [Context Switches](context-switches.md).
|
| 14 |
+
|
| 15 |
+
The priority of each thread is determined by the following criteria:
|
| 16 |
+
|
| 17 |
+
- The priority class of its process
|
| 18 |
+
- The priority level of the thread within the priority class of its process
|
| 19 |
+
|
| 20 |
+
The priority class and priority level are combined to form the *base priority* of a thread. For information on the dynamic priority of a thread, see [Priority Boosts](priority-boosts.md).
|
| 21 |
+
|
| 22 |
+
## Priority Class
|
| 23 |
+
|
| 24 |
+
Each process belongs to one of the following priority classes:<dl> IDLE\_PRIORITY\_CLASS
|
| 25 |
+
BELOW\_NORMAL\_PRIORITY\_CLASS
|
| 26 |
+
NORMAL\_PRIORITY\_CLASS
|
| 27 |
+
ABOVE\_NORMAL\_PRIORITY\_CLASS
|
| 28 |
+
HIGH\_PRIORITY\_CLASS
|
| 29 |
+
REALTIME\_PRIORITY\_CLASS
|
| 30 |
+
</dl>
|
| 31 |
+
|
| 32 |
+
By default, the priority class of a process is NORMAL\_PRIORITY\_CLASS. Use the [**CreateProcess**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa) function to specify the priority class of a child process when you create it. If the calling process is IDLE\_PRIORITY\_CLASS or BELOW\_NORMAL\_PRIORITY\_CLASS, the new process will inherit this class. Use the [**GetPriorityClass**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-getpriorityclass) function to determine the current priority class of a process and the [**SetPriorityClass**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass) function to change the priority class of a process.
|
| 33 |
+
|
| 34 |
+
Processes that monitor the system, such as screen savers or applications that periodically update a display, should use IDLE\_PRIORITY\_CLASS. This prevents the threads of this process, which do not have high priority, from interfering with higher priority threads.
|
| 35 |
+
|
| 36 |
+
Use HIGH\_PRIORITY\_CLASS with care. If a thread runs at the highest priority level for extended periods, other threads in the system will not get processor time. If several threads are set at high priority at the same time, the threads lose their effectiveness. The high-priority class should be reserved for threads that must respond to time-critical events. If your application performs one task that requires the high-priority class while the rest of its tasks are normal priority, use [**SetPriorityClass**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass) to raise the priority class of the application temporarily; then reduce it after the time-critical task has been completed. Another strategy is to create a high-priority process that has all of its threads blocked most of the time, awakening threads only when critical tasks are needed. The important point is that a high-priority thread should execute for a brief time, and only when it has time-critical work to perform.
|
| 37 |
+
|
| 38 |
+
You should almost never use REALTIME\_PRIORITY\_CLASS, because this interrupts system threads that manage mouse input, keyboard input, and background disk flushing. This class can be appropriate for applications that "talk" directly to hardware or that perform brief tasks that should have limited interruptions.
|
| 39 |
+
|
| 40 |
+
## Priority Level
|
| 41 |
+
|
| 42 |
+
The following are priority levels within each priority class:<dl> THREAD\_PRIORITY\_IDLE
|
| 43 |
+
THREAD\_PRIORITY\_LOWEST
|
| 44 |
+
THREAD\_PRIORITY\_BELOW\_NORMAL
|
| 45 |
+
THREAD\_PRIORITY\_NORMAL
|
| 46 |
+
THREAD\_PRIORITY\_ABOVE\_NORMAL
|
| 47 |
+
THREAD\_PRIORITY\_HIGHEST
|
| 48 |
+
THREAD\_PRIORITY\_TIME\_CRITICAL
|
| 49 |
+
</dl>
|
| 50 |
+
|
| 51 |
+
All threads are created using THREAD\_PRIORITY\_NORMAL. This means that the thread priority is the same as the process priority class. After you create a thread, use the [**SetThreadPriority**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreadpriority) function to adjust its priority relative to other threads in the process.
|
| 52 |
+
|
| 53 |
+
A typical strategy is to use THREAD\_PRIORITY\_ABOVE\_NORMAL or THREAD\_PRIORITY\_HIGHEST for the process's input thread, to ensure that the application is responsive to the user. Background threads, particularly those that are processor intensive, can be set to THREAD\_PRIORITY\_BELOW\_NORMAL or THREAD\_PRIORITY\_LOWEST, to ensure that they can be preempted when necessary. However, if you have a thread waiting for another thread with a lower priority to complete some task, be sure to block the execution of the waiting high-priority thread. To do this, use a [wait function](../sync/wait-functions.md), [critical section](../sync/critical-section-objects.md), or the [**Sleep**](/windows/win32/api/synchapi/nf-synchapi-sleep) function, [**SleepEx**](/windows/win32/api/synchapi/nf-synchapi-sleepex), or [**SwitchToThread**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-switchtothread) function. This is preferable to having the thread execute a loop. Otherwise, the process may become deadlocked, because the thread with lower priority is never scheduled.
|
| 54 |
+
|
| 55 |
+
To determine the current priority level of a thread, use the [**GetThreadPriority**](/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreadpriority) function.
|
| 56 |
+
|
| 57 |
+
## Base Priority
|
| 58 |
+
|
| 59 |
+
The process priority class and thread priority level are combined to form the base priority of each thread.
|
| 60 |
+
|
| 61 |
+
The following table shows the base priority for combinations of process priority class and thread priority value.
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
<table>
|
| 65 |
+
<tr>
|
| 66 |
+
<th colspan="2">Process priority class</th>
|
| 67 |
+
<th>Thread priority level</th>
|
| 68 |
+
<th>Base priority</th>
|
| 69 |
+
</tr>
|
| 70 |
+
<tr>
|
| 71 |
+
<td rowspan="7" colspan="2">IDLE_PRIORITY_CLASS </td>
|
| 72 |
+
<td>THREAD_PRIORITY_IDLE</td>
|
| 73 |
+
<td>1</td>
|
| 74 |
+
</tr>
|
| 75 |
+
<tr>
|
| 76 |
+
<td>THREAD_PRIORITY_LOWEST</td>
|
| 77 |
+
<td>2</td>
|
| 78 |
+
</tr>
|
| 79 |
+
<tr>
|
| 80 |
+
<td>THREAD_PRIORITY_BELOW_NORMAL</td>
|
| 81 |
+
<td>3</td>
|
| 82 |
+
</tr>
|
| 83 |
+
<tr>
|
| 84 |
+
<td>THREAD_PRIORITY_NORMAL</td>
|
| 85 |
+
<td>4</td>
|
| 86 |
+
</tr>
|
| 87 |
+
<tr>
|
| 88 |
+
<td>THREAD_PRIORITY_ABOVE_NORMAL</td>
|
| 89 |
+
<td>5</td>
|
| 90 |
+
</tr>
|
| 91 |
+
<tr>
|
| 92 |
+
<td>THREAD_PRIORITY_HIGHEST</td>
|
| 93 |
+
<td>6</td>
|
| 94 |
+
</tr>
|
| 95 |
+
<tr>
|
| 96 |
+
<td>THREAD_PRIORITY_TIME_CRITICAL</td>
|
| 97 |
+
<td>15</td>
|
| 98 |
+
</tr>
|
| 99 |
+
<tr>
|
| 100 |
+
<td rowspan="7" colspan="2">BELOW_NORMAL_PRIORITY_CLASS </td>
|
| 101 |
+
<td>THREAD_PRIORITY_IDLE</td>
|
| 102 |
+
<td>1</td>
|
| 103 |
+
</tr>
|
| 104 |
+
<tr>
|
| 105 |
+
<td>THREAD_PRIORITY_LOWEST</td>
|
| 106 |
+
<td>4</td>
|
| 107 |
+
</tr>
|
| 108 |
+
<tr>
|
| 109 |
+
<td>THREAD_PRIORITY_BELOW_NORMAL</td>
|
| 110 |
+
<td>5</td>
|
| 111 |
+
</tr>
|
| 112 |
+
<tr>
|
| 113 |
+
<td>THREAD_PRIORITY_NORMAL</td>
|
| 114 |
+
<td>6</td>
|
| 115 |
+
</tr>
|
| 116 |
+
<tr>
|
| 117 |
+
<td>THREAD_PRIORITY_ABOVE_NORMAL</td>
|
| 118 |
+
<td>7</td>
|
| 119 |
+
</tr>
|
| 120 |
+
<tr>
|
| 121 |
+
<td>THREAD_PRIORITY_HIGHEST</td>
|
| 122 |
+
<td>8</td>
|
| 123 |
+
</tr>
|
| 124 |
+
<tr>
|
| 125 |
+
<td>THREAD_PRIORITY_TIME_CRITICAL</td>
|
| 126 |
+
<td>15</td>
|
| 127 |
+
</tr>
|
| 128 |
+
<tr>
|
| 129 |
+
<td rowspan="7" colspan="2">NORMAL_PRIORITY_CLASS </td>
|
| 130 |
+
<td>THREAD_PRIORITY_IDLE</td>
|
| 131 |
+
<td>1</td>
|
| 132 |
+
</tr>
|
| 133 |
+
<tr>
|
| 134 |
+
<td>THREAD_PRIORITY_LOWEST</td>
|
| 135 |
+
<td>6</td>
|
| 136 |
+
</tr>
|
| 137 |
+
<tr>
|
| 138 |
+
<td>THREAD_PRIORITY_BELOW_NORMAL</td>
|
| 139 |
+
<td>7</td>
|
| 140 |
+
</tr>
|
| 141 |
+
<tr>
|
| 142 |
+
<td>THREAD_PRIORITY_NORMAL</td>
|
| 143 |
+
<td>8</td>
|
| 144 |
+
</tr>
|
| 145 |
+
<tr>
|
| 146 |
+
<td>THREAD_PRIORITY_ABOVE_NORMAL</td>
|
| 147 |
+
<td>9</td>
|
| 148 |
+
</tr>
|
| 149 |
+
<tr>
|
| 150 |
+
<td>THREAD_PRIORITY_HIGHEST</td>
|
| 151 |
+
<td>10</td>
|
| 152 |
+
</tr>
|
| 153 |
+
<tr>
|
| 154 |
+
<td>THREAD_PRIORITY_TIME_CRITICAL</td>
|
| 155 |
+
<td>15</td>
|
| 156 |
+
</tr>
|
| 157 |
+
<tr>
|
| 158 |
+
<td rowspan="7" colspan="2">ABOVE_NORMAL_PRIORITY_CLASS </td>
|
| 159 |
+
<td>THREAD_PRIORITY_IDLE</td>
|
| 160 |
+
<td>1</td>
|
| 161 |
+
</tr>
|
| 162 |
+
<tr>
|
| 163 |
+
<td>THREAD_PRIORITY_LOWEST</td>
|
| 164 |
+
<td>8</td>
|
| 165 |
+
</tr>
|
| 166 |
+
<tr>
|
| 167 |
+
<td>THREAD_PRIORITY_BELOW_NORMAL</td>
|
| 168 |
+
<td>9</td>
|
| 169 |
+
</tr>
|
| 170 |
+
<tr>
|
| 171 |
+
<td>THREAD_PRIORITY_NORMAL</td>
|
| 172 |
+
<td>10</td>
|
| 173 |
+
</tr>
|
| 174 |
+
<tr>
|
| 175 |
+
<td>THREAD_PRIORITY_ABOVE_NORMAL</td>
|
| 176 |
+
<td>11</td>
|
| 177 |
+
</tr>
|
| 178 |
+
<tr>
|
| 179 |
+
<td>THREAD_PRIORITY_HIGHEST</td>
|
| 180 |
+
<td>12</td>
|
| 181 |
+
</tr>
|
| 182 |
+
<tr>
|
| 183 |
+
<td>THREAD_PRIORITY_TIME_CRITICAL</td>
|
| 184 |
+
<td>15</td>
|
| 185 |
+
</tr>
|
| 186 |
+
<tr>
|
| 187 |
+
<td rowspan="7" colspan="2">HIGH_PRIORITY_CLASS </td>
|
| 188 |
+
<td>THREAD_PRIORITY_IDLE</td>
|
| 189 |
+
<td>1</td>
|
| 190 |
+
</tr>
|
| 191 |
+
<tr>
|
| 192 |
+
<td>THREAD_PRIORITY_LOWEST</td>
|
| 193 |
+
<td>11</td>
|
| 194 |
+
</tr>
|
| 195 |
+
<tr>
|
| 196 |
+
<td>THREAD_PRIORITY_BELOW_NORMAL</td>
|
| 197 |
+
<td>12</td>
|
| 198 |
+
</tr>
|
| 199 |
+
<tr>
|
| 200 |
+
<td>THREAD_PRIORITY_NORMAL</td>
|
| 201 |
+
<td>13</td>
|
| 202 |
+
</tr>
|
| 203 |
+
<tr>
|
| 204 |
+
<td>THREAD_PRIORITY_ABOVE_NORMAL</td>
|
| 205 |
+
<td>14</td>
|
| 206 |
+
</tr>
|
| 207 |
+
<tr>
|
| 208 |
+
<td>THREAD_PRIORITY_HIGHEST</td>
|
| 209 |
+
<td>15</td>
|
| 210 |
+
</tr>
|
| 211 |
+
<tr>
|
| 212 |
+
<td>THREAD_PRIORITY_TIME_CRITICAL</td>
|
| 213 |
+
<td>15</td>
|
| 214 |
+
</tr>
|
| 215 |
+
<tr>
|
| 216 |
+
<td rowspan="7" colspan="2">REALTIME_PRIORITY_CLASS </td>
|
| 217 |
+
<td>THREAD_PRIORITY_IDLE</td>
|
| 218 |
+
<td>16</td>
|
| 219 |
+
</tr>
|
| 220 |
+
<tr>
|
| 221 |
+
<td>THREAD_PRIORITY_LOWEST</td>
|
| 222 |
+
<td>22</td>
|
| 223 |
+
</tr>
|
| 224 |
+
<tr>
|
| 225 |
+
<td>THREAD_PRIORITY_BELOW_NORMAL</td>
|
| 226 |
+
<td>23</td>
|
| 227 |
+
</tr>
|
| 228 |
+
<tr>
|
| 229 |
+
<td>THREAD_PRIORITY_NORMAL</td>
|
| 230 |
+
<td>24</td>
|
| 231 |
+
</tr>
|
| 232 |
+
<tr>
|
| 233 |
+
<td>THREAD_PRIORITY_ABOVE_NORMAL</td>
|
| 234 |
+
<td>25</td>
|
| 235 |
+
</tr>
|
| 236 |
+
<tr>
|
| 237 |
+
<td>THREAD_PRIORITY_HIGHEST</td>
|
| 238 |
+
<td>26</td>
|
| 239 |
+
</tr>
|
| 240 |
+
<tr>
|
| 241 |
+
<td>THREAD_PRIORITY_TIME_CRITICAL</td>
|
| 242 |
+
<td>31</td>
|
| 243 |
+
</tr>
|
| 244 |
+
</table>
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
|
sources/MicrosoftDocs/win32/semaphore-objects.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: A semaphore object is a synchronization object that maintains a count between zero and a specified maximum value.
|
| 3 |
+
ms.assetid: d9da1d98-a306-4e2d-a149-1eef6a724751
|
| 4 |
+
title: Semaphore Objects
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Semaphore Objects
|
| 10 |
+
|
| 11 |
+
A *semaphore object* is a synchronization object that maintains a count between zero and a specified maximum value. The count is decremented each time a thread completes a wait for the semaphore object and incremented each time a thread releases the semaphore. When the count reaches zero, no more threads can successfully wait for the semaphore object state to become signaled. The state of a semaphore is set to signaled when its count is greater than zero, and nonsignaled when its count is zero.
|
| 12 |
+
|
| 13 |
+
The semaphore object is useful in controlling a shared resource that can support a limited number of users. It acts as a gate that limits the number of threads sharing the resource to a specified maximum number. For example, an application might place a limit on the number of windows that it creates. It uses a semaphore with a maximum count equal to the window limit, decrementing the count whenever a window is created and incrementing it whenever a window is closed. The application specifies the semaphore object in call to one of the [wait functions](wait-functions.md) before each window is created. When the count is zero—indicating that the window limit has been reached—the wait function blocks execution of the window-creation code.
|
| 14 |
+
|
| 15 |
+
A thread uses the [**CreateSemaphore**](/windows/desktop/api/WinBase/nf-winbase-createsemaphorea) or [**CreateSemaphoreEx**](/windows/desktop/api/WinBase/nf-winbase-createsemaphoreexa) function to create a semaphore object. The creating thread specifies the initial count and the maximum value of the count for the object. The initial count must be neither less than zero nor greater than the maximum value. The creating thread can also specify a name for the semaphore object. Threads in other processes can open a handle to an existing semaphore object by specifying its name in a call to the [**OpenSemaphore**](/windows/win32/api/synchapi/nf-synchapi-opensemaphorew) function. For additional information about names for mutex, event, semaphore, and timer objects, see [Interprocess Synchronization](interprocess-synchronization.md).
|
| 16 |
+
|
| 17 |
+
If more than one thread is waiting on a semaphore, a waiting thread is selected. Do not assume a first-in, first-out (FIFO) order. External events such as kernel-mode APCs can change the wait order.
|
| 18 |
+
|
| 19 |
+
Each time one of the [wait functions](wait-functions.md) returns because the state of a semaphore was set to signaled, the count of the semaphore is decreased by one. The [**ReleaseSemaphore**](/windows/win32/api/synchapi/nf-synchapi-releasesemaphore) function increases a semaphore's count by a specified amount. The count can never be less than zero or greater than the maximum value.
|
| 20 |
+
|
| 21 |
+
The initial count of a semaphore is typically set to the maximum value. The count is then decremented from that level as the protected resource is consumed. Alternatively, you can create a semaphore with an initial count of zero to block access to the protected resource while the application is being initialized. After initialization, you can use [**ReleaseSemaphore**](/windows/win32/api/synchapi/nf-synchapi-releasesemaphore) to increment the count to the maximum value.
|
| 22 |
+
|
| 23 |
+
A thread that owns a mutex object can wait repeatedly for the same mutex object to become signaled without its execution becoming blocked. A thread that waits repeatedly for the same semaphore object, however, decrements the semaphore's count each time a wait operation is completed; the thread is blocked when the count gets to zero. Similarly, only the thread that owns a mutex can successfully call the [**ReleaseMutex**](/windows/win32/api/synchapi/nf-synchapi-releasemutex) function, though any thread can use [**ReleaseSemaphore**](/windows/win32/api/synchapi/nf-synchapi-releasesemaphore) to increase the count of a semaphore object.
|
| 24 |
+
|
| 25 |
+
A thread can decrement a semaphore's count more than once by repeatedly specifying the same semaphore object in calls to any of the [wait functions](wait-functions.md). However, calling one of the multiple-object wait functions with an array that contains multiple handles of the same semaphore does not result in multiple decrements.
|
| 26 |
+
|
| 27 |
+
When you have finished using the semaphore object, call the [**CloseHandle**](/windows/win32/api/handleapi/nf-handleapi-closehandle) function to close the handle. The semaphore object is destroyed when its last handle has been closed. Closing the handle does not affect the semaphore count; therefore, be sure to call [**ReleaseSemaphore**](/windows/win32/api/synchapi/nf-synchapi-releasesemaphore) before closing the handle or before the process terminates. Otherwise, pending wait operations will either time out or continue indefinitely, depending on whether a time-out value has been specified.
|
| 28 |
+
|
| 29 |
+
## Related topics
|
| 30 |
+
|
| 31 |
+
<dl> <dt>
|
| 32 |
+
|
| 33 |
+
[Using Semaphore Objects](using-semaphore-objects.md)
|
| 34 |
+
</dt> </dl>
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
sources/MicrosoftDocs/win32/synchronous-and-asynchronous-i-o.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: 'There are two types of input/output (I/O) synchronization: synchronous I/O and asynchronous I/O. Asynchronous I/O is also referred to as overlapped I/O.'
|
| 3 |
+
ms.assetid: ade51d98-cc9d-4b33-9c52-559a9cb14707
|
| 4 |
+
title: Synchronous and Asynchronous I/O
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 07/08/2025
|
| 7 |
+
ms.custom: project-verbatim
|
| 8 |
+
# customer intent: As a Windows developer, I want to understand synchronous and asynchronous I/O so that I can optimize file operations in my applications.
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Synchronous and asynchronous I/O
|
| 12 |
+
|
| 13 |
+
Also see [I/O-related sample applications](https://github.com/microsoft/Windows-classic-samples/tree/master/Samples/Win7Samples/winbase/io).
|
| 14 |
+
|
| 15 |
+
There are two types of input/output (I/O) synchronization: synchronous I/O and asynchronous I/O. Asynchronous I/O is also referred to as overlapped I/O.
|
| 16 |
+
|
| 17 |
+
In *synchronous file I/O*, a thread starts an I/O operation and immediately enters a wait state until the I/O request has completed. A thread performing *asynchronous file I/O* sends an I/O request to the kernel by calling an appropriate function. If the request is accepted by the kernel, the calling thread continues processing another job until the kernel signals to the thread that the I/O operation is complete. It then interrupts its current job and processes the data from the I/O operation as necessary.
|
| 18 |
+
|
| 19 |
+
The two synchronization types are illustrated in the following figure.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
|
| 23 |
+
In situations where an I/O request is expected to take a large amount of time, such as a refresh or backup of a large database or a slow communications link, asynchronous I/O is generally a good way to optimize processing efficiency. However, for relatively fast I/O operations, the overhead of processing kernel I/O requests and kernel signals may make asynchronous I/O less beneficial, particularly if many fast I/O operations need to be made. In this case, synchronous I/O would be better. The mechanisms and implementation details of how to accomplish these tasks vary depending on the type of device handle that is used and the particular needs of the application. In other words, there are usually multiple ways to solve the problem.
|
| 24 |
+
|
| 25 |
+
## Synchronous and Asynchronous I/O Considerations
|
| 26 |
+
|
| 27 |
+
If a file or device is opened for synchronous I/O (that is, **FILE\_FLAG\_OVERLAPPED** is not specified), subsequent calls to functions such as [WriteFile](/windows/win32/api/FileAPI/nf-fileapi-writefile) can block execution of the calling thread until one of the following events occurs:
|
| 28 |
+
|
| 29 |
+
- The I/O operation completes (in this example, a data write).
|
| 30 |
+
- An I/O error occurs. (For example, the pipe is closed from the other end.)
|
| 31 |
+
- An error was made in the call itself (for example, one or more parameters are not valid).
|
| 32 |
+
- Another thread in the process calls the [CancelSynchronousIo](cancelsynchronousio-func.md) function using the blocked thread's thread handle, which terminates I/O for that thread, failing the I/O operation.
|
| 33 |
+
- The blocked thread is terminated by the system; for example, the process itself is terminated, or another thread calls the [TerminateThread](/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminatethread) function using the blocked thread's handle. (This is generally considered a last resort and not good application design.)
|
| 34 |
+
|
| 35 |
+
In some cases, this delay may be unacceptable to the application's design and purpose, so application designers should consider using asynchronous I/O with appropriate thread synchronization objects such as [I/O completion ports](i-o-completion-ports.md). For more information about thread synchronization, see [About Synchronization](/windows/win32/Sync/about-synchronization).
|
| 36 |
+
|
| 37 |
+
A process opens a file for asynchronous I/O in its call to [CreateFile](/windows/win32/api/FileAPI/nf-fileapi-createfilea) by specifying the **FILE\_FLAG\_OVERLAPPED** flag in the *dwFlagsAndAttributes* parameter. If **FILE\_FLAG\_OVERLAPPED** is not specified, the file is opened for synchronous I/O. When the file has been opened for asynchronous I/O, a pointer to an [OVERLAPPED](/windows/win32/api/MinWinBase/ns-minwinbase-overlapped_entry) structure is passed into the call to [ReadFile](/windows/win32/api/FileAPI/nf-fileapi-readfile) and [WriteFile](/windows/desktop/api/FileAPI/nf-fileapi-writefile). When performing synchronous I/O, this structure is not required in calls to **ReadFile** and **WriteFile**.
|
| 38 |
+
|
| 39 |
+
> [!NOTE]
|
| 40 |
+
> If a file or device is opened for asynchronous I/O, subsequent calls to functions such as [WriteFile](/windows/win32/api/FileAPI/nf-fileapi-writefile) using that handle generally return immediately but can also behave synchronously with respect to blocked execution. For more information, see [Asynchronous disk I/O appears as synchronous on Windows](/previous-versions/troubleshoot/windows/win32/asynchronous-disk-io-synchronous).
|
| 41 |
+
|
| 42 |
+
Although [CreateFile](/windows/win32/api/FileAPI/nf-fileapi-createfilea) is the most common function to use for opening files, disk volumes, anonymous pipes, and other similar devices, I/O operations can also be performed using a handle *typecast* from other system objects such as a socket created by the [socket](/windows/win32/api/winsock2/nf-winsock2-socket) or [accept](/windows/win32/api/winsock2/nf-winsock2-accept) functions.
|
| 43 |
+
|
| 44 |
+
Handles to directory objects are obtained by calling the [CreateFile](/windows/win32/api/FileAPI/nf-fileapi-createfilea) function with the **FILE\_FLAG\_BACKUP\_SEMANTICS** attribute. Directory handles are almost never used—backup applications are one of the few applications that will typically use them.
|
| 45 |
+
|
| 46 |
+
After opening the file object for asynchronous I/O, an [OVERLAPPED](/windows/win32/api/minwinbase/ns-minwinbase-overlapped) structure must be properly created, initialized, and passed into each call to functions such as [ReadFile](/windows/win32/api/FileAPI/nf-fileapi-readfile) and [WriteFile](/windows/win32/api/FileAPI/nf-fileapi-writefile). Keep the following in mind when using the [OVERLAPPED](/windows/win32/api/minwinbase/ns-minwinbase-overlapped) structure in asynchronous read and write operations:
|
| 47 |
+
|
| 48 |
+
- Do not deallocate or modify the [OVERLAPPED](/windows/win32/api/minwinbase/ns-minwinbase-overlapped) structure or the data buffer until all asynchronous I/O operations to the file object have been completed.
|
| 49 |
+
- If you declare your pointer to the [OVERLAPPED](/windows/win32/api/minwinbase/ns-minwinbase-overlapped) structure as a local variable, do not exit the local function until all asynchronous I/O operations to the file object have been completed. If the local function is exited prematurely, the **OVERLAPPED** structure will go out of scope and it will be inaccessible to any [ReadFile](/windows/win32/api/FileAPI/nf-fileapi-readfile) or [WriteFile](/windows/win32/api/FileAPI/nf-fileapi-writefile) functions it encounters outside of that function.
|
| 50 |
+
|
| 51 |
+
You can also create an event and put the handle in the [OVERLAPPED](/windows/win32/api/minwinbase/ns-minwinbase-overlapped) structure; the [wait functions](/windows/win32/Sync/wait-functions) can then be used to wait for the I/O operation to complete by waiting on the event handle.
|
| 52 |
+
|
| 53 |
+
As previously stated, when working with an asynchronous handle, applications should use care when making determinations about when to free resources associated with a specified I/O operation on that handle. If the handle is deallocated prematurely, [ReadFile](/windows/win32/api/FileAPI/nf-fileapi-readfile) or [WriteFile](/windows/win32/api/FileAPI/nf-fileapi-writefile) may incorrectly report that the I/O operation is complete. Further, the **WriteFile** function will sometimes return **TRUE** with a [GetLastError](/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror) value of **ERROR\_SUCCESS**, even though it is using an asynchronous handle (which can also return **FALSE** with **ERROR\_IO\_PENDING**). Programmers accustomed to synchronous I/O design will usually release data buffer resources at this point because **TRUE** and **ERROR\_SUCCESS** signify the operation is complete. However, if [I/O completion ports](i-o-completion-ports.md) are being used with this asynchronous handle, a completion packet will also be sent even though the I/O operation completed immediately. In other words, if the application frees resources after **WriteFile** returns **TRUE** with **ERROR\_SUCCESS** in addition to in the I/O completion port routine, it will have a double-free error condition. In this example, the recommendation would be to allow the completion port routine to be solely responsible for all freeing operations for such resources.
|
| 54 |
+
|
| 55 |
+
The system does not maintain the file pointer on asynchronous handles to files and devices that support file pointers (that is, seeking devices), therefore the file position must be passed to the read and write functions in the related offset data members of the [OVERLAPPED](/windows/win32/api/minwinbase/ns-minwinbase-overlapped) structure. For more information, see [WriteFile](/windows/win32/api/FileAPI/nf-fileapi-writefile) and [ReadFile](/windows/win32/api/FileAPI/nf-fileapi-readfile).
|
| 56 |
+
|
| 57 |
+
File pointer position for a synchronous handle is maintained by the system as data is read or written and can also be updated using the [SetFilePointer](/windows/win32/api/FileAPI/nf-fileapi-setfilepointer) or [SetFilePointerEx](/windows/win32/api/FileAPI/nf-fileapi-setfilepointerex) function.
|
| 58 |
+
|
| 59 |
+
An application can also wait on the file handle to synchronize the completion of an I/O operation, but doing so requires extreme caution. Each time an I/O operation is started, the operating system sets the file handle to the nonsignaled state. Each time an I/O operation is completed, the operating system sets the file handle to the signaled state. Therefore, if an application starts two I/O operations and waits on the file handle, there is no way to determine which operation is finished when the handle is set to the signaled state. If an application must perform multiple asynchronous I/O operations on a single file, it should wait on the event handle in the specific [OVERLAPPED](/windows/win32/api/minwinbase/ns-minwinbase-overlapped) structure for each I/O operation, rather than on the common file handle.
|
| 60 |
+
|
| 61 |
+
## Canceling I/O Operations
|
| 62 |
+
|
| 63 |
+
To cancel all pending asynchronous I/O operations, use either:
|
| 64 |
+
|
| 65 |
+
- [CancelIo](cancelio.md): This function only cancels operations issued by the calling thread for the specified file handle.
|
| 66 |
+
- [CancelIoEx](cancelioex-func.md): This function cancels all operations issued by the threads for the specified file handle.
|
| 67 |
+
|
| 68 |
+
Use [CancelSynchronousIo](cancelsynchronousio-func.md) to cancel pending synchronous I/O operations.
|
| 69 |
+
|
| 70 |
+
The [ReadFileEx](/windows/win32/api/FileAPI/nf-fileapi-readfileex) and [WriteFileEx](/windows/win32/api/FileAPI/nf-fileapi-writefileex) functions enable an application to specify a routine to execute (see [FileIOCompletionRoutine](/windows/win32/api/minwinbase/nc-minwinbase-lpoverlapped_completion_routine)) when the asynchronous I/O request is completed.
|
| 71 |
+
|
| 72 |
+
## Related content
|
| 73 |
+
|
| 74 |
+
[WriteFile](/windows/win32/api/FileAPI/nf-fileapi-writefile)
|
| 75 |
+
|
| 76 |
+
[ReadFile](/windows/win32/api/FileAPI/nf-fileapi-readfile)
|
sources/MicrosoftDocs/win32/thread-local-storage.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: With thread local storage (TLS), you can provide unique data for each thread that the process can access using a global index. One thread allocates the index, which can be used by the other threads to retrieve the unique data associated with the index.
|
| 3 |
+
ms.assetid: 40df7410-64d6-4edd-8009-d9c3d2aca920
|
| 4 |
+
title: Thread Local Storage
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 07/14/2025
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Thread Local Storage
|
| 10 |
+
|
| 11 |
+
All threads of a process share its virtual address space. The local variables of a function are unique to each thread that runs the function. However, the static and global variables are shared by all threads in the process. With *thread local storage* (TLS), you can provide unique data for each thread that the process can access using a global index. One thread allocates the index, which can be used by the other threads to retrieve the unique data associated with the index.
|
| 12 |
+
|
| 13 |
+
The constant TLS\_MINIMUM\_AVAILABLE defines the minimum number of TLS indexes available in each process. This minimum is guaranteed to be at least 64 for all systems. The maximum number of indexes per process is 1,088.
|
| 14 |
+
|
| 15 |
+
When the threads are created, the system allocates an array of **LPVOID** values for TLS, which are initialized to NULL. Before an index can be used, it must be allocated by one of the threads. Each thread stores its data for a TLS index in a *TLS slot* in the array. If the data associated with an index will fit in an **LPVOID** value, you can store the data directly in the TLS slot. However, if you are using a large number of indexes in this way, it is better to allocate separate storage, consolidate the data, and minimize the number of TLS slots in use.
|
| 16 |
+
|
| 17 |
+
The following diagram illustrates how TLS works. For a code example illustrating the use of thread local storage, see [Using Thread Local Storage](using-thread-local-storage.md).
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
|
| 21 |
+
The process has two threads, Thread 1 and Thread 2. It allocates two indexes for use with TLS, gdwTlsIndex1 and gdwTlsIndex2. Each thread allocates two memory blocks (one for each index) in which to store the data, and stores the pointers to these memory blocks in the corresponding TLS slots. To access the data associated with an index, the thread retrieves the pointer to the memory block from the TLS slot and stores it in the lpvData local variable.
|
| 22 |
+
|
| 23 |
+
It is ideal to use TLS in a dynamic-link library (DLL). For an example, see [Using Thread Local Storage in a Dynamic Link Library](../dlls/using-thread-local-storage-in-a-dynamic-link-library.md).
|
| 24 |
+
|
| 25 |
+
## Related topics
|
| 26 |
+
|
| 27 |
+
<dl> <dt>
|
| 28 |
+
|
| 29 |
+
[Thread Local Storage (Visual C++)](/cpp/parallel/thread-local-storage-tls)
|
| 30 |
+
</dt> <dt>
|
| 31 |
+
|
| 32 |
+
[Using Thread Local Storage](using-thread-local-storage.md)
|
| 33 |
+
</dt> <dt>
|
| 34 |
+
|
| 35 |
+
[Using Thread Local Storage in a Dynamic Link Library](../dlls/using-thread-local-storage-in-a-dynamic-link-library.md)
|
| 36 |
+
</dt> </dl>
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
sources/MicrosoftDocs/win32/working-set.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: The working set of a process is the set of pages in the virtual address space of the process that are currently resident in physical memory.
|
| 3 |
+
ms.assetid: ff05276a-1d40-4844-b649-10e32e3f1937
|
| 4 |
+
title: Working Set
|
| 5 |
+
ms.topic: concept-article
|
| 6 |
+
ms.date: 05/31/2018
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Working Set
|
| 10 |
+
|
| 11 |
+
The working set of a process is the set of pages in the virtual address space of the process that are currently resident in physical memory. The working set contains only pageable memory allocations; nonpageable memory allocations such as [Address Windowing Extensions](address-windowing-extensions.md) (AWE) or [large page allocations](large-page-support.md) are not included in the working set.
|
| 12 |
+
|
| 13 |
+
When a process references pageable memory that is not currently in its working set, a *page fault* occurs. The system page fault handler attempts to resolve the page fault and, if it succeeds, the page is added to the working set. (Accessing AWE or large page allocations never causes a page fault, because these allocations are not pageable.)
|
| 14 |
+
|
| 15 |
+
A *hard page fault* must be resolved by reading page contents from the page's *backing store*, which is either the system paging file or a memory-mapped file created by the process. A *soft page fault* can be resolved without accessing the backing store. A soft page fault occurs when:
|
| 16 |
+
|
| 17 |
+
- The page is in the working set of some other process, so it is already resident in memory.
|
| 18 |
+
- The page is in transition, because it either has been removed from the working sets of all processes that were using the page and has not yet been repurposed, or it is already resident as a result of a memory manager prefetch operation.
|
| 19 |
+
- A process references an allocated virtual page for the first time (sometimes called a *demand-zero fault*).
|
| 20 |
+
|
| 21 |
+
Pages can be removed from a process working set as a result of the following actions:
|
| 22 |
+
|
| 23 |
+
- The process reduces or empties the working set by calling the [**SetProcessWorkingSetSize**](/windows/win32/api/memoryapi/nf-memoryapi-setprocessworkingsetsize), [**SetProcessWorkingSetSizeEx**](/windows/win32/api/memoryapi/nf-memoryapi-setprocessworkingsetsizeex) or [**EmptyWorkingSet**](/windows/win32/api/psapi/nf-psapi-emptyworkingset) function.
|
| 24 |
+
- The process calls the [**VirtualUnlock**](/windows/win32/api/memoryapi/nf-memoryapi-virtualunlock) function on a memory range that is not locked.
|
| 25 |
+
- The process unmaps a mapped view of a file using the [**UnmapViewOfFile**](/windows/win32/api/memoryapi/nf-memoryapi-unmapviewoffile) function.
|
| 26 |
+
- The memory manager trims pages from the working set to create more available memory.
|
| 27 |
+
- The memory manager must remove a page from the working set to make room for a new page (for example, because the working set is at its maximum size).
|
| 28 |
+
|
| 29 |
+
If several processes share a page, removing the page from the working set of one process does not affect other processes. After a page is removed from the working sets of all processes that were using it, the page becomes a *transition page*. Transition pages remain cached in RAM until the page is either referenced again by some process or repurposed (for example, filled with zeros and given to another process). If a transition page has been modified since it was last written to disk (that is, if the page is "dirty"), then the page must be written to its backing store before it can be repurposed. The system may start writing dirty transition pages to their backing store as soon as such pages become available.
|
| 30 |
+
|
| 31 |
+
Each process has a minimum and maximum working set size that affect the virtual memory paging behavior of the process. To obtain the current size of the working set of a specified process, use the [**GetProcessMemoryInfo**](/windows/win32/api/psapi/nf-psapi-getprocessmemoryinfo) function. To obtain or change the minimum and maximum working set sizes, use the [**GetProcessWorkingSetSizeEx**](/windows/win32/api/memoryapi/nf-memoryapi-getprocessworkingsetsizeex) and [**SetProcessWorkingSetSizeEx**](/windows/win32/api/memoryapi/nf-memoryapi-setprocessworkingsetsizeex) functions.
|
| 32 |
+
|
| 33 |
+
The process status application programming interface (PSAPI) provides a number of functions that return detailed information about the working set of a process. For details, see [Working Set Information](../psapi/working-set-information.md).
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
sources/MicrosoftDocs/windows-driver-docs/LICENSE
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Attribution 4.0 International
|
| 2 |
+
|
| 3 |
+
=======================================================================
|
| 4 |
+
|
| 5 |
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
| 6 |
+
does not provide legal services or legal advice. Distribution of
|
| 7 |
+
Creative Commons public licenses does not create a lawyer-client or
|
| 8 |
+
other relationship. Creative Commons makes its licenses and related
|
| 9 |
+
information available on an "as-is" basis. Creative Commons gives no
|
| 10 |
+
warranties regarding its licenses, any material licensed under their
|
| 11 |
+
terms and conditions, or any related information. Creative Commons
|
| 12 |
+
disclaims all liability for damages resulting from their use to the
|
| 13 |
+
fullest extent possible.
|
| 14 |
+
|
| 15 |
+
Using Creative Commons Public Licenses
|
| 16 |
+
|
| 17 |
+
Creative Commons public licenses provide a standard set of terms and
|
| 18 |
+
conditions that creators and other rights holders may use to share
|
| 19 |
+
original works of authorship and other material subject to copyright
|
| 20 |
+
and certain other rights specified in the public license below. The
|
| 21 |
+
following considerations are for informational purposes only, are not
|
| 22 |
+
exhaustive, and do not form part of our licenses.
|
| 23 |
+
|
| 24 |
+
Considerations for licensors: Our public licenses are
|
| 25 |
+
intended for use by those authorized to give the public
|
| 26 |
+
permission to use material in ways otherwise restricted by
|
| 27 |
+
copyright and certain other rights. Our licenses are
|
| 28 |
+
irrevocable. Licensors should read and understand the terms
|
| 29 |
+
and conditions of the license they choose before applying it.
|
| 30 |
+
Licensors should also secure all rights necessary before
|
| 31 |
+
applying our licenses so that the public can reuse the
|
| 32 |
+
material as expected. Licensors should clearly mark any
|
| 33 |
+
material not subject to the license. This includes other CC-
|
| 34 |
+
licensed material, or material used under an exception or
|
| 35 |
+
limitation to copyright. More considerations for licensors:
|
| 36 |
+
wiki.creativecommons.org/Considerations_for_licensors
|
| 37 |
+
|
| 38 |
+
Considerations for the public: By using one of our public
|
| 39 |
+
licenses, a licensor grants the public permission to use the
|
| 40 |
+
licensed material under specified terms and conditions. If
|
| 41 |
+
the licensor's permission is not necessary for any reason--for
|
| 42 |
+
example, because of any applicable exception or limitation to
|
| 43 |
+
copyright--then that use is not regulated by the license. Our
|
| 44 |
+
licenses grant only permissions under copyright and certain
|
| 45 |
+
other rights that a licensor has authority to grant. Use of
|
| 46 |
+
the licensed material may still be restricted for other
|
| 47 |
+
reasons, including because others have copyright or other
|
| 48 |
+
rights in the material. A licensor may make special requests,
|
| 49 |
+
such as asking that all changes be marked or described.
|
| 50 |
+
Although not required by our licenses, you are encouraged to
|
| 51 |
+
respect those requests where reasonable. More_considerations
|
| 52 |
+
for the public:
|
| 53 |
+
wiki.creativecommons.org/Considerations_for_licensees
|
| 54 |
+
|
| 55 |
+
=======================================================================
|
| 56 |
+
|
| 57 |
+
Creative Commons Attribution 4.0 International Public License
|
| 58 |
+
|
| 59 |
+
By exercising the Licensed Rights (defined below), You accept and agree
|
| 60 |
+
to be bound by the terms and conditions of this Creative Commons
|
| 61 |
+
Attribution 4.0 International Public License ("Public License"). To the
|
| 62 |
+
extent this Public License may be interpreted as a contract, You are
|
| 63 |
+
granted the Licensed Rights in consideration of Your acceptance of
|
| 64 |
+
these terms and conditions, and the Licensor grants You such rights in
|
| 65 |
+
consideration of benefits the Licensor receives from making the
|
| 66 |
+
Licensed Material available under these terms and conditions.
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
Section 1 -- Definitions.
|
| 70 |
+
|
| 71 |
+
a. Adapted Material means material subject to Copyright and Similar
|
| 72 |
+
Rights that is derived from or based upon the Licensed Material
|
| 73 |
+
and in which the Licensed Material is translated, altered,
|
| 74 |
+
arranged, transformed, or otherwise modified in a manner requiring
|
| 75 |
+
permission under the Copyright and Similar Rights held by the
|
| 76 |
+
Licensor. For purposes of this Public License, where the Licensed
|
| 77 |
+
Material is a musical work, performance, or sound recording,
|
| 78 |
+
Adapted Material is always produced where the Licensed Material is
|
| 79 |
+
synched in timed relation with a moving image.
|
| 80 |
+
|
| 81 |
+
b. Adapter's License means the license You apply to Your Copyright
|
| 82 |
+
and Similar Rights in Your contributions to Adapted Material in
|
| 83 |
+
accordance with the terms and conditions of this Public License.
|
| 84 |
+
|
| 85 |
+
c. Copyright and Similar Rights means copyright and/or similar rights
|
| 86 |
+
closely related to copyright including, without limitation,
|
| 87 |
+
performance, broadcast, sound recording, and Sui Generis Database
|
| 88 |
+
Rights, without regard to how the rights are labeled or
|
| 89 |
+
categorized. For purposes of this Public License, the rights
|
| 90 |
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
| 91 |
+
Rights.
|
| 92 |
+
|
| 93 |
+
d. Effective Technological Measures means those measures that, in the
|
| 94 |
+
absence of proper authority, may not be circumvented under laws
|
| 95 |
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
| 96 |
+
Treaty adopted on December 20, 1996, and/or similar international
|
| 97 |
+
agreements.
|
| 98 |
+
|
| 99 |
+
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
| 100 |
+
any other exception or limitation to Copyright and Similar Rights
|
| 101 |
+
that applies to Your use of the Licensed Material.
|
| 102 |
+
|
| 103 |
+
f. Licensed Material means the artistic or literary work, database,
|
| 104 |
+
or other material to which the Licensor applied this Public
|
| 105 |
+
License.
|
| 106 |
+
|
| 107 |
+
g. Licensed Rights means the rights granted to You subject to the
|
| 108 |
+
terms and conditions of this Public License, which are limited to
|
| 109 |
+
all Copyright and Similar Rights that apply to Your use of the
|
| 110 |
+
Licensed Material and that the Licensor has authority to license.
|
| 111 |
+
|
| 112 |
+
h. Licensor means the individual(s) or entity(ies) granting rights
|
| 113 |
+
under this Public License.
|
| 114 |
+
|
| 115 |
+
i. Share means to provide material to the public by any means or
|
| 116 |
+
process that requires permission under the Licensed Rights, such
|
| 117 |
+
as reproduction, public display, public performance, distribution,
|
| 118 |
+
dissemination, communication, or importation, and to make material
|
| 119 |
+
available to the public including in ways that members of the
|
| 120 |
+
public may access the material from a place and at a time
|
| 121 |
+
individually chosen by them.
|
| 122 |
+
|
| 123 |
+
j. Sui Generis Database Rights means rights other than copyright
|
| 124 |
+
resulting from Directive 96/9/EC of the European Parliament and of
|
| 125 |
+
the Council of 11 March 1996 on the legal protection of databases,
|
| 126 |
+
as amended and/or succeeded, as well as other essentially
|
| 127 |
+
equivalent rights anywhere in the world.
|
| 128 |
+
|
| 129 |
+
k. You means the individual or entity exercising the Licensed Rights
|
| 130 |
+
under this Public License. Your has a corresponding meaning.
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
Section 2 -- Scope.
|
| 134 |
+
|
| 135 |
+
a. License grant.
|
| 136 |
+
|
| 137 |
+
1. Subject to the terms and conditions of this Public License,
|
| 138 |
+
the Licensor hereby grants You a worldwide, royalty-free,
|
| 139 |
+
non-sublicensable, non-exclusive, irrevocable license to
|
| 140 |
+
exercise the Licensed Rights in the Licensed Material to:
|
| 141 |
+
|
| 142 |
+
a. reproduce and Share the Licensed Material, in whole or
|
| 143 |
+
in part; and
|
| 144 |
+
|
| 145 |
+
b. produce, reproduce, and Share Adapted Material.
|
| 146 |
+
|
| 147 |
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
| 148 |
+
Exceptions and Limitations apply to Your use, this Public
|
| 149 |
+
License does not apply, and You do not need to comply with
|
| 150 |
+
its terms and conditions.
|
| 151 |
+
|
| 152 |
+
3. Term. The term of this Public License is specified in Section
|
| 153 |
+
6(a).
|
| 154 |
+
|
| 155 |
+
4. Media and formats; technical modifications allowed. The
|
| 156 |
+
Licensor authorizes You to exercise the Licensed Rights in
|
| 157 |
+
all media and formats whether now known or hereafter created,
|
| 158 |
+
and to make technical modifications necessary to do so. The
|
| 159 |
+
Licensor waives and/or agrees not to assert any right or
|
| 160 |
+
authority to forbid You from making technical modifications
|
| 161 |
+
necessary to exercise the Licensed Rights, including
|
| 162 |
+
technical modifications necessary to circumvent Effective
|
| 163 |
+
Technological Measures. For purposes of this Public License,
|
| 164 |
+
simply making modifications authorized by this Section 2(a)
|
| 165 |
+
(4) never produces Adapted Material.
|
| 166 |
+
|
| 167 |
+
5. Downstream recipients.
|
| 168 |
+
|
| 169 |
+
a. Offer from the Licensor -- Licensed Material. Every
|
| 170 |
+
recipient of the Licensed Material automatically
|
| 171 |
+
receives an offer from the Licensor to exercise the
|
| 172 |
+
Licensed Rights under the terms and conditions of this
|
| 173 |
+
Public License.
|
| 174 |
+
|
| 175 |
+
b. No downstream restrictions. You may not offer or impose
|
| 176 |
+
any additional or different terms or conditions on, or
|
| 177 |
+
apply any Effective Technological Measures to, the
|
| 178 |
+
Licensed Material if doing so restricts exercise of the
|
| 179 |
+
Licensed Rights by any recipient of the Licensed
|
| 180 |
+
Material.
|
| 181 |
+
|
| 182 |
+
6. No endorsement. Nothing in this Public License constitutes or
|
| 183 |
+
may be construed as permission to assert or imply that You
|
| 184 |
+
are, or that Your use of the Licensed Material is, connected
|
| 185 |
+
with, or sponsored, endorsed, or granted official status by,
|
| 186 |
+
the Licensor or others designated to receive attribution as
|
| 187 |
+
provided in Section 3(a)(1)(A)(i).
|
| 188 |
+
|
| 189 |
+
b. Other rights.
|
| 190 |
+
|
| 191 |
+
1. Moral rights, such as the right of integrity, are not
|
| 192 |
+
licensed under this Public License, nor are publicity,
|
| 193 |
+
privacy, and/or other similar personality rights; however, to
|
| 194 |
+
the extent possible, the Licensor waives and/or agrees not to
|
| 195 |
+
assert any such rights held by the Licensor to the limited
|
| 196 |
+
extent necessary to allow You to exercise the Licensed
|
| 197 |
+
Rights, but not otherwise.
|
| 198 |
+
|
| 199 |
+
2. Patent and trademark rights are not licensed under this
|
| 200 |
+
Public License.
|
| 201 |
+
|
| 202 |
+
3. To the extent possible, the Licensor waives any right to
|
| 203 |
+
collect royalties from You for the exercise of the Licensed
|
| 204 |
+
Rights, whether directly or through a collecting society
|
| 205 |
+
under any voluntary or waivable statutory or compulsory
|
| 206 |
+
licensing scheme. In all other cases the Licensor expressly
|
| 207 |
+
reserves any right to collect such royalties.
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
Section 3 -- License Conditions.
|
| 211 |
+
|
| 212 |
+
Your exercise of the Licensed Rights is expressly made subject to the
|
| 213 |
+
following conditions.
|
| 214 |
+
|
| 215 |
+
a. Attribution.
|
| 216 |
+
|
| 217 |
+
1. If You Share the Licensed Material (including in modified
|
| 218 |
+
form), You must:
|
| 219 |
+
|
| 220 |
+
a. retain the following if it is supplied by the Licensor
|
| 221 |
+
with the Licensed Material:
|
| 222 |
+
|
| 223 |
+
i. identification of the creator(s) of the Licensed
|
| 224 |
+
Material and any others designated to receive
|
| 225 |
+
attribution, in any reasonable manner requested by
|
| 226 |
+
the Licensor (including by pseudonym if
|
| 227 |
+
designated);
|
| 228 |
+
|
| 229 |
+
ii. a copyright notice;
|
| 230 |
+
|
| 231 |
+
iii. a notice that refers to this Public License;
|
| 232 |
+
|
| 233 |
+
iv. a notice that refers to the disclaimer of
|
| 234 |
+
warranties;
|
| 235 |
+
|
| 236 |
+
v. a URI or hyperlink to the Licensed Material to the
|
| 237 |
+
extent reasonably practicable;
|
| 238 |
+
|
| 239 |
+
b. indicate if You modified the Licensed Material and
|
| 240 |
+
retain an indication of any previous modifications; and
|
| 241 |
+
|
| 242 |
+
c. indicate the Licensed Material is licensed under this
|
| 243 |
+
Public License, and include the text of, or the URI or
|
| 244 |
+
hyperlink to, this Public License.
|
| 245 |
+
|
| 246 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
| 247 |
+
reasonable manner based on the medium, means, and context in
|
| 248 |
+
which You Share the Licensed Material. For example, it may be
|
| 249 |
+
reasonable to satisfy the conditions by providing a URI or
|
| 250 |
+
hyperlink to a resource that includes the required
|
| 251 |
+
information.
|
| 252 |
+
|
| 253 |
+
3. If requested by the Licensor, You must remove any of the
|
| 254 |
+
information required by Section 3(a)(1)(A) to the extent
|
| 255 |
+
reasonably practicable.
|
| 256 |
+
|
| 257 |
+
4. If You Share Adapted Material You produce, the Adapter's
|
| 258 |
+
License You apply must not prevent recipients of the Adapted
|
| 259 |
+
Material from complying with this Public License.
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
Section 4 -- Sui Generis Database Rights.
|
| 263 |
+
|
| 264 |
+
Where the Licensed Rights include Sui Generis Database Rights that
|
| 265 |
+
apply to Your use of the Licensed Material:
|
| 266 |
+
|
| 267 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
| 268 |
+
to extract, reuse, reproduce, and Share all or a substantial
|
| 269 |
+
portion of the contents of the database;
|
| 270 |
+
|
| 271 |
+
b. if You include all or a substantial portion of the database
|
| 272 |
+
contents in a database in which You have Sui Generis Database
|
| 273 |
+
Rights, then the database in which You have Sui Generis Database
|
| 274 |
+
Rights (but not its individual contents) is Adapted Material; and
|
| 275 |
+
|
| 276 |
+
c. You must comply with the conditions in Section 3(a) if You Share
|
| 277 |
+
all or a substantial portion of the contents of the database.
|
| 278 |
+
|
| 279 |
+
For the avoidance of doubt, this Section 4 supplements and does not
|
| 280 |
+
replace Your obligations under this Public License where the Licensed
|
| 281 |
+
Rights include other Copyright and Similar Rights.
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
| 285 |
+
|
| 286 |
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
| 287 |
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
| 288 |
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
| 289 |
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
| 290 |
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
| 291 |
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
| 292 |
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
| 293 |
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
| 294 |
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
| 295 |
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
| 296 |
+
|
| 297 |
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
| 298 |
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
| 299 |
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
| 300 |
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
| 301 |
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
| 302 |
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
| 303 |
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
| 304 |
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
| 305 |
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
| 306 |
+
|
| 307 |
+
c. The disclaimer of warranties and limitation of liability provided
|
| 308 |
+
above shall be interpreted in a manner that, to the extent
|
| 309 |
+
possible, most closely approximates an absolute disclaimer and
|
| 310 |
+
waiver of all liability.
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
Section 6 -- Term and Termination.
|
| 314 |
+
|
| 315 |
+
a. This Public License applies for the term of the Copyright and
|
| 316 |
+
Similar Rights licensed here. However, if You fail to comply with
|
| 317 |
+
this Public License, then Your rights under this Public License
|
| 318 |
+
terminate automatically.
|
| 319 |
+
|
| 320 |
+
b. Where Your right to use the Licensed Material has terminated under
|
| 321 |
+
Section 6(a), it reinstates:
|
| 322 |
+
|
| 323 |
+
1. automatically as of the date the violation is cured, provided
|
| 324 |
+
it is cured within 30 days of Your discovery of the
|
| 325 |
+
violation; or
|
| 326 |
+
|
| 327 |
+
2. upon express reinstatement by the Licensor.
|
| 328 |
+
|
| 329 |
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
| 330 |
+
right the Licensor may have to seek remedies for Your violations
|
| 331 |
+
of this Public License.
|
| 332 |
+
|
| 333 |
+
c. For the avoidance of doubt, the Licensor may also offer the
|
| 334 |
+
Licensed Material under separate terms or conditions or stop
|
| 335 |
+
distributing the Licensed Material at any time; however, doing so
|
| 336 |
+
will not terminate this Public License.
|
| 337 |
+
|
| 338 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
| 339 |
+
License.
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
Section 7 -- Other Terms and Conditions.
|
| 343 |
+
|
| 344 |
+
a. The Licensor shall not be bound by any additional or different
|
| 345 |
+
terms or conditions communicated by You unless expressly agreed.
|
| 346 |
+
|
| 347 |
+
b. Any arrangements, understandings, or agreements regarding the
|
| 348 |
+
Licensed Material not stated herein are separate from and
|
| 349 |
+
independent of the terms and conditions of this Public License.
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
Section 8 -- Interpretation.
|
| 353 |
+
|
| 354 |
+
a. For the avoidance of doubt, this Public License does not, and
|
| 355 |
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
| 356 |
+
conditions on any use of the Licensed Material that could lawfully
|
| 357 |
+
be made without permission under this Public License.
|
| 358 |
+
|
| 359 |
+
b. To the extent possible, if any provision of this Public License is
|
| 360 |
+
deemed unenforceable, it shall be automatically reformed to the
|
| 361 |
+
minimum extent necessary to make it enforceable. If the provision
|
| 362 |
+
cannot be reformed, it shall be severed from this Public License
|
| 363 |
+
without affecting the enforceability of the remaining terms and
|
| 364 |
+
conditions.
|
| 365 |
+
|
| 366 |
+
c. No term or condition of this Public License will be waived and no
|
| 367 |
+
failure to comply consented to unless expressly agreed to by the
|
| 368 |
+
Licensor.
|
| 369 |
+
|
| 370 |
+
d. Nothing in this Public License constitutes or may be interpreted
|
| 371 |
+
as a limitation upon, or waiver of, any privileges and immunities
|
| 372 |
+
that apply to the Licensor or You, including from the legal
|
| 373 |
+
processes of any jurisdiction or authority.
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
=======================================================================
|
| 377 |
+
|
| 378 |
+
Creative Commons is not a party to its public
|
| 379 |
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
| 380 |
+
its public licenses to material it publishes and in those instances
|
| 381 |
+
will be considered the “Licensor.” The text of the Creative Commons
|
| 382 |
+
public licenses is dedicated to the public domain under the CC0 Public
|
| 383 |
+
Domain Dedication. Except for the limited purpose of indicating that
|
| 384 |
+
material is shared under a Creative Commons public license or as
|
| 385 |
+
otherwise permitted by the Creative Commons policies published at
|
| 386 |
+
creativecommons.org/policies, Creative Commons does not authorize the
|
| 387 |
+
use of the trademark "Creative Commons" or any other trademark or logo
|
| 388 |
+
of Creative Commons without its prior written consent including,
|
| 389 |
+
without limitation, in connection with any unauthorized modifications
|
| 390 |
+
to any of its public licenses or any other arrangements,
|
| 391 |
+
understandings, or agreements concerning use of licensed material. For
|
| 392 |
+
the avoidance of doubt, this paragraph does not form part of the
|
| 393 |
+
public licenses.
|
| 394 |
+
|
| 395 |
+
Creative Commons may be contacted at creativecommons.org.
|
sources/MicrosoftDocs/windows-driver-docs/LICENSE-CODE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
Copyright (c) Microsoft Corporation
|
| 3 |
+
|
| 4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
| 5 |
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
| 6 |
+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 7 |
+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
| 8 |
+
subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
| 11 |
+
portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
| 14 |
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 15 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| 16 |
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 17 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
sources/MicrosoftDocs/windows-driver-docs/canceling-irps.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Canceling IRPs
|
| 3 |
+
description: Canceling IRPs
|
| 4 |
+
keywords: ["IRPs WDK kernel , canceling", "canceling IRPs", "Cancel routines", "user-canceled I/O requests WDK kernel", "completing IRPs WDK kernel , canceling IRPs", "unprocessed IRP cancellations WDK kernel"]
|
| 5 |
+
ms.date: 06/16/2017
|
| 6 |
+
ms.topic: concept-article
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Canceling IRPs
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
Drivers in which IRPs might remain queued for an indefinite interval (so a user could cancel a previously submitted I/O request) must have one or more [*Cancel*](/windows-hardware/drivers/ddi/wdm/nc-wdm-driver_cancel) routines to complete user-canceled I/O requests. For example, keyboard, mouse, parallel, serial, and sound device drivers (or drivers layered over them) and file system drivers should have *Cancel* routines.
|
| 16 |
+
|
| 17 |
+
Drivers for Microsoft Windows XP and later operating systems can use [cancel-safe IRP queues](cancel-safe-irp-queues.md) rather than implement their own *Cancel* routines.
|
| 18 |
+
|
| 19 |
+
To "cancel an IRP" means to complete the IRP as quickly as possible while still maintaining system integrity. For a general discussion of IRP completion, see [Completing IRPs](completing-irps.md).
|
| 20 |
+
|
| 21 |
+
The cancellation process begins when either the system or a driver calls [**IoCancelIrp**](/windows-hardware/drivers/ddi/wdm/nf-wdm-iocancelirp). This routine is called for each IRP that is associated with the thread that has not yet fully completed. The system cancels unprocessed IRPs if the thread that initiated the I/O request exits. Drivers can cancel only IRPs that they have created (see [Creating IRPs for Lower-Level Drivers](creating-irps-for-lower-level-drivers.md).)
|
| 22 |
+
|
| 23 |
+
If a canceled IRP is not completed within 5 minutes, the I/O manager considers the IRP timed out. Such IRPs are disassociated from the thread, and an error is logged for the device that currently owns the IRP. You should ensure that any requests that might take a long time to complete in your driver are cancelable. To ensure that potentially long requests are cancelable, you can use [cancel-safe IRP queues](cancel-safe-irp-queues.md) or [Kernel-Mode Driver Framework](../wdf/index.md), which abstracts cancellation away from the driver developer.
|
| 24 |
+
|
| 25 |
+
This section provides the following topics:
|
| 26 |
+
|
| 27 |
+
[Introduction to Cancel Routines](introduction-to-cancel-routines.md)
|
| 28 |
+
|
| 29 |
+
[Registering a Cancel Routine](registering-a-cancel-routine.md)
|
| 30 |
+
|
| 31 |
+
[Synchronizing IRP Cancellation](synchronizing-irp-cancellation.md)
|
| 32 |
+
|
| 33 |
+
[Implementing a Cancel Routine](implementing-a-cancel-routine.md)
|
| 34 |
+
|
| 35 |
+
[Points to Consider When Canceling IRPs](points-to-consider-when-canceling-irps.md)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
sources/MicrosoftDocs/windows-driver-docs/introduction-to-kernel-dispatcher-objects.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Introduction to Kernel Dispatcher Objects
|
| 3 |
+
description: Kernel dispatcher objects include timer objects, event objects, semaphore objects, mutex objects, and thread objects.
|
| 4 |
+
keywords: ["kernel dispatcher objects WDK , about kernel dispatcher objects", "dispatcher objects WDK kernel , about kernel dispatcher objects", "wait states WDK kernel", "Signaled state WDK kernel", "Not-Signaled state WDK kernel"]
|
| 5 |
+
ms.date: 07/21/2021
|
| 6 |
+
ms.topic: concept-article
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Introduction to Kernel Dispatcher Objects
|
| 10 |
+
|
| 11 |
+
The kernel defines a set of object types called *kernel dispatcher objects*, or just *dispatcher objects*. Dispatcher objects include timer objects, event objects, semaphore objects, mutex objects, and thread objects.
|
| 12 |
+
|
| 13 |
+
Drivers can use dispatcher objects as synchronization mechanisms within a nonarbitrary thread context while executing at IRQL equal to PASSIVE_LEVEL.
|
| 14 |
+
|
| 15 |
+
## Dispatcher Object States
|
| 16 |
+
|
| 17 |
+
Every kernel-defined dispatcher object type has a state that is either set to Signaled or set to Not-Signaled.
|
| 18 |
+
|
| 19 |
+
A group of threads can synchronize their operations if one or more threads call [**KeWaitForSingleObject**](/windows-hardware/drivers/ddi/wdm/nf-wdm-kewaitforsingleobject), **KeWaitForMutexObject**, or [**KeWaitForMultipleObjects**](/windows-hardware/drivers/ddi/wdm/nf-wdm-kewaitformultipleobjects). These functions take dispatcher object pointers as input and wait until another routine or thread sets one or more dispatcher objects to the Signaled state.
|
| 20 |
+
|
| 21 |
+
When a thread calls the **KeWaitForSingleObject** to wait for a dispatcher object (or **KeWaitForMutexObject** for a mutex), the thread is put into a *wait* state until the dispatcher object is set to the Signaled state. A thread can call **KeWaitForMultipleObjects** to wait either for any, or for all, of a set of dispatcher objects to be set to Signaled.
|
| 22 |
+
|
| 23 |
+
Whenever a dispatcher object is set to the Signaled state, the kernel changes the state of any thread waiting for that object to *ready*. (Synchronization timers and synchronization events are exceptions to this rule; when a synchronization event or timer is signaled, only one waiting thread is set to the ready state. For more information, see [Timer Objects and DPCs](timer-objects-and-dpcs.md) and [Event Objects](event-objects.md).) A thread in the ready state will be scheduled to run according to its current run-time [thread priority](thread-priorities.md) and the current availability of processors for any thread with that priority.
|
| 24 |
+
|
| 25 |
+
### When Can Drivers Wait for Dispatcher Objects?
|
| 26 |
+
|
| 27 |
+
In general, drivers can wait for dispatcher objects to be set only if at least one of the following circumstances is true:
|
| 28 |
+
|
| 29 |
+
- The driver is executing in a nonarbitrary thread context.
|
| 30 |
+
|
| 31 |
+
That is, you can identify the thread that will enter a wait state. In practice, the only driver routines that execute in a nonarbitrary thread context are the [**DriverEntry**](/windows-hardware/drivers/ddi/wdm/nc-wdm-driver_initialize), [*AddDevice*](/windows-hardware/drivers/ddi/wdm/nc-wdm-driver_add_device), [*Reinitialize*](/windows-hardware/drivers/ddi/ntddk/nc-ntddk-driver_reinitialize), and [*Unload*](/windows-hardware/drivers/ddi/wdm/nc-wdm-driver_unload) routines of any driver, plus the dispatch routines of highest-level drivers. All these routines are called directly by the system.
|
| 32 |
+
|
| 33 |
+
- The driver is performing a completely synchronous I/O request.
|
| 34 |
+
|
| 35 |
+
That is, no driver queues any operations while handling the I/O request, and no driver returns until the driver below it has finished handling the request.
|
| 36 |
+
|
| 37 |
+
Additionally, a driver cannot enter a wait state if it is executing at or above IRQL equal to DISPATCH_LEVEL.
|
| 38 |
+
|
| 39 |
+
Based on these limitations, you must use the following rules:
|
| 40 |
+
|
| 41 |
+
- The **DriverEntry**, *AddDevice*, *Reinitialize*, and *Unload* routines of any driver can wait for dispatcher objects.
|
| 42 |
+
|
| 43 |
+
- The dispatch routines of a highest-level driver can wait for dispatcher objects.
|
| 44 |
+
|
| 45 |
+
- The dispatch routines of lower-level drivers can wait for dispatch objects, if the I/O operation is synchronous, such as create, flush, shutdown, and close operations, some device I/O control operations, and some PnP and power operations.
|
| 46 |
+
|
| 47 |
+
- The dispatch routines of lower-level drivers cannot wait for a dispatcher object for the completion of asynchronous I/O operations.
|
| 48 |
+
|
| 49 |
+
- A driver routine that is executing at or above IRQL DISPATCH_LEVEL must not wait for a dispatcher object to be set to the Signaled state.
|
| 50 |
+
|
| 51 |
+
- A driver must not attempt to wait for a dispatcher object to be set to the Signaled state for the completion of a transfer operation to or from a paging device.
|
| 52 |
+
|
| 53 |
+
- Driver dispatch routines servicing read/write requests generally cannot wait for a dispatcher object to be set to the Signaled state.
|
| 54 |
+
|
| 55 |
+
- A dispatch routine for a device I/O control request can wait for a dispatcher object to be set to the Signaled state only if the transfer type for the I/O control code is METHOD_BUFFERED.
|
| 56 |
+
|
| 57 |
+
- SCSI miniport drivers should not use kernel dispatcher objects. SCSI miniport drivers should call only [SCSI Port Driver Support Routines](/windows-hardware/drivers/storage/scsi-port-driver-support-routines).
|
| 58 |
+
|
| 59 |
+
Every other standard driver routine executes in an arbitrary thread context: that of whatever thread happens to be current when the driver routine is called to process a queued operation or to handle a device interrupt. Moreover, most standard driver routines are run at a raised IRQL, either at DISPATCH_LEVEL, or for device drivers, at DIRQL.
|
| 60 |
+
|
| 61 |
+
If necessary, a driver can create a device-dedicated thread, which can wait for the driver's other routines (except an ISR or [*SynchCritSection*](/windows-hardware/drivers/ddi/wdm/nc-wdm-ksynchronize_routine) routine) to set a dispatcher object to the Signaled state and reset to the Not-Signaled state.
|
| 62 |
+
|
| 63 |
+
As a general guideline, if you expect that your new device driver will often need to stall for longer than 50 microseconds while it waits for device-state changes during I/O operations, consider implementing a driver with a device-dedicated thread. If the device driver is also a highest-level driver, consider using [system worker threads](system-worker-threads.md) and implementing one or more worker-thread callback routines. See [**PsCreateSystemThread**](/windows-hardware/drivers/ddi/wdm/nf-wdm-pscreatesystemthread) and [Managing Interlocked Queues with a Driver-Created Thread](managing-interlocked-queues-with-a-driver-created-thread.md).
|
training/capture.py
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Teacher-force complete answers on an offline copy of the admitted packed Flash."""
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import hashlib
|
| 5 |
+
import inspect
|
| 6 |
+
import json
|
| 7 |
+
from collections import Counter
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
import torch
|
| 12 |
+
from belikewater_transformers.models.qwennifer.flash_serving import (
|
| 13 |
+
QwenniferFlashModel,
|
| 14 |
+
)
|
| 15 |
+
from flash_revision import packed_revision
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def load(settings):
|
| 19 |
+
cfg = json.loads(settings.read_text())
|
| 20 |
+
inputs = Path(cfg["inputs"])
|
| 21 |
+
bank, hot = Path(cfg["flat_cache"]), Path(cfg["hot_experts_file"])
|
| 22 |
+
if not bank.is_file() or not hot.is_file():
|
| 23 |
+
msg = "expected existing Flash assets"
|
| 24 |
+
raise FileNotFoundError(msg)
|
| 25 |
+
flash = QwenniferFlashModel(
|
| 26 |
+
inputs_dir=inputs,
|
| 27 |
+
flat_cache=bank,
|
| 28 |
+
hot_experts_file=hot,
|
| 29 |
+
cache_slots=cfg.get("capture_cache_slots", 9000),
|
| 30 |
+
**({"map_flat_cache": True} if cfg.get("map_flat_cache") else {}),
|
| 31 |
+
max_context_tokens=1024,
|
| 32 |
+
prefill_chunk_tokens=1024,
|
| 33 |
+
)
|
| 34 |
+
return flash, packed_revision(inputs)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def prompt_ids(tok, row):
|
| 38 |
+
text = tok.apply_chat_template(
|
| 39 |
+
[{"role": "user", "content": row["prompt"]}],
|
| 40 |
+
tokenize=False,
|
| 41 |
+
add_generation_prompt=True,
|
| 42 |
+
)
|
| 43 |
+
return tok.encode(text, add_special_tokens=False)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def name(row):
|
| 47 |
+
return row["id"] + "-" + row["condition"]
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def capture_sequence(flash, ids):
|
| 51 |
+
# The frozen runner hands its final norm only the last position. For a
|
| 52 |
+
# single chunk the same activation tensor already contains every position.
|
| 53 |
+
# Inspect only that one call, without changing serving or recomputing layers.
|
| 54 |
+
runner = flash.runner
|
| 55 |
+
found = []
|
| 56 |
+
code = inspect.unwrap(type(runner).prefill).__code__
|
| 57 |
+
|
| 58 |
+
def collect(_module, args):
|
| 59 |
+
frame = inspect.currentframe().f_back
|
| 60 |
+
while frame is not None and frame.f_code is not code:
|
| 61 |
+
frame = frame.f_back
|
| 62 |
+
if frame is None:
|
| 63 |
+
msg = "unrecognized Flash prefill call"
|
| 64 |
+
raise RuntimeError(msg)
|
| 65 |
+
all_hidden = frame.f_locals["hs"]
|
| 66 |
+
if (
|
| 67 |
+
all_hidden.shape[1] != len(ids)
|
| 68 |
+
or all_hidden[:, -1:].data_ptr() != args[0].data_ptr()
|
| 69 |
+
):
|
| 70 |
+
msg = "expected last position of a single prefill chunk"
|
| 71 |
+
raise RuntimeError(msg)
|
| 72 |
+
found.append(all_hidden)
|
| 73 |
+
|
| 74 |
+
with flash.model.model.norm.register_forward_pre_hook(collect):
|
| 75 |
+
last = runner.prefill(torch.tensor([ids], device=flash.device))
|
| 76 |
+
(hs,) = found
|
| 77 |
+
return hs, last
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
@torch.inference_mode()
|
| 81 |
+
def capture(settings, dataset, directory):
|
| 82 |
+
directory.mkdir(exist_ok=False)
|
| 83 |
+
flash, revision = load(settings)
|
| 84 |
+
rows = [json.loads(x) for x in dataset.read_text().splitlines()]
|
| 85 |
+
tok = flash.tokenizer
|
| 86 |
+
answers = [
|
| 87 |
+
[*tok.encode(r["answer"], add_special_tokens=False), tok.eos_token_id]
|
| 88 |
+
for r in rows
|
| 89 |
+
]
|
| 90 |
+
freq = Counter(
|
| 91 |
+
t
|
| 92 |
+
for r, ids in zip(rows, answers, strict=True)
|
| 93 |
+
if r["split"] == "train"
|
| 94 |
+
for t in ids
|
| 95 |
+
)
|
| 96 |
+
vocab = sorted(
|
| 97 |
+
k for k, _ in sorted(freq.items(), key=lambda kv: (-kv[1], kv[0]))[:256]
|
| 98 |
+
)
|
| 99 |
+
select = torch.tensor(vocab, device=flash.device)
|
| 100 |
+
meta = {
|
| 101 |
+
"model": "qwennifer-flash",
|
| 102 |
+
"revision": revision,
|
| 103 |
+
"rows": vocab,
|
| 104 |
+
"gpu": torch.cuda.get_device_name(),
|
| 105 |
+
"dataset_sha256": hashlib.sha256(dataset.read_bytes()).hexdigest(),
|
| 106 |
+
}
|
| 107 |
+
for i, (r, answer) in enumerate(zip(rows, answers, strict=True)):
|
| 108 |
+
prefix = prompt_ids(tok, r)
|
| 109 |
+
ids = prefix + answer[:-1]
|
| 110 |
+
if len(ids) > flash.max_context_tokens:
|
| 111 |
+
msg = "supervised prompt exceeds offline capture budget"
|
| 112 |
+
raise ValueError(msg)
|
| 113 |
+
hs, last = capture_sequence(flash, ids)
|
| 114 |
+
h = flash.model.model.norm(hs[:, len(prefix) - 1 :, :]).squeeze(0)
|
| 115 |
+
scores = flash.model.lm_head(h.unsqueeze(0)).squeeze(0).float()
|
| 116 |
+
y = torch.tensor(answer, device=flash.device)
|
| 117 |
+
top = scores.argmax(1)
|
| 118 |
+
if i == 0:
|
| 119 |
+
independent = flash.runner.prefill(
|
| 120 |
+
torch.tensor([prefix], device=flash.device)
|
| 121 |
+
)
|
| 122 |
+
control = {
|
| 123 |
+
"prompt_only_top1": independent,
|
| 124 |
+
"teacher_forced_first_top1": top[0].item(),
|
| 125 |
+
"stock_last_top1": last,
|
| 126 |
+
"captured_last_top1": top[-1].item(),
|
| 127 |
+
}
|
| 128 |
+
if independent != top[0].item() or last != top[-1].item():
|
| 129 |
+
msg = f"causal/alignment control disagrees: {control}"
|
| 130 |
+
raise RuntimeError(msg)
|
| 131 |
+
meta.update(control=control, vocabulary=scores.shape[1])
|
| 132 |
+
(directory / "meta.json").write_text(json.dumps(meta))
|
| 133 |
+
selected = scores[:, select]
|
| 134 |
+
label = scores.gather(1, y[:, None]).squeeze(1)
|
| 135 |
+
scores[:, select] = -torch.inf
|
| 136 |
+
outside_max, outside_id = scores.max(1)
|
| 137 |
+
|
| 138 |
+
def array(x):
|
| 139 |
+
return x.cpu().numpy()
|
| 140 |
+
|
| 141 |
+
np.savez(
|
| 142 |
+
directory / (name(r) + ".npz"),
|
| 143 |
+
h=array(h.half()),
|
| 144 |
+
y=array(y),
|
| 145 |
+
selected=array(selected),
|
| 146 |
+
label=array(label),
|
| 147 |
+
outside_lse=array(scores.logsumexp(1)),
|
| 148 |
+
outside_max=array(outside_max),
|
| 149 |
+
outside_id=array(outside_id),
|
| 150 |
+
)
|
| 151 |
+
if i % 20 == 0 or i + 1 == len(rows):
|
| 152 |
+
print(f"{i + 1}/{len(rows)} complete", flush=True)
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
if __name__ == "__main__":
|
| 156 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 157 |
+
for arg in ("settings", "dataset", "directory"):
|
| 158 |
+
parser.add_argument(arg, type=Path)
|
| 159 |
+
args = parser.parse_args()
|
| 160 |
+
capture(args.settings, args.dataset, args.directory)
|
training/fit.py
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Train a rank-four GPUless head on whole Windows Internals reference answers."""
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import hashlib
|
| 5 |
+
import json
|
| 6 |
+
import time
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
import numpy as np
|
| 10 |
+
import torch
|
| 11 |
+
from gpuless_native_bridge import NativeLibrary, NativeSession
|
| 12 |
+
from gpuless_peft_export import export_peft
|
| 13 |
+
from safetensors.numpy import load_file
|
| 14 |
+
from subspace import CompactObjective, expand
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def load_features(directory, examples):
|
| 18 |
+
parts = []
|
| 19 |
+
starts, lengths = [], []
|
| 20 |
+
offset = 0
|
| 21 |
+
for row in examples:
|
| 22 |
+
path = directory / (row["id"] + "-" + row["condition"] + ".npz")
|
| 23 |
+
with np.load(path, allow_pickle=False) as data:
|
| 24 |
+
values = {k: data[k] for k in data}
|
| 25 |
+
parts.append(values)
|
| 26 |
+
starts.append(offset)
|
| 27 |
+
lengths.append(len(values["y"]))
|
| 28 |
+
offset += lengths[-1]
|
| 29 |
+
values = {k: np.concatenate([part[k] for part in parts]) for k in parts[0]}
|
| 30 |
+
return values, np.array(starts), np.array(lengths)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def basis_for(hidden):
|
| 34 |
+
torch.manual_seed(341)
|
| 35 |
+
h = torch.from_numpy(hidden.astype(np.float32))
|
| 36 |
+
_, _, v = torch.pca_lowrank(h, q=32, center=False, niter=3)
|
| 37 |
+
b = v[:, :24].T.contiguous()
|
| 38 |
+
rms = (h @ b.T).square().mean(0).sqrt().clamp_min(1e-5)
|
| 39 |
+
return (b / rms[:, None]).numpy().copy()
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def dataset_entry(data, rows, basis):
|
| 43 |
+
selected = data["selected"]
|
| 44 |
+
lse = np.logaddexp(data["outside_lse"], np.logaddexp.reduce(selected, axis=1))
|
| 45 |
+
indices = {token: i for i, token in enumerate(rows.tolist())}
|
| 46 |
+
return {
|
| 47 |
+
"hidden": np.ascontiguousarray(data["h"].astype(np.float32) @ basis.T),
|
| 48 |
+
"selected": selected,
|
| 49 |
+
"outside_lse": data["outside_lse"],
|
| 50 |
+
"base_lse": lse,
|
| 51 |
+
"reference_p": np.exp(selected - lse[:, None]),
|
| 52 |
+
"label_base": data["label"],
|
| 53 |
+
"label_indices": np.array([indices.get(int(t), -1) for t in data["y"]]),
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def score(data, rows, delta):
|
| 58 |
+
logits = data["selected"] + delta
|
| 59 |
+
denom = np.logaddexp(data["outside_lse"], np.logaddexp.reduce(logits, axis=1))
|
| 60 |
+
cols = np.searchsorted(rows, data["y"]).clip(max=len(rows) - 1)
|
| 61 |
+
targets = data["label"] + delta[np.arange(len(cols)), cols] * (
|
| 62 |
+
rows[cols] == data["y"]
|
| 63 |
+
)
|
| 64 |
+
peak = logits.argmax(1)
|
| 65 |
+
best = logits[np.arange(len(peak)), peak]
|
| 66 |
+
use_selected = (best > data["outside_max"]) | (
|
| 67 |
+
(best == data["outside_max"]) & (rows[peak] < data["outside_id"])
|
| 68 |
+
)
|
| 69 |
+
winner = np.where(
|
| 70 |
+
use_selected,
|
| 71 |
+
rows[peak],
|
| 72 |
+
data["outside_id"],
|
| 73 |
+
)
|
| 74 |
+
return denom - targets, winner == data["y"]
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def fit(features, dataset, out):
|
| 78 |
+
meta = json.loads((features / "meta.json").read_text())
|
| 79 |
+
if meta["dataset_sha256"] != hashlib.sha256(dataset.read_bytes()).hexdigest():
|
| 80 |
+
msg = "capture belongs to another dataset"
|
| 81 |
+
raise ValueError(msg)
|
| 82 |
+
examples = [json.loads(x) for x in dataset.read_text().splitlines()]
|
| 83 |
+
data, starts, lengths = load_features(features, examples)
|
| 84 |
+
train = np.array([i for i, r in enumerate(examples) if r["split"] == "train"])
|
| 85 |
+
held = {r["passage"] for r in examples if r["split"] == "test"}
|
| 86 |
+
if held & {examples[i]["passage"] for i in train}:
|
| 87 |
+
msg = "passage leaked across the split"
|
| 88 |
+
raise ValueError(msg)
|
| 89 |
+
train_positions = np.concatenate(
|
| 90 |
+
[np.arange(starts[i], starts[i] + lengths[i]) for i in train]
|
| 91 |
+
)
|
| 92 |
+
basis = basis_for(data["h"][train_positions])
|
| 93 |
+
rows = np.array(meta["rows"])
|
| 94 |
+
rank = 4
|
| 95 |
+
out.mkdir(exist_ok=False, parents=True)
|
| 96 |
+
obj = CompactObjective(basis=basis, rows=rows, rank=rank, alpha=rank)
|
| 97 |
+
obj.active = "batch"
|
| 98 |
+
entry = dataset_entry(data, rows, basis)
|
| 99 |
+
rng = np.random.default_rng(20261126)
|
| 100 |
+
initial_a = rng.normal(0, len(basis) ** -0.5, size=(rank, len(basis))).astype(
|
| 101 |
+
np.float32
|
| 102 |
+
)
|
| 103 |
+
config = {
|
| 104 |
+
"library": NativeLibrary(),
|
| 105 |
+
"model_id": meta["model"],
|
| 106 |
+
"model_revision": meta["revision"],
|
| 107 |
+
"rank": rank,
|
| 108 |
+
"alpha": rank,
|
| 109 |
+
"learning_rate": 0.008,
|
| 110 |
+
"seed": 342,
|
| 111 |
+
}
|
| 112 |
+
try:
|
| 113 |
+
with NativeSession(
|
| 114 |
+
**config,
|
| 115 |
+
target_name="lm_head.compact",
|
| 116 |
+
in_features=len(basis),
|
| 117 |
+
out_features=len(rows),
|
| 118 |
+
initial_a=initial_a,
|
| 119 |
+
initial_b=np.zeros((len(rows), rank), np.float32),
|
| 120 |
+
loss_callback=obj.callback,
|
| 121 |
+
) as session:
|
| 122 |
+
t = time.monotonic()
|
| 123 |
+
for _epoch in range(32):
|
| 124 |
+
order = rng.permutation(train)
|
| 125 |
+
for start in range(0, len(order), 16):
|
| 126 |
+
ids = order[start : start + 16]
|
| 127 |
+
# Same minibatch for all +/- measurements in the native step.
|
| 128 |
+
pos = (
|
| 129 |
+
starts[ids, None]
|
| 130 |
+
+ rng.integers(0, lengths[ids, None], (len(ids), 8))
|
| 131 |
+
).ravel()
|
| 132 |
+
obj.entries["batch"] = {k: v[pos] for k, v in entry.items()}
|
| 133 |
+
session.step(identity="batch", examples=len(ids), directions=4)
|
| 134 |
+
elapsed = time.monotonic() - t
|
| 135 |
+
a, b, generation = session.copy_adapter()
|
| 136 |
+
session.save_checkpoint(out / "compact.checkpoint")
|
| 137 |
+
np.savez(out / "space.npz", basis=basis, rows=rows)
|
| 138 |
+
full_a, full_b = expand(a, b, basis, rows, meta["vocabulary"])
|
| 139 |
+
|
| 140 |
+
def export_only(_request):
|
| 141 |
+
msg = "expanded session is serialization only"
|
| 142 |
+
raise RuntimeError(msg)
|
| 143 |
+
|
| 144 |
+
with NativeSession(
|
| 145 |
+
**config,
|
| 146 |
+
target_name="lm_head",
|
| 147 |
+
in_features=full_a.shape[1],
|
| 148 |
+
out_features=full_b.shape[0],
|
| 149 |
+
initial_a=full_a,
|
| 150 |
+
initial_b=full_b,
|
| 151 |
+
loss_callback=export_only,
|
| 152 |
+
) as expanded:
|
| 153 |
+
expanded.export_adapter(out / "lm_head.gpuless")
|
| 154 |
+
export_peft(
|
| 155 |
+
out / "lm_head.gpuless",
|
| 156 |
+
out / "peft",
|
| 157 |
+
expected_model_id=meta["model"],
|
| 158 |
+
expected_revision=meta["revision"],
|
| 159 |
+
base_model=meta["model"],
|
| 160 |
+
base_revision=meta["revision"],
|
| 161 |
+
)
|
| 162 |
+
weights = load_file(str(out / "peft/adapter_model.safetensors"))
|
| 163 |
+
delta = (
|
| 164 |
+
data["h"].astype(np.float32)
|
| 165 |
+
@ weights["base_model.model.lm_head.lora_A.weight"].T
|
| 166 |
+
) @ weights["base_model.model.lm_head.lora_B.weight"][rows].T
|
| 167 |
+
np.testing.assert_allclose(
|
| 168 |
+
delta[:128],
|
| 169 |
+
obj.ptpu.add(
|
| 170 |
+
a, b, entry["hidden"][:128], np.zeros((128, len(rows)), np.float32)
|
| 171 |
+
),
|
| 172 |
+
rtol=2e-4,
|
| 173 |
+
atol=2e-4,
|
| 174 |
+
)
|
| 175 |
+
pairs = {
|
| 176 |
+
key: score(data, rows, d)
|
| 177 |
+
for key, d in (("flash", np.zeros_like(delta)), ("lora", delta))
|
| 178 |
+
}
|
| 179 |
+
scores, per_question = {}, []
|
| 180 |
+
for i, r in enumerate(examples):
|
| 181 |
+
sel = slice(starts[i], starts[i] + lengths[i])
|
| 182 |
+
rec = {k: r[k] for k in ("id", "split", "condition", "passage")}
|
| 183 |
+
for key, (nll, acc) in pairs.items():
|
| 184 |
+
rec[key] = {
|
| 185 |
+
"mean_nll": float(nll[sel].mean()),
|
| 186 |
+
"correct": int(acc[sel].sum()),
|
| 187 |
+
}
|
| 188 |
+
rec["tokens"] = int(lengths[i])
|
| 189 |
+
per_question.append(rec)
|
| 190 |
+
for split, condition in sorted(
|
| 191 |
+
{(r["split"], r["condition"]) for r in examples}
|
| 192 |
+
):
|
| 193 |
+
group = [
|
| 194 |
+
r
|
| 195 |
+
for r in per_question
|
| 196 |
+
if (r["split"], r["condition"]) == (split, condition)
|
| 197 |
+
]
|
| 198 |
+
total = sum(r["tokens"] for r in group)
|
| 199 |
+
scores[split + "-" + condition] = {
|
| 200 |
+
"questions": len(group),
|
| 201 |
+
"tokens": total,
|
| 202 |
+
**{
|
| 203 |
+
key: {
|
| 204 |
+
"nll": sum(r[key]["mean_nll"] * r["tokens"] for r in group)
|
| 205 |
+
/ total,
|
| 206 |
+
"top1": sum(r[key]["correct"] for r in group) / total,
|
| 207 |
+
}
|
| 208 |
+
for key in pairs
|
| 209 |
+
},
|
| 210 |
+
}
|
| 211 |
+
report = {
|
| 212 |
+
"model_revision": meta["revision"],
|
| 213 |
+
"capture_control": meta["control"],
|
| 214 |
+
"optimizer": "GPUless native MeZO + pTPU",
|
| 215 |
+
"rank": rank,
|
| 216 |
+
"vocabulary_rows": len(rows),
|
| 217 |
+
"basis_dimensions": len(basis),
|
| 218 |
+
"steps": generation,
|
| 219 |
+
"directions": 4,
|
| 220 |
+
"train_seconds": elapsed,
|
| 221 |
+
"dataset_sha256": meta["dataset_sha256"],
|
| 222 |
+
"scores": scores,
|
| 223 |
+
}
|
| 224 |
+
(out / "scores.json").write_text(json.dumps(report, indent=2) + "\n")
|
| 225 |
+
(out / "question_scores.json").write_text(
|
| 226 |
+
json.dumps(per_question, indent=2) + "\n"
|
| 227 |
+
)
|
| 228 |
+
print(json.dumps(report))
|
| 229 |
+
finally:
|
| 230 |
+
obj.close()
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
if __name__ == "__main__":
|
| 234 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 235 |
+
for arg in ("features", "dataset", "out"):
|
| 236 |
+
parser.add_argument(arg, type=Path)
|
| 237 |
+
args = parser.parse_args()
|
| 238 |
+
torch.set_num_threads(2)
|
| 239 |
+
fit(args.features, args.dataset, args.out)
|
training/flash_revision.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Fingerprint the prepared weights and packed Flash runner used by a head adapter."""
|
| 2 |
+
|
| 3 |
+
import hashlib
|
| 4 |
+
import inspect
|
| 5 |
+
import json
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
from belikewater_transformers.lib.execution.moe_cuda_graph import Qwen3NextGraphRunner
|
| 9 |
+
from belikewater_transformers.lib.execution.moe_mxfp4_bank import MoeMxfp4Bank
|
| 10 |
+
from belikewater_transformers.models.qwennifer.flash_serving import _load_spine_model
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def packed_revision(inputs):
|
| 14 |
+
components = {
|
| 15 |
+
"source_revision": json.loads(
|
| 16 |
+
(inputs / "prepared/checkpoint.json").read_text()
|
| 17 |
+
)["source_revision"],
|
| 18 |
+
"prepared_identity": json.loads(
|
| 19 |
+
(inputs / "prepared/checkpoint.json").read_text()
|
| 20 |
+
)["identity"],
|
| 21 |
+
"packed_identity": json.loads((inputs / "packed/manifest.json").read_text())[
|
| 22 |
+
"identity"
|
| 23 |
+
],
|
| 24 |
+
"top_k": 6,
|
| 25 |
+
"pack_spine": True,
|
| 26 |
+
"runtime_sources": {
|
| 27 |
+
item.__name__: hashlib.sha256(
|
| 28 |
+
Path(inspect.getfile(item)).read_bytes()
|
| 29 |
+
).hexdigest()
|
| 30 |
+
for item in (_load_spine_model, Qwen3NextGraphRunner, MoeMxfp4Bank)
|
| 31 |
+
},
|
| 32 |
+
}
|
| 33 |
+
return hashlib.sha256(json.dumps(components, sort_keys=True).encode()).hexdigest()
|
training/question_scores.json
ADDED
|
@@ -0,0 +1,1112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"id": "26727884ca7fc53a",
|
| 4 |
+
"split": "train",
|
| 5 |
+
"condition": "closed",
|
| 6 |
+
"passage": "context-switches",
|
| 7 |
+
"flash": {
|
| 8 |
+
"mean_nll": 3.835658073425293,
|
| 9 |
+
"correct": 13
|
| 10 |
+
},
|
| 11 |
+
"lora": {
|
| 12 |
+
"mean_nll": 3.6817197799682617,
|
| 13 |
+
"correct": 15
|
| 14 |
+
},
|
| 15 |
+
"tokens": 29
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"id": "26727884ca7fc53a",
|
| 19 |
+
"split": "train",
|
| 20 |
+
"condition": "rag",
|
| 21 |
+
"passage": "context-switches",
|
| 22 |
+
"flash": {
|
| 23 |
+
"mean_nll": 1.7513713836669922,
|
| 24 |
+
"correct": 36
|
| 25 |
+
},
|
| 26 |
+
"lora": {
|
| 27 |
+
"mean_nll": 1.6236258745193481,
|
| 28 |
+
"correct": 39
|
| 29 |
+
},
|
| 30 |
+
"tokens": 52
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"id": "135713966a6f127b",
|
| 34 |
+
"split": "train",
|
| 35 |
+
"condition": "closed",
|
| 36 |
+
"passage": "context-switches",
|
| 37 |
+
"flash": {
|
| 38 |
+
"mean_nll": 3.932403802871704,
|
| 39 |
+
"correct": 7
|
| 40 |
+
},
|
| 41 |
+
"lora": {
|
| 42 |
+
"mean_nll": 3.4868528842926025,
|
| 43 |
+
"correct": 9
|
| 44 |
+
},
|
| 45 |
+
"tokens": 23
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"id": "135713966a6f127b",
|
| 49 |
+
"split": "train",
|
| 50 |
+
"condition": "rag",
|
| 51 |
+
"passage": "context-switches",
|
| 52 |
+
"flash": {
|
| 53 |
+
"mean_nll": 6.22878885269165,
|
| 54 |
+
"correct": 4
|
| 55 |
+
},
|
| 56 |
+
"lora": {
|
| 57 |
+
"mean_nll": 5.721571922302246,
|
| 58 |
+
"correct": 5
|
| 59 |
+
},
|
| 60 |
+
"tokens": 17
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"id": "a46efb9bef14e278",
|
| 64 |
+
"split": "train",
|
| 65 |
+
"condition": "closed",
|
| 66 |
+
"passage": "thread-local-storage",
|
| 67 |
+
"flash": {
|
| 68 |
+
"mean_nll": 3.1106956005096436,
|
| 69 |
+
"correct": 8
|
| 70 |
+
},
|
| 71 |
+
"lora": {
|
| 72 |
+
"mean_nll": 2.9010205268859863,
|
| 73 |
+
"correct": 9
|
| 74 |
+
},
|
| 75 |
+
"tokens": 22
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"id": "a46efb9bef14e278",
|
| 79 |
+
"split": "train",
|
| 80 |
+
"condition": "rag",
|
| 81 |
+
"passage": "thread-local-storage",
|
| 82 |
+
"flash": {
|
| 83 |
+
"mean_nll": 1.8656303882598877,
|
| 84 |
+
"correct": 29
|
| 85 |
+
},
|
| 86 |
+
"lora": {
|
| 87 |
+
"mean_nll": 1.7325763702392578,
|
| 88 |
+
"correct": 30
|
| 89 |
+
},
|
| 90 |
+
"tokens": 45
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"id": "ee4857c32a20fd9a",
|
| 94 |
+
"split": "train",
|
| 95 |
+
"condition": "closed",
|
| 96 |
+
"passage": "thread-local-storage",
|
| 97 |
+
"flash": {
|
| 98 |
+
"mean_nll": 4.084249973297119,
|
| 99 |
+
"correct": 8
|
| 100 |
+
},
|
| 101 |
+
"lora": {
|
| 102 |
+
"mean_nll": 3.7396414279937744,
|
| 103 |
+
"correct": 11
|
| 104 |
+
},
|
| 105 |
+
"tokens": 22
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"id": "ee4857c32a20fd9a",
|
| 109 |
+
"split": "train",
|
| 110 |
+
"condition": "rag",
|
| 111 |
+
"passage": "thread-local-storage",
|
| 112 |
+
"flash": {
|
| 113 |
+
"mean_nll": 2.5733070373535156,
|
| 114 |
+
"correct": 28
|
| 115 |
+
},
|
| 116 |
+
"lora": {
|
| 117 |
+
"mean_nll": 2.3333256244659424,
|
| 118 |
+
"correct": 30
|
| 119 |
+
},
|
| 120 |
+
"tokens": 45
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"id": "ac937ed63b06141e",
|
| 124 |
+
"split": "train",
|
| 125 |
+
"condition": "closed",
|
| 126 |
+
"passage": "job-objects",
|
| 127 |
+
"flash": {
|
| 128 |
+
"mean_nll": 2.6504831314086914,
|
| 129 |
+
"correct": 9
|
| 130 |
+
},
|
| 131 |
+
"lora": {
|
| 132 |
+
"mean_nll": 2.537188768386841,
|
| 133 |
+
"correct": 9
|
| 134 |
+
},
|
| 135 |
+
"tokens": 20
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"id": "ac937ed63b06141e",
|
| 139 |
+
"split": "train",
|
| 140 |
+
"condition": "rag",
|
| 141 |
+
"passage": "job-objects",
|
| 142 |
+
"flash": {
|
| 143 |
+
"mean_nll": 1.6515543460845947,
|
| 144 |
+
"correct": 30
|
| 145 |
+
},
|
| 146 |
+
"lora": {
|
| 147 |
+
"mean_nll": 1.538026213645935,
|
| 148 |
+
"correct": 31
|
| 149 |
+
},
|
| 150 |
+
"tokens": 42
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"id": "83bf2317b18d0b4b",
|
| 154 |
+
"split": "train",
|
| 155 |
+
"condition": "closed",
|
| 156 |
+
"passage": "job-objects",
|
| 157 |
+
"flash": {
|
| 158 |
+
"mean_nll": 3.2790722846984863,
|
| 159 |
+
"correct": 8
|
| 160 |
+
},
|
| 161 |
+
"lora": {
|
| 162 |
+
"mean_nll": 3.1433093547821045,
|
| 163 |
+
"correct": 7
|
| 164 |
+
},
|
| 165 |
+
"tokens": 16
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"id": "83bf2317b18d0b4b",
|
| 169 |
+
"split": "train",
|
| 170 |
+
"condition": "rag",
|
| 171 |
+
"passage": "job-objects",
|
| 172 |
+
"flash": {
|
| 173 |
+
"mean_nll": 1.8746263980865479,
|
| 174 |
+
"correct": 26
|
| 175 |
+
},
|
| 176 |
+
"lora": {
|
| 177 |
+
"mean_nll": 1.741416573524475,
|
| 178 |
+
"correct": 28
|
| 179 |
+
},
|
| 180 |
+
"tokens": 38
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"id": "99bc41280df74db4",
|
| 184 |
+
"split": "train",
|
| 185 |
+
"condition": "closed",
|
| 186 |
+
"passage": "process-handles-and-identifiers",
|
| 187 |
+
"flash": {
|
| 188 |
+
"mean_nll": 2.62675404548645,
|
| 189 |
+
"correct": 8
|
| 190 |
+
},
|
| 191 |
+
"lora": {
|
| 192 |
+
"mean_nll": 2.573768138885498,
|
| 193 |
+
"correct": 8
|
| 194 |
+
},
|
| 195 |
+
"tokens": 18
|
| 196 |
+
},
|
| 197 |
+
{
|
| 198 |
+
"id": "99bc41280df74db4",
|
| 199 |
+
"split": "train",
|
| 200 |
+
"condition": "rag",
|
| 201 |
+
"passage": "process-handles-and-identifiers",
|
| 202 |
+
"flash": {
|
| 203 |
+
"mean_nll": 1.6315230131149292,
|
| 204 |
+
"correct": 36
|
| 205 |
+
},
|
| 206 |
+
"lora": {
|
| 207 |
+
"mean_nll": 1.5310763120651245,
|
| 208 |
+
"correct": 37
|
| 209 |
+
},
|
| 210 |
+
"tokens": 47
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"id": "6c18488e1da9bdc1",
|
| 214 |
+
"split": "train",
|
| 215 |
+
"condition": "closed",
|
| 216 |
+
"passage": "process-handles-and-identifiers",
|
| 217 |
+
"flash": {
|
| 218 |
+
"mean_nll": 5.170638084411621,
|
| 219 |
+
"correct": 5
|
| 220 |
+
},
|
| 221 |
+
"lora": {
|
| 222 |
+
"mean_nll": 4.811892032623291,
|
| 223 |
+
"correct": 6
|
| 224 |
+
},
|
| 225 |
+
"tokens": 20
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"id": "6c18488e1da9bdc1",
|
| 229 |
+
"split": "train",
|
| 230 |
+
"condition": "rag",
|
| 231 |
+
"passage": "process-handles-and-identifiers",
|
| 232 |
+
"flash": {
|
| 233 |
+
"mean_nll": 2.4070186614990234,
|
| 234 |
+
"correct": 31
|
| 235 |
+
},
|
| 236 |
+
"lora": {
|
| 237 |
+
"mean_nll": 2.2189829349517822,
|
| 238 |
+
"correct": 32
|
| 239 |
+
},
|
| 240 |
+
"tokens": 49
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"id": "b4cfb7ea53001996",
|
| 244 |
+
"split": "train",
|
| 245 |
+
"condition": "closed",
|
| 246 |
+
"passage": "scheduling-priorities",
|
| 247 |
+
"flash": {
|
| 248 |
+
"mean_nll": 2.4157862663269043,
|
| 249 |
+
"correct": 11
|
| 250 |
+
},
|
| 251 |
+
"lora": {
|
| 252 |
+
"mean_nll": 2.459322929382324,
|
| 253 |
+
"correct": 11
|
| 254 |
+
},
|
| 255 |
+
"tokens": 18
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"id": "b4cfb7ea53001996",
|
| 259 |
+
"split": "train",
|
| 260 |
+
"condition": "rag",
|
| 261 |
+
"passage": "scheduling-priorities",
|
| 262 |
+
"flash": {
|
| 263 |
+
"mean_nll": 1.4559326171875,
|
| 264 |
+
"correct": 34
|
| 265 |
+
},
|
| 266 |
+
"lora": {
|
| 267 |
+
"mean_nll": 1.3411732912063599,
|
| 268 |
+
"correct": 35
|
| 269 |
+
},
|
| 270 |
+
"tokens": 44
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"id": "65f43834d750ddfb",
|
| 274 |
+
"split": "train",
|
| 275 |
+
"condition": "closed",
|
| 276 |
+
"passage": "scheduling-priorities",
|
| 277 |
+
"flash": {
|
| 278 |
+
"mean_nll": 3.1031622886657715,
|
| 279 |
+
"correct": 7
|
| 280 |
+
},
|
| 281 |
+
"lora": {
|
| 282 |
+
"mean_nll": 2.943216323852539,
|
| 283 |
+
"correct": 8
|
| 284 |
+
},
|
| 285 |
+
"tokens": 17
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"id": "65f43834d750ddfb",
|
| 289 |
+
"split": "train",
|
| 290 |
+
"condition": "rag",
|
| 291 |
+
"passage": "scheduling-priorities",
|
| 292 |
+
"flash": {
|
| 293 |
+
"mean_nll": 2.0419139862060547,
|
| 294 |
+
"correct": 30
|
| 295 |
+
},
|
| 296 |
+
"lora": {
|
| 297 |
+
"mean_nll": 1.9256377220153809,
|
| 298 |
+
"correct": 32
|
| 299 |
+
},
|
| 300 |
+
"tokens": 43
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"id": "d497b19680efa90f",
|
| 304 |
+
"split": "test",
|
| 305 |
+
"condition": "closed",
|
| 306 |
+
"passage": "event-objects",
|
| 307 |
+
"flash": {
|
| 308 |
+
"mean_nll": 1.572029948234558,
|
| 309 |
+
"correct": 8
|
| 310 |
+
},
|
| 311 |
+
"lora": {
|
| 312 |
+
"mean_nll": 1.5165456533432007,
|
| 313 |
+
"correct": 10
|
| 314 |
+
},
|
| 315 |
+
"tokens": 15
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
"id": "d497b19680efa90f",
|
| 319 |
+
"split": "test",
|
| 320 |
+
"condition": "rag",
|
| 321 |
+
"passage": "event-objects",
|
| 322 |
+
"flash": {
|
| 323 |
+
"mean_nll": 1.4004271030426025,
|
| 324 |
+
"correct": 30
|
| 325 |
+
},
|
| 326 |
+
"lora": {
|
| 327 |
+
"mean_nll": 1.3160618543624878,
|
| 328 |
+
"correct": 31
|
| 329 |
+
},
|
| 330 |
+
"tokens": 40
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"id": "28d7a921a876ccfd",
|
| 334 |
+
"split": "test",
|
| 335 |
+
"condition": "closed",
|
| 336 |
+
"passage": "event-objects",
|
| 337 |
+
"flash": {
|
| 338 |
+
"mean_nll": 2.8607497215270996,
|
| 339 |
+
"correct": 7
|
| 340 |
+
},
|
| 341 |
+
"lora": {
|
| 342 |
+
"mean_nll": 2.9103078842163086,
|
| 343 |
+
"correct": 6
|
| 344 |
+
},
|
| 345 |
+
"tokens": 17
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"id": "28d7a921a876ccfd",
|
| 349 |
+
"split": "test",
|
| 350 |
+
"condition": "rag",
|
| 351 |
+
"passage": "event-objects",
|
| 352 |
+
"flash": {
|
| 353 |
+
"mean_nll": 2.110501527786255,
|
| 354 |
+
"correct": 27
|
| 355 |
+
},
|
| 356 |
+
"lora": {
|
| 357 |
+
"mean_nll": 2.0051865577697754,
|
| 358 |
+
"correct": 29
|
| 359 |
+
},
|
| 360 |
+
"tokens": 42
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"id": "a3ba187f17e1c64b",
|
| 364 |
+
"split": "train",
|
| 365 |
+
"condition": "closed",
|
| 366 |
+
"passage": "mutex-objects",
|
| 367 |
+
"flash": {
|
| 368 |
+
"mean_nll": 3.0384654998779297,
|
| 369 |
+
"correct": 12
|
| 370 |
+
},
|
| 371 |
+
"lora": {
|
| 372 |
+
"mean_nll": 2.7222280502319336,
|
| 373 |
+
"correct": 13
|
| 374 |
+
},
|
| 375 |
+
"tokens": 23
|
| 376 |
+
},
|
| 377 |
+
{
|
| 378 |
+
"id": "a3ba187f17e1c64b",
|
| 379 |
+
"split": "train",
|
| 380 |
+
"condition": "rag",
|
| 381 |
+
"passage": "mutex-objects",
|
| 382 |
+
"flash": {
|
| 383 |
+
"mean_nll": 2.124375820159912,
|
| 384 |
+
"correct": 28
|
| 385 |
+
},
|
| 386 |
+
"lora": {
|
| 387 |
+
"mean_nll": 1.9009838104248047,
|
| 388 |
+
"correct": 29
|
| 389 |
+
},
|
| 390 |
+
"tokens": 45
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"id": "bc2537f2d6d54575",
|
| 394 |
+
"split": "train",
|
| 395 |
+
"condition": "closed",
|
| 396 |
+
"passage": "mutex-objects",
|
| 397 |
+
"flash": {
|
| 398 |
+
"mean_nll": 3.0661392211914062,
|
| 399 |
+
"correct": 8
|
| 400 |
+
},
|
| 401 |
+
"lora": {
|
| 402 |
+
"mean_nll": 2.6862053871154785,
|
| 403 |
+
"correct": 9
|
| 404 |
+
},
|
| 405 |
+
"tokens": 19
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"id": "bc2537f2d6d54575",
|
| 409 |
+
"split": "train",
|
| 410 |
+
"condition": "rag",
|
| 411 |
+
"passage": "mutex-objects",
|
| 412 |
+
"flash": {
|
| 413 |
+
"mean_nll": 2.2782504558563232,
|
| 414 |
+
"correct": 25
|
| 415 |
+
},
|
| 416 |
+
"lora": {
|
| 417 |
+
"mean_nll": 2.0942506790161133,
|
| 418 |
+
"correct": 28
|
| 419 |
+
},
|
| 420 |
+
"tokens": 41
|
| 421 |
+
},
|
| 422 |
+
{
|
| 423 |
+
"id": "adef7ffbc7186548",
|
| 424 |
+
"split": "train",
|
| 425 |
+
"condition": "closed",
|
| 426 |
+
"passage": "semaphore-objects",
|
| 427 |
+
"flash": {
|
| 428 |
+
"mean_nll": 3.160313367843628,
|
| 429 |
+
"correct": 13
|
| 430 |
+
},
|
| 431 |
+
"lora": {
|
| 432 |
+
"mean_nll": 3.0055582523345947,
|
| 433 |
+
"correct": 14
|
| 434 |
+
},
|
| 435 |
+
"tokens": 24
|
| 436 |
+
},
|
| 437 |
+
{
|
| 438 |
+
"id": "adef7ffbc7186548",
|
| 439 |
+
"split": "train",
|
| 440 |
+
"condition": "rag",
|
| 441 |
+
"passage": "semaphore-objects",
|
| 442 |
+
"flash": {
|
| 443 |
+
"mean_nll": 2.4587063789367676,
|
| 444 |
+
"correct": 33
|
| 445 |
+
},
|
| 446 |
+
"lora": {
|
| 447 |
+
"mean_nll": 2.380735397338867,
|
| 448 |
+
"correct": 34
|
| 449 |
+
},
|
| 450 |
+
"tokens": 47
|
| 451 |
+
},
|
| 452 |
+
{
|
| 453 |
+
"id": "ab0c352f8d26d689",
|
| 454 |
+
"split": "train",
|
| 455 |
+
"condition": "closed",
|
| 456 |
+
"passage": "semaphore-objects",
|
| 457 |
+
"flash": {
|
| 458 |
+
"mean_nll": 3.3603734970092773,
|
| 459 |
+
"correct": 7
|
| 460 |
+
},
|
| 461 |
+
"lora": {
|
| 462 |
+
"mean_nll": 3.2218546867370605,
|
| 463 |
+
"correct": 8
|
| 464 |
+
},
|
| 465 |
+
"tokens": 17
|
| 466 |
+
},
|
| 467 |
+
{
|
| 468 |
+
"id": "ab0c352f8d26d689",
|
| 469 |
+
"split": "train",
|
| 470 |
+
"condition": "rag",
|
| 471 |
+
"passage": "semaphore-objects",
|
| 472 |
+
"flash": {
|
| 473 |
+
"mean_nll": 1.6529572010040283,
|
| 474 |
+
"correct": 29
|
| 475 |
+
},
|
| 476 |
+
"lora": {
|
| 477 |
+
"mean_nll": 1.5224491357803345,
|
| 478 |
+
"correct": 31
|
| 479 |
+
},
|
| 480 |
+
"tokens": 40
|
| 481 |
+
},
|
| 482 |
+
{
|
| 483 |
+
"id": "07fab401e0635f69",
|
| 484 |
+
"split": "train",
|
| 485 |
+
"condition": "closed",
|
| 486 |
+
"passage": "critical-section-objects",
|
| 487 |
+
"flash": {
|
| 488 |
+
"mean_nll": 4.545591831207275,
|
| 489 |
+
"correct": 6
|
| 490 |
+
},
|
| 491 |
+
"lora": {
|
| 492 |
+
"mean_nll": 4.23426628112793,
|
| 493 |
+
"correct": 9
|
| 494 |
+
},
|
| 495 |
+
"tokens": 19
|
| 496 |
+
},
|
| 497 |
+
{
|
| 498 |
+
"id": "07fab401e0635f69",
|
| 499 |
+
"split": "train",
|
| 500 |
+
"condition": "rag",
|
| 501 |
+
"passage": "critical-section-objects",
|
| 502 |
+
"flash": {
|
| 503 |
+
"mean_nll": 2.2960572242736816,
|
| 504 |
+
"correct": 27
|
| 505 |
+
},
|
| 506 |
+
"lora": {
|
| 507 |
+
"mean_nll": 2.0883841514587402,
|
| 508 |
+
"correct": 28
|
| 509 |
+
},
|
| 510 |
+
"tokens": 43
|
| 511 |
+
},
|
| 512 |
+
{
|
| 513 |
+
"id": "a4a125c48a499822",
|
| 514 |
+
"split": "train",
|
| 515 |
+
"condition": "closed",
|
| 516 |
+
"passage": "critical-section-objects",
|
| 517 |
+
"flash": {
|
| 518 |
+
"mean_nll": 3.1411564350128174,
|
| 519 |
+
"correct": 8
|
| 520 |
+
},
|
| 521 |
+
"lora": {
|
| 522 |
+
"mean_nll": 3.0524656772613525,
|
| 523 |
+
"correct": 10
|
| 524 |
+
},
|
| 525 |
+
"tokens": 18
|
| 526 |
+
},
|
| 527 |
+
{
|
| 528 |
+
"id": "a4a125c48a499822",
|
| 529 |
+
"split": "train",
|
| 530 |
+
"condition": "rag",
|
| 531 |
+
"passage": "critical-section-objects",
|
| 532 |
+
"flash": {
|
| 533 |
+
"mean_nll": 1.6342588663101196,
|
| 534 |
+
"correct": 30
|
| 535 |
+
},
|
| 536 |
+
"lora": {
|
| 537 |
+
"mean_nll": 1.5883421897888184,
|
| 538 |
+
"correct": 31
|
| 539 |
+
},
|
| 540 |
+
"tokens": 42
|
| 541 |
+
},
|
| 542 |
+
{
|
| 543 |
+
"id": "71fba3d72f092acc",
|
| 544 |
+
"split": "test",
|
| 545 |
+
"condition": "closed",
|
| 546 |
+
"passage": "condition-variables",
|
| 547 |
+
"flash": {
|
| 548 |
+
"mean_nll": 3.264629602432251,
|
| 549 |
+
"correct": 13
|
| 550 |
+
},
|
| 551 |
+
"lora": {
|
| 552 |
+
"mean_nll": 3.0017788410186768,
|
| 553 |
+
"correct": 13
|
| 554 |
+
},
|
| 555 |
+
"tokens": 25
|
| 556 |
+
},
|
| 557 |
+
{
|
| 558 |
+
"id": "71fba3d72f092acc",
|
| 559 |
+
"split": "test",
|
| 560 |
+
"condition": "rag",
|
| 561 |
+
"passage": "condition-variables",
|
| 562 |
+
"flash": {
|
| 563 |
+
"mean_nll": 1.9979974031448364,
|
| 564 |
+
"correct": 34
|
| 565 |
+
},
|
| 566 |
+
"lora": {
|
| 567 |
+
"mean_nll": 1.8300758600234985,
|
| 568 |
+
"correct": 33
|
| 569 |
+
},
|
| 570 |
+
"tokens": 47
|
| 571 |
+
},
|
| 572 |
+
{
|
| 573 |
+
"id": "8d0cd1227652f084",
|
| 574 |
+
"split": "test",
|
| 575 |
+
"condition": "closed",
|
| 576 |
+
"passage": "condition-variables",
|
| 577 |
+
"flash": {
|
| 578 |
+
"mean_nll": 2.6181111335754395,
|
| 579 |
+
"correct": 12
|
| 580 |
+
},
|
| 581 |
+
"lora": {
|
| 582 |
+
"mean_nll": 2.722249984741211,
|
| 583 |
+
"correct": 13
|
| 584 |
+
},
|
| 585 |
+
"tokens": 27
|
| 586 |
+
},
|
| 587 |
+
{
|
| 588 |
+
"id": "8d0cd1227652f084",
|
| 589 |
+
"split": "test",
|
| 590 |
+
"condition": "rag",
|
| 591 |
+
"passage": "condition-variables",
|
| 592 |
+
"flash": {
|
| 593 |
+
"mean_nll": 2.1501781940460205,
|
| 594 |
+
"correct": 29
|
| 595 |
+
},
|
| 596 |
+
"lora": {
|
| 597 |
+
"mean_nll": 2.0372979640960693,
|
| 598 |
+
"correct": 31
|
| 599 |
+
},
|
| 600 |
+
"tokens": 49
|
| 601 |
+
},
|
| 602 |
+
{
|
| 603 |
+
"id": "73f578a54803cb1f",
|
| 604 |
+
"split": "train",
|
| 605 |
+
"condition": "closed",
|
| 606 |
+
"passage": "working-set",
|
| 607 |
+
"flash": {
|
| 608 |
+
"mean_nll": 3.6927664279937744,
|
| 609 |
+
"correct": 10
|
| 610 |
+
},
|
| 611 |
+
"lora": {
|
| 612 |
+
"mean_nll": 3.5958023071289062,
|
| 613 |
+
"correct": 11
|
| 614 |
+
},
|
| 615 |
+
"tokens": 18
|
| 616 |
+
},
|
| 617 |
+
{
|
| 618 |
+
"id": "73f578a54803cb1f",
|
| 619 |
+
"split": "train",
|
| 620 |
+
"condition": "rag",
|
| 621 |
+
"passage": "working-set",
|
| 622 |
+
"flash": {
|
| 623 |
+
"mean_nll": 1.978613257408142,
|
| 624 |
+
"correct": 27
|
| 625 |
+
},
|
| 626 |
+
"lora": {
|
| 627 |
+
"mean_nll": 1.8766602277755737,
|
| 628 |
+
"correct": 28
|
| 629 |
+
},
|
| 630 |
+
"tokens": 38
|
| 631 |
+
},
|
| 632 |
+
{
|
| 633 |
+
"id": "5886e023585c0938",
|
| 634 |
+
"split": "train",
|
| 635 |
+
"condition": "closed",
|
| 636 |
+
"passage": "working-set",
|
| 637 |
+
"flash": {
|
| 638 |
+
"mean_nll": 3.2556610107421875,
|
| 639 |
+
"correct": 11
|
| 640 |
+
},
|
| 641 |
+
"lora": {
|
| 642 |
+
"mean_nll": 3.032742500305176,
|
| 643 |
+
"correct": 12
|
| 644 |
+
},
|
| 645 |
+
"tokens": 25
|
| 646 |
+
},
|
| 647 |
+
{
|
| 648 |
+
"id": "5886e023585c0938",
|
| 649 |
+
"split": "train",
|
| 650 |
+
"condition": "rag",
|
| 651 |
+
"passage": "working-set",
|
| 652 |
+
"flash": {
|
| 653 |
+
"mean_nll": 2.337414264678955,
|
| 654 |
+
"correct": 27
|
| 655 |
+
},
|
| 656 |
+
"lora": {
|
| 657 |
+
"mean_nll": 2.104919672012329,
|
| 658 |
+
"correct": 27
|
| 659 |
+
},
|
| 660 |
+
"tokens": 45
|
| 661 |
+
},
|
| 662 |
+
{
|
| 663 |
+
"id": "337696dff8cfe026",
|
| 664 |
+
"split": "train",
|
| 665 |
+
"condition": "closed",
|
| 666 |
+
"passage": "page-state",
|
| 667 |
+
"flash": {
|
| 668 |
+
"mean_nll": 4.235867977142334,
|
| 669 |
+
"correct": 10
|
| 670 |
+
},
|
| 671 |
+
"lora": {
|
| 672 |
+
"mean_nll": 3.9847841262817383,
|
| 673 |
+
"correct": 11
|
| 674 |
+
},
|
| 675 |
+
"tokens": 22
|
| 676 |
+
},
|
| 677 |
+
{
|
| 678 |
+
"id": "337696dff8cfe026",
|
| 679 |
+
"split": "train",
|
| 680 |
+
"condition": "rag",
|
| 681 |
+
"passage": "page-state",
|
| 682 |
+
"flash": {
|
| 683 |
+
"mean_nll": 2.7814338207244873,
|
| 684 |
+
"correct": 26
|
| 685 |
+
},
|
| 686 |
+
"lora": {
|
| 687 |
+
"mean_nll": 2.5785064697265625,
|
| 688 |
+
"correct": 27
|
| 689 |
+
},
|
| 690 |
+
"tokens": 41
|
| 691 |
+
},
|
| 692 |
+
{
|
| 693 |
+
"id": "7cd0368a0d148c67",
|
| 694 |
+
"split": "train",
|
| 695 |
+
"condition": "closed",
|
| 696 |
+
"passage": "page-state",
|
| 697 |
+
"flash": {
|
| 698 |
+
"mean_nll": 5.322478771209717,
|
| 699 |
+
"correct": 5
|
| 700 |
+
},
|
| 701 |
+
"lora": {
|
| 702 |
+
"mean_nll": 5.139901161193848,
|
| 703 |
+
"correct": 5
|
| 704 |
+
},
|
| 705 |
+
"tokens": 15
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
"id": "7cd0368a0d148c67",
|
| 709 |
+
"split": "train",
|
| 710 |
+
"condition": "rag",
|
| 711 |
+
"passage": "page-state",
|
| 712 |
+
"flash": {
|
| 713 |
+
"mean_nll": 2.8352835178375244,
|
| 714 |
+
"correct": 22
|
| 715 |
+
},
|
| 716 |
+
"lora": {
|
| 717 |
+
"mean_nll": 2.698272705078125,
|
| 718 |
+
"correct": 23
|
| 719 |
+
},
|
| 720 |
+
"tokens": 34
|
| 721 |
+
},
|
| 722 |
+
{
|
| 723 |
+
"id": "0535c31f8d60ce73",
|
| 724 |
+
"split": "train",
|
| 725 |
+
"condition": "closed",
|
| 726 |
+
"passage": "file-mapping",
|
| 727 |
+
"flash": {
|
| 728 |
+
"mean_nll": 3.0076005458831787,
|
| 729 |
+
"correct": 14
|
| 730 |
+
},
|
| 731 |
+
"lora": {
|
| 732 |
+
"mean_nll": 2.88376522064209,
|
| 733 |
+
"correct": 14
|
| 734 |
+
},
|
| 735 |
+
"tokens": 23
|
| 736 |
+
},
|
| 737 |
+
{
|
| 738 |
+
"id": "0535c31f8d60ce73",
|
| 739 |
+
"split": "train",
|
| 740 |
+
"condition": "rag",
|
| 741 |
+
"passage": "file-mapping",
|
| 742 |
+
"flash": {
|
| 743 |
+
"mean_nll": 2.2352850437164307,
|
| 744 |
+
"correct": 34
|
| 745 |
+
},
|
| 746 |
+
"lora": {
|
| 747 |
+
"mean_nll": 2.1270103454589844,
|
| 748 |
+
"correct": 35
|
| 749 |
+
},
|
| 750 |
+
"tokens": 43
|
| 751 |
+
},
|
| 752 |
+
{
|
| 753 |
+
"id": "4986e6425377db21",
|
| 754 |
+
"split": "train",
|
| 755 |
+
"condition": "closed",
|
| 756 |
+
"passage": "file-mapping",
|
| 757 |
+
"flash": {
|
| 758 |
+
"mean_nll": 3.003222942352295,
|
| 759 |
+
"correct": 10
|
| 760 |
+
},
|
| 761 |
+
"lora": {
|
| 762 |
+
"mean_nll": 2.7659006118774414,
|
| 763 |
+
"correct": 11
|
| 764 |
+
},
|
| 765 |
+
"tokens": 18
|
| 766 |
+
},
|
| 767 |
+
{
|
| 768 |
+
"id": "4986e6425377db21",
|
| 769 |
+
"split": "train",
|
| 770 |
+
"condition": "rag",
|
| 771 |
+
"passage": "file-mapping",
|
| 772 |
+
"flash": {
|
| 773 |
+
"mean_nll": 1.8499988317489624,
|
| 774 |
+
"correct": 27
|
| 775 |
+
},
|
| 776 |
+
"lora": {
|
| 777 |
+
"mean_nll": 1.7091232538223267,
|
| 778 |
+
"correct": 29
|
| 779 |
+
},
|
| 780 |
+
"tokens": 38
|
| 781 |
+
},
|
| 782 |
+
{
|
| 783 |
+
"id": "10a12e19289b92e2",
|
| 784 |
+
"split": "test",
|
| 785 |
+
"condition": "closed",
|
| 786 |
+
"passage": "i-o-completion-ports",
|
| 787 |
+
"flash": {
|
| 788 |
+
"mean_nll": 3.4782559871673584,
|
| 789 |
+
"correct": 18
|
| 790 |
+
},
|
| 791 |
+
"lora": {
|
| 792 |
+
"mean_nll": 3.4347903728485107,
|
| 793 |
+
"correct": 20
|
| 794 |
+
},
|
| 795 |
+
"tokens": 31
|
| 796 |
+
},
|
| 797 |
+
{
|
| 798 |
+
"id": "10a12e19289b92e2",
|
| 799 |
+
"split": "test",
|
| 800 |
+
"condition": "rag",
|
| 801 |
+
"passage": "i-o-completion-ports",
|
| 802 |
+
"flash": {
|
| 803 |
+
"mean_nll": 2.274474620819092,
|
| 804 |
+
"correct": 38
|
| 805 |
+
},
|
| 806 |
+
"lora": {
|
| 807 |
+
"mean_nll": 2.1701180934906006,
|
| 808 |
+
"correct": 40
|
| 809 |
+
},
|
| 810 |
+
"tokens": 57
|
| 811 |
+
},
|
| 812 |
+
{
|
| 813 |
+
"id": "33a8e51629783b38",
|
| 814 |
+
"split": "test",
|
| 815 |
+
"condition": "closed",
|
| 816 |
+
"passage": "i-o-completion-ports",
|
| 817 |
+
"flash": {
|
| 818 |
+
"mean_nll": 3.6295528411865234,
|
| 819 |
+
"correct": 10
|
| 820 |
+
},
|
| 821 |
+
"lora": {
|
| 822 |
+
"mean_nll": 3.4966249465942383,
|
| 823 |
+
"correct": 11
|
| 824 |
+
},
|
| 825 |
+
"tokens": 21
|
| 826 |
+
},
|
| 827 |
+
{
|
| 828 |
+
"id": "33a8e51629783b38",
|
| 829 |
+
"split": "test",
|
| 830 |
+
"condition": "rag",
|
| 831 |
+
"passage": "i-o-completion-ports",
|
| 832 |
+
"flash": {
|
| 833 |
+
"mean_nll": 2.1079041957855225,
|
| 834 |
+
"correct": 33
|
| 835 |
+
},
|
| 836 |
+
"lora": {
|
| 837 |
+
"mean_nll": 2.02693510055542,
|
| 838 |
+
"correct": 33
|
| 839 |
+
},
|
| 840 |
+
"tokens": 47
|
| 841 |
+
},
|
| 842 |
+
{
|
| 843 |
+
"id": "b8230e8f33f93be2",
|
| 844 |
+
"split": "train",
|
| 845 |
+
"condition": "closed",
|
| 846 |
+
"passage": "synchronous-and-asynchronous-i-o",
|
| 847 |
+
"flash": {
|
| 848 |
+
"mean_nll": 3.363334894180298,
|
| 849 |
+
"correct": 11
|
| 850 |
+
},
|
| 851 |
+
"lora": {
|
| 852 |
+
"mean_nll": 3.150026798248291,
|
| 853 |
+
"correct": 11
|
| 854 |
+
},
|
| 855 |
+
"tokens": 25
|
| 856 |
+
},
|
| 857 |
+
{
|
| 858 |
+
"id": "b8230e8f33f93be2",
|
| 859 |
+
"split": "train",
|
| 860 |
+
"condition": "rag",
|
| 861 |
+
"passage": "synchronous-and-asynchronous-i-o",
|
| 862 |
+
"flash": {
|
| 863 |
+
"mean_nll": 2.2063217163085938,
|
| 864 |
+
"correct": 37
|
| 865 |
+
},
|
| 866 |
+
"lora": {
|
| 867 |
+
"mean_nll": 2.076813220977783,
|
| 868 |
+
"correct": 37
|
| 869 |
+
},
|
| 870 |
+
"tokens": 54
|
| 871 |
+
},
|
| 872 |
+
{
|
| 873 |
+
"id": "a1e6774ce4d5ae00",
|
| 874 |
+
"split": "train",
|
| 875 |
+
"condition": "closed",
|
| 876 |
+
"passage": "synchronous-and-asynchronous-i-o",
|
| 877 |
+
"flash": {
|
| 878 |
+
"mean_nll": 3.752692699432373,
|
| 879 |
+
"correct": 9
|
| 880 |
+
},
|
| 881 |
+
"lora": {
|
| 882 |
+
"mean_nll": 3.4776742458343506,
|
| 883 |
+
"correct": 9
|
| 884 |
+
},
|
| 885 |
+
"tokens": 21
|
| 886 |
+
},
|
| 887 |
+
{
|
| 888 |
+
"id": "a1e6774ce4d5ae00",
|
| 889 |
+
"split": "train",
|
| 890 |
+
"condition": "rag",
|
| 891 |
+
"passage": "synchronous-and-asynchronous-i-o",
|
| 892 |
+
"flash": {
|
| 893 |
+
"mean_nll": 2.3799076080322266,
|
| 894 |
+
"correct": 33
|
| 895 |
+
},
|
| 896 |
+
"lora": {
|
| 897 |
+
"mean_nll": 2.216414451599121,
|
| 898 |
+
"correct": 34
|
| 899 |
+
},
|
| 900 |
+
"tokens": 50
|
| 901 |
+
},
|
| 902 |
+
{
|
| 903 |
+
"id": "f9ca8e570dc1123e",
|
| 904 |
+
"split": "train",
|
| 905 |
+
"condition": "closed",
|
| 906 |
+
"passage": "introduction-to-kernel-dispatcher-objects",
|
| 907 |
+
"flash": {
|
| 908 |
+
"mean_nll": 2.594196081161499,
|
| 909 |
+
"correct": 8
|
| 910 |
+
},
|
| 911 |
+
"lora": {
|
| 912 |
+
"mean_nll": 2.5473828315734863,
|
| 913 |
+
"correct": 9
|
| 914 |
+
},
|
| 915 |
+
"tokens": 18
|
| 916 |
+
},
|
| 917 |
+
{
|
| 918 |
+
"id": "f9ca8e570dc1123e",
|
| 919 |
+
"split": "train",
|
| 920 |
+
"condition": "rag",
|
| 921 |
+
"passage": "introduction-to-kernel-dispatcher-objects",
|
| 922 |
+
"flash": {
|
| 923 |
+
"mean_nll": 1.7190078496932983,
|
| 924 |
+
"correct": 35
|
| 925 |
+
},
|
| 926 |
+
"lora": {
|
| 927 |
+
"mean_nll": 1.655003547668457,
|
| 928 |
+
"correct": 36
|
| 929 |
+
},
|
| 930 |
+
"tokens": 48
|
| 931 |
+
},
|
| 932 |
+
{
|
| 933 |
+
"id": "a3ebd8f64a063794",
|
| 934 |
+
"split": "train",
|
| 935 |
+
"condition": "closed",
|
| 936 |
+
"passage": "introduction-to-kernel-dispatcher-objects",
|
| 937 |
+
"flash": {
|
| 938 |
+
"mean_nll": 3.984090566635132,
|
| 939 |
+
"correct": 8
|
| 940 |
+
},
|
| 941 |
+
"lora": {
|
| 942 |
+
"mean_nll": 3.32582950592041,
|
| 943 |
+
"correct": 8
|
| 944 |
+
},
|
| 945 |
+
"tokens": 15
|
| 946 |
+
},
|
| 947 |
+
{
|
| 948 |
+
"id": "a3ebd8f64a063794",
|
| 949 |
+
"split": "train",
|
| 950 |
+
"condition": "rag",
|
| 951 |
+
"passage": "introduction-to-kernel-dispatcher-objects",
|
| 952 |
+
"flash": {
|
| 953 |
+
"mean_nll": 6.333338260650635,
|
| 954 |
+
"correct": 5
|
| 955 |
+
},
|
| 956 |
+
"lora": {
|
| 957 |
+
"mean_nll": 5.989898681640625,
|
| 958 |
+
"correct": 5
|
| 959 |
+
},
|
| 960 |
+
"tokens": 20
|
| 961 |
+
},
|
| 962 |
+
{
|
| 963 |
+
"id": "39c7787f32b15d1e",
|
| 964 |
+
"split": "test",
|
| 965 |
+
"condition": "closed",
|
| 966 |
+
"passage": "canceling-irps",
|
| 967 |
+
"flash": {
|
| 968 |
+
"mean_nll": 3.8629448413848877,
|
| 969 |
+
"correct": 7
|
| 970 |
+
},
|
| 971 |
+
"lora": {
|
| 972 |
+
"mean_nll": 3.7965779304504395,
|
| 973 |
+
"correct": 8
|
| 974 |
+
},
|
| 975 |
+
"tokens": 21
|
| 976 |
+
},
|
| 977 |
+
{
|
| 978 |
+
"id": "39c7787f32b15d1e",
|
| 979 |
+
"split": "test",
|
| 980 |
+
"condition": "rag",
|
| 981 |
+
"passage": "canceling-irps",
|
| 982 |
+
"flash": {
|
| 983 |
+
"mean_nll": 1.7645115852355957,
|
| 984 |
+
"correct": 31
|
| 985 |
+
},
|
| 986 |
+
"lora": {
|
| 987 |
+
"mean_nll": 1.6393746137619019,
|
| 988 |
+
"correct": 33
|
| 989 |
+
},
|
| 990 |
+
"tokens": 46
|
| 991 |
+
},
|
| 992 |
+
{
|
| 993 |
+
"id": "52f1f9c35c67a5c0",
|
| 994 |
+
"split": "test",
|
| 995 |
+
"condition": "closed",
|
| 996 |
+
"passage": "canceling-irps",
|
| 997 |
+
"flash": {
|
| 998 |
+
"mean_nll": 3.7245893478393555,
|
| 999 |
+
"correct": 7
|
| 1000 |
+
},
|
| 1001 |
+
"lora": {
|
| 1002 |
+
"mean_nll": 3.636117696762085,
|
| 1003 |
+
"correct": 8
|
| 1004 |
+
},
|
| 1005 |
+
"tokens": 18
|
| 1006 |
+
},
|
| 1007 |
+
{
|
| 1008 |
+
"id": "52f1f9c35c67a5c0",
|
| 1009 |
+
"split": "test",
|
| 1010 |
+
"condition": "rag",
|
| 1011 |
+
"passage": "canceling-irps",
|
| 1012 |
+
"flash": {
|
| 1013 |
+
"mean_nll": 2.074115037918091,
|
| 1014 |
+
"correct": 31
|
| 1015 |
+
},
|
| 1016 |
+
"lora": {
|
| 1017 |
+
"mean_nll": 1.9936167001724243,
|
| 1018 |
+
"correct": 31
|
| 1019 |
+
},
|
| 1020 |
+
"tokens": 43
|
| 1021 |
+
},
|
| 1022 |
+
{
|
| 1023 |
+
"id": "6aa2ffae5d1dbd2e",
|
| 1024 |
+
"split": "train",
|
| 1025 |
+
"condition": "closed",
|
| 1026 |
+
"passage": "semaphore-objects",
|
| 1027 |
+
"flash": {
|
| 1028 |
+
"mean_nll": 4.982927322387695,
|
| 1029 |
+
"correct": 6
|
| 1030 |
+
},
|
| 1031 |
+
"lora": {
|
| 1032 |
+
"mean_nll": 4.618597507476807,
|
| 1033 |
+
"correct": 7
|
| 1034 |
+
},
|
| 1035 |
+
"tokens": 23
|
| 1036 |
+
},
|
| 1037 |
+
{
|
| 1038 |
+
"id": "6aa2ffae5d1dbd2e",
|
| 1039 |
+
"split": "train",
|
| 1040 |
+
"condition": "rag",
|
| 1041 |
+
"passage": "semaphore-objects",
|
| 1042 |
+
"flash": {
|
| 1043 |
+
"mean_nll": 3.2998316287994385,
|
| 1044 |
+
"correct": 25
|
| 1045 |
+
},
|
| 1046 |
+
"lora": {
|
| 1047 |
+
"mean_nll": 3.1055431365966797,
|
| 1048 |
+
"correct": 26
|
| 1049 |
+
},
|
| 1050 |
+
"tokens": 46
|
| 1051 |
+
},
|
| 1052 |
+
{
|
| 1053 |
+
"id": "04541a599391cc1c",
|
| 1054 |
+
"split": "train",
|
| 1055 |
+
"condition": "closed",
|
| 1056 |
+
"passage": "job-objects",
|
| 1057 |
+
"flash": {
|
| 1058 |
+
"mean_nll": 4.527370452880859,
|
| 1059 |
+
"correct": 2
|
| 1060 |
+
},
|
| 1061 |
+
"lora": {
|
| 1062 |
+
"mean_nll": 4.087917804718018,
|
| 1063 |
+
"correct": 5
|
| 1064 |
+
},
|
| 1065 |
+
"tokens": 19
|
| 1066 |
+
},
|
| 1067 |
+
{
|
| 1068 |
+
"id": "04541a599391cc1c",
|
| 1069 |
+
"split": "train",
|
| 1070 |
+
"condition": "rag",
|
| 1071 |
+
"passage": "job-objects",
|
| 1072 |
+
"flash": {
|
| 1073 |
+
"mean_nll": 2.755608081817627,
|
| 1074 |
+
"correct": 24
|
| 1075 |
+
},
|
| 1076 |
+
"lora": {
|
| 1077 |
+
"mean_nll": 2.5538129806518555,
|
| 1078 |
+
"correct": 25
|
| 1079 |
+
},
|
| 1080 |
+
"tokens": 41
|
| 1081 |
+
},
|
| 1082 |
+
{
|
| 1083 |
+
"id": "14c29e15a357c5ed",
|
| 1084 |
+
"split": "train",
|
| 1085 |
+
"condition": "closed",
|
| 1086 |
+
"passage": "working-set",
|
| 1087 |
+
"flash": {
|
| 1088 |
+
"mean_nll": 4.641288757324219,
|
| 1089 |
+
"correct": 4
|
| 1090 |
+
},
|
| 1091 |
+
"lora": {
|
| 1092 |
+
"mean_nll": 4.3942413330078125,
|
| 1093 |
+
"correct": 5
|
| 1094 |
+
},
|
| 1095 |
+
"tokens": 18
|
| 1096 |
+
},
|
| 1097 |
+
{
|
| 1098 |
+
"id": "14c29e15a357c5ed",
|
| 1099 |
+
"split": "train",
|
| 1100 |
+
"condition": "rag",
|
| 1101 |
+
"passage": "working-set",
|
| 1102 |
+
"flash": {
|
| 1103 |
+
"mean_nll": 2.7850189208984375,
|
| 1104 |
+
"correct": 23
|
| 1105 |
+
},
|
| 1106 |
+
"lora": {
|
| 1107 |
+
"mean_nll": 2.5884013175964355,
|
| 1108 |
+
"correct": 23
|
| 1109 |
+
},
|
| 1110 |
+
"tokens": 38
|
| 1111 |
+
}
|
| 1112 |
+
]
|
training/scores.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_revision": "93d418ec79ac09b75b11b995055cb3f3114d2df96cb25a560e7c3d8341cb0077",
|
| 3 |
+
"capture_control": {
|
| 4 |
+
"prompt_only_top1": 785,
|
| 5 |
+
"teacher_forced_first_top1": 785,
|
| 6 |
+
"stock_last_top1": 151645,
|
| 7 |
+
"captured_last_top1": 151645
|
| 8 |
+
},
|
| 9 |
+
"optimizer": "GPUless native MeZO + pTPU",
|
| 10 |
+
"rank": 4,
|
| 11 |
+
"vocabulary_rows": 256,
|
| 12 |
+
"basis_dimensions": 24,
|
| 13 |
+
"steps": 128,
|
| 14 |
+
"directions": 4,
|
| 15 |
+
"train_seconds": 0.1260777740026242,
|
| 16 |
+
"dataset_sha256": "e562a828fef5418e194728b34552dde77d5d8021782eb5693a656bb2792b987c",
|
| 17 |
+
"scores": {
|
| 18 |
+
"test-closed": {
|
| 19 |
+
"questions": 8,
|
| 20 |
+
"tokens": 175,
|
| 21 |
+
"flash": {
|
| 22 |
+
"nll": 3.1813081734521047,
|
| 23 |
+
"top1": 0.4685714285714286
|
| 24 |
+
},
|
| 25 |
+
"lora": {
|
| 26 |
+
"nll": 3.1191686855043685,
|
| 27 |
+
"top1": 0.5085714285714286
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"test-rag": {
|
| 31 |
+
"questions": 8,
|
| 32 |
+
"tokens": 371,
|
| 33 |
+
"flash": {
|
| 34 |
+
"nll": 2.0026786735436986,
|
| 35 |
+
"top1": 0.6819407008086253
|
| 36 |
+
},
|
| 37 |
+
"lora": {
|
| 38 |
+
"nll": 1.894342066464077,
|
| 39 |
+
"top1": 0.7035040431266847
|
| 40 |
+
}
|
| 41 |
+
},
|
| 42 |
+
"train-closed": {
|
| 43 |
+
"questions": 29,
|
| 44 |
+
"tokens": 585,
|
| 45 |
+
"flash": {
|
| 46 |
+
"nll": 3.6137355853349735,
|
| 47 |
+
"top1": 0.4205128205128205
|
| 48 |
+
},
|
| 49 |
+
"lora": {
|
| 50 |
+
"nll": 3.382654227558364,
|
| 51 |
+
"top1": 0.4683760683760684
|
| 52 |
+
}
|
| 53 |
+
},
|
| 54 |
+
"train-rag": {
|
| 55 |
+
"questions": 29,
|
| 56 |
+
"tokens": 1216,
|
| 57 |
+
"flash": {
|
| 58 |
+
"nll": 2.300164647302345,
|
| 59 |
+
"top1": 0.6587171052631579
|
| 60 |
+
},
|
| 61 |
+
"lora": {
|
| 62 |
+
"nll": 2.1436501163989305,
|
| 63 |
+
"top1": 0.6866776315789473
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
}
|
windows.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec36f2cd13038441beb5479be561a2028745e1e8f8b6b6ad414dfa0d13d96032
|
| 3 |
+
size 167936
|