comp.lang.ada
 help / color / mirror / Atom feed
From: anon@anon.org (anon)
Subject: Re: Blocking syscalls in Tasks
Date: Sun, 28 Sep 2008 03:16:28 GMT
Date: 2008-09-28T03:16:28+00:00	[thread overview]
Message-ID: <gGCDk.53525$Mh5.46931@bgtnsc04-news.ops.worldnet.att.net> (raw)
In-Reply-To: 49dd14a0-73b9-44b4-a599-c86da7229c6c@f36g2000hsa.googlegroups.com

Except for DOS in todays OS all Ada partitions are executed by native OS 
threads.

Only the calling Ada task aka thread is blocked, unless other tasks require 
access to that blocked task, then they become blocked as well. Also, this 
is stated indirectly in a number of sections and annexes in the "Ada RM". 
Plus, this goes beyond Ada, it is the norm for all multi-tasking language 
and environments. 

In GNAT Ada tasking environment where one or more task are beginning 
executed the Binder has elaborate the main procedure so the main procedure 
on exit will be blocked until all sub task have terminated. Then once 
unblocked the main procedure will call "Ada.Finalization.Finalize" and 
exit to system.

Calling any blockable system routine will block the Ada task aka thread if 
needed until conditions have been meet.  A call to Ada.Text_IO.Get to 
obtain data from the keyboard will block the calling task until data is ready 
for the Ada.Text_IO.GET routine and all other tasks may be unblocked, 
depending on their needs. 

In GNAT.Sockets, most system calls like a tcp/ip "accept" or tcp/ip "read" 
function will block the thread or task "Forever" until a connection or data is 
ready for the tcp/ip "read" function. Some other routines have a timeout 
parameter which can be used to unblock the call and task at a set time 
interval.

Now, in a GUI system, the RC_TASK (resource task) is blocked until a input 
device such as the mouse or keyboard actives the thread. But the other tasks 
within the partition may be unblocked unless they need protected information 
from the RC thread. 



In <49dd14a0-73b9-44b4-a599-c86da7229c6c@f36g2000hsa.googlegroups.com>, schwering@gmail.com writes:
>Hi there,
>
>I'm wondering whether a blocking system call like read() called via C
>interfacing in a task would block only the task or the complete
>process.
>
>Are tasks commonly implemented using threads and does the language
>specification request tasks to be in the user- or kernelspace? Or is
>there a real difference between tasks and threads?
>
>Greetings and thanks in advance
>
>Chris




  parent reply	other threads:[~2008-09-28  3:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-27 17:26 Blocking syscalls in Tasks schwering
2008-09-27 18:40 ` Peter C. Chapin
2008-09-27 20:11   ` schwering
2008-09-27 23:14     ` Peter C. Chapin
2008-09-27 18:58 ` Hibou57 (Yannick Duchêne)
2008-09-27 20:02   ` schwering
2008-09-27 20:16     ` Ed Falis
2008-09-27 21:54 ` Maciej Sobczak
2008-09-28  7:55   ` sjw
2008-09-28  3:16 ` anon [this message]
2008-09-28 17:48   ` tmoran
2008-09-28 23:39     ` anon
2008-09-30  2:35       ` Randy Brukardt
2008-09-30 10:06         ` anon
2008-09-30 11:01           ` Georg Bauhaus
2008-10-01  2:18             ` anon
2008-09-30 18:06           ` Adam Beneschan
2008-09-30 18:10             ` Ludovic Brenta
2008-09-30 20:09               ` Jeffrey R. Carter
2008-10-06 17:12           ` Ada compilers supporting Ada 2005 (was: Blocking syscalls in Tasks) Georg Bauhaus
2008-10-07 11:51             ` Colin Paul Gloster
2008-10-07 14:31               ` Britt Snodgrass
2008-10-07 15:39                 ` Colin Paul Gloster
2008-10-07 16:38                   ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox