From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d1a2aff784715896 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!d27g2000yqn.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Start a Windows process and get its text output Date: Sun, 7 Feb 2010 11:24:41 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <22cd779c-b1bb-4501-abfe-7b35c2dd7a7b@b2g2000yqi.googlegroups.com> NNTP-Posting-Host: 77.198.58.30 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1265570681 16351 127.0.0.1 (7 Feb 2010 19:24:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 7 Feb 2010 19:24:41 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d27g2000yqn.googlegroups.com; posting-host=77.198.58.30; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8955 Date: 2010-02-07T11:24:41-08:00 List-Id: As it is the subject here : I've just checked at least with GNAT it work nice to create a task, invok a CreateProcess from this Ada task and then WaitForSingleObject with delay INFINITE on the process handle always in the same Ada task : other Ada task are still running normally (a protected object can then be used to tell any other task the process has terminated). I was wondering about the cost of threads on Windows, as GNAT create Ada task as Windows thread (I suppose its the same for Janus and others, I hope to be honest). I just found there is a default allocated stack of 1M bytes, and nothing about the cost of task creation and task switch in CPU cycles (from a pure point of view, dropping any page fault and the like). If someone know a good source about it, it would be nice (this is to weigh up the choice to have an Ada task per process vs. a single Ada task managing multiple processes). The sole words about it in the MS reference says : > The number of threads a process can create is limited by the > available virtual memory. By default, every thread has one megabyte > of stack space. Therefore, you can create at most 2028 threads. If > you reduce the default stack size, you can create more threads. > However, your application will have better performance if you create > one thread per processor and build queues of requests for which the > application maintains the context information. A thread would > process all requests in a queue before processing requests in the > next queue. While the thread (then Ada task) stack size can be tuned with the Storage_Size attribute, while formally speaking, as of [ARM 13.1(60)], this is not strictly the stack size, but rather a size including the stack size. And this attribute is marked as obsolescent in [ARM J.6], in favor of the pragma which as the same name.