File size: 7,580 Bytes
3d81e63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
source	split	question	answer
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.