flat assembler
Message board for the users of flat assembler.
Index
> Windows > windows APC |
Author |
|
LocoDelAssembly 13 Apr 2010, 20:55
http://msdn.microsoft.com/en-us/library/ms681951%28VS.85%29.aspx
asmcoder wrote:
Care to explain the similarity with the explanation given in the link above? Especially the queuing and the synchronization parts... |
|||
13 Apr 2010, 20:55 |
|
a115433 14 Apr 2010, 06:51
so what can i use apc for? nothing! its exactly same as creating new thread, but i use existing one.
|
|||
14 Apr 2010, 06:51 |
|
baldr 14 Apr 2010, 08:07
a115433,
Overlapped I/O and timers. QueueUserAPC() is simply implementation detail being exposed to API user at almost no cost. Exactly the same? Think again. CreateRemoteThread() won't help much if you need to access thread context (e.g. thread-local variables). Do you think threads are cheap? |
|||
14 Apr 2010, 08:07 |
|
a115433 14 Apr 2010, 08:22
Quote: QueueUserAPC() is simply implementation detail being exposed to API user at almost no cost. ok thats the reason i guess. about overlapped io, its processed in other thread as apc, right? With method_buffered, because it use buffers loaded to global pages (mapping isnt flushed on context switch), all processes can access this memory. i have 1 last question about io, when actually does it end? after call to IoCompleteRequest(), or returning from IRP_MJ_XXX handler? io functions such ReadFile return what exactly? Status of returning from irp handler? when i will queue overlapped io, and get error_io_pending, that means it was sent to other thread as apc, right? And when it complete, IoCompleteRequest() is called, event set to signaled state, and i can continue. when i terminate process, what happens? irp gets canceled? apc gets canceled? or termination wait untill all irp is completed by IoCompleteRequest()? |
|||
14 Apr 2010, 08:22 |
|
baldr 14 Apr 2010, 15:36
a115433 wrote: about overlapped io, its processed in other thread as apc, right? Most questions are answered in "Inside Microsoft Windows 2000" by David A. Solomon & Mark E. Russinovich. |
|||
14 Apr 2010, 15:36 |
|
a115433 14 Apr 2010, 16:13
yes so when i call async operation, i ask kernel to do it in other thread (apc)?
|
|||
14 Apr 2010, 16:13 |
|
baldr 14 Apr 2010, 16:32
a115433,
No, NTOSKRNL!ReadFile() executes in context of calling thread and doesn't use APC. I/O manager can post APC to calling thread's APC queue on I/O completion. |
|||
14 Apr 2010, 16:32 |
|
a115433 14 Apr 2010, 18:58
duno ive read some time ago in official msdn that ReadFile with overlapped only queue read task to other thread, so it can return and let other thread process operation.
when i call io function in overlapped mode, i have control over my thread immidietly after executing function, and event is signaled when its finished. so ReadFile execute in context of calling thread, of course, but IO processing (copying buffer from/to dma, reading/writing to port) is executed by other thread, from worker pool. |
|||
14 Apr 2010, 18:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.