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 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.42.101.204 with SMTP id f12mr9678301ico.22.1410102314616; Sun, 07 Sep 2014 08:05:14 -0700 (PDT) Path: border1.nntp.dca1.giganews.com!r2no16227009igi.0!news-out.google.com!ht4ni1786igb.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 07 Sep 2014 10:05:14 -0500 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Concurrency in Ada Date: Sun, 07 Sep 2014 11:05:53 -0400 Organization: IISS Elusive Unicorn Message-ID: References: <4d9466ad-5c9e-4b1f-8797-def623b3beb6@googlegroups.com> X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES MIME-Version: 1.0 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 108.79.221.76 X-Trace: sv3-mTUl0S5F16YIdx5uoUStx2UyB24hgto2sAAtu9zlPtzrBFMNU6fNN4htg/vbefCSIG5qmFHtZBM1luB!vKqzgCD8ynhuOeY1nyS/ZiUqS2NXpQDX2OtQx/F+lRN/+5RI+EJMXtw55ARWn8seGtvThH6ifgXM!nrDoJ+FQGI3eg/XlGPeJkCirbGQ= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3498 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Xref: number.nntp.dca.giganews.com comp.lang.ada:188907 Date: 2014-09-07T11:05:53-04:00 List-Id: On Sun, 7 Sep 2014 05:29:34 -0700 (PDT), Stribor40 declaimed the following: >I have this program from online tutorial that says that tasks will run as soon as program starts. My question is when does this program starts on what line if code http://www.adaic.org/resources/add_content/standards/05rm/html/RM-9-2.html >Do tasks run all at same tine or they are scheduled by OS which would mean anytime you run this program output would be different? Maybe, maybe, maybe. (do tasks run ... same time) If you have a single CPU, tasks will always need to be swapped by some mechanism; on a multi-core processor it is possible that tasks could be assigned to each core and truly run in parallel. (scheduled by OS) Depends upon the run-time system of the Ada environment. Most common compilers defer to the OS for tasking (creating OS level threads or processes for each Ada task); however a bare-board environment may require the Ada run-time to implement the tasking model internally (along with all I/O, etc.). The compilers meant to run on common hardware (that is, desktop/laptop general purpose computers vs embedded systems) defer to the OS as, if they implemented Ada tasking internally, their internal scheduler would be blocked whenever any task performed a blocking operation at the OS level. (output would be different) Possibly -- depending on what other activities are taking place on the machine. The activation of the tasks would be in the same order, and relative timings should hold BUT, if something of higher priority (say an interrupt triggered by a network packet) comes in, that could result in the activation/run of one task being suspended, and with all tasks at the same priority, it is possible that the OS will schedule the next task to resume rather than return to the first one suspended (depends on how the scheduler operates -- if it grants a fixed amount of time to a task, regardless of intervening interruptions, it is likely to return to that task to complete the time allocation; or it just puts any suspended task at the end of the chain of equal priority tasks and picks up the new head task on resumption). -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/