Re: Best way for a task to give up the CPU and let other tasks run?

2019-11-04 Thread Peter Relson
Enclaves were supposed to be an exception to this rule. First, SRB's in an enclave are interruptible. Second, for dispatching purposes, SRB's and TCB's placed in an enclave are excluded from the address space. The system will select either an enclave or address space for processing. Time

Re: Best way for a task to give up the CPU and let other tasks run?

2019-11-03 Thread Jon Perryman
On Sunday, November 3, 2019, 05:38:02 AM PST, Peter Relson wrote: > all other things being equal, ready tasks within in address space are > > dispatched in a round-robin fashion. A time slice is a time slice. Enclaves were supposed to be an exception to this rule. First, SRB's in an

Re: Best way for a task to give up the CPU and let other tasks run?

2019-11-03 Thread Peter Relson
> If the two parties are running in different address spaces then a > complaint could only be that the address space is consuming a lot of CPU > and that is exactly what WLM goals and priorities are for. Only true if you ignore mixed workload address spaces Perhaps you did not read that my

Re: Best way for a task to give up the CPU and let other tasks run?

2019-11-02 Thread Jon Perryman
On Wednesday, October 30, 2019, 05:50:04 AM PDT, Peter Relson wrote: ,> If the two parties are running in different address spaces then a  > complaint could only be that the address space is consuming a lot of CPU  > and that is exactly what WLM goals and priorities are for. Only true if

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-31 Thread Peter Relson
>I believe the OP mentioned he received complaints that his >task was hogging the CPU. I went back and looked. The OP said no such thing One of the posters (I thought the OP) mentioned that they were just trying to be a good guy, amidst a lengthy period of intensive CPU usage, of trying to

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-30 Thread Thomas David Rivers
Thomas David Rivers wrote: Does anyone happen to know the best way for a running task to give up running and let another task run? But - this isn't "give up" as in ending the task, just giving up the CPU to allow another task to run and then returning to this task. Sorta like "I'm done for

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-30 Thread Tom Marchant
On Tue, 29 Oct 2019 17:43:25 +, Jon Perryman wrote: >I believe the OP mentioned he received complaints that his >task was hogging the CPU. I went back and looked. The OP said no such thing. In fact, the OP has said nothing about why he wants to do this, despite being asked no less than

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-30 Thread Peter Relson
I believe the OP mentioned he received complaints that his task was hogging the CPU. It would be unusual for "someone" to get complaints from "someone else" about a task owned by that "someone", unless both the "someone" and the "someone else" were running in the same address space at the

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-29 Thread Jon Perryman
On Wed, 23 Oct 2019 18:23:31 +, Seymour J Metz wrote: >The Dispatcher has been using timers for decades. What interrupts your >code is an external event from a timer or from a SIGP on another CPU. >If you're running with appropriate goals, don't try to second guess WLM. I believe the OP

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-23 Thread Tom Marchant
On Wed, 23 Oct 2019 18:23:31 +, Seymour J Metz wrote: >The Dispatcher has been using timers for decades. What interrupts your >code is an external event from a timer or from a SIGP on another CPU. >If you're running with appropriate goals, don't try to second guess WLM. I agree. The OP has

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-23 Thread Seymour J Metz
The Dispatcher has been using timers for decades. What interrupts your code is an external event from a timer or from a SIGP on another CPU. If you're running with appropriate goals, don't try to second guess WLM. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-23 Thread Seymour J Metz
External Interrupt has always been a grab bag, even on S/360. S/370 added more events that I wouldn't describe as external. The list is pretty long these days. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-23 Thread Seymour J Metz
If you use your own spin loop (as opposed to a spin lock) and the lock is held by another task, then dispatching delays for that task will delay you, driving up the CPU consumption. The Devil is in the details, but I have yet to see a case where it is warranted. What I have seen is a case

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-23 Thread David Crayford
Thank you Peter for the great comments! On 2019-10-23 8:34 PM, Peter Relson wrote: The code snippets I posted show that the code sleeps rather than waiting to be signaled which I suspect may be cheaper on those platforms. I don't know about the relative cheapness, but generally sleeping (and

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-23 Thread Peter Relson
The code snippets I posted show that the code sleeps rather than waiting to be signaled which I suspect may be cheaper on those platforms. I don't know about the relative cheapness, but generally sleeping (and looking again when you wake up) is easier, and waiting/posting (pausing/releasing)

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-22 Thread David Crayford
Thank you, Don! On 2019-10-22 8:37 PM, Don Poitras wrote: And for things like "enabled resources" (ENQ, LOCAL lock), the system may attempt to manage the work unit priorities to give the "holder" some extra CPU time. This is interesting for ENQ. Windows has a mechanism in place to raise the

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-22 Thread Don Poitras
In article you wrote: > On 2019-10-22 7:42 PM, Peter Relson wrote: > > You can spin for a while, but then really need to "wait" (or pause) until > > "posted" (or released) when the resource becomes available.. > The code snippets I posted show that the code sleeps rather than waiting > to be

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-22 Thread David Crayford
On 2019-10-22 7:42 PM, Peter Relson wrote: You can spin for a while, but then really need to "wait" (or pause) until "posted" (or released) when the resource becomes available.. The code snippets I posted show that the code sleeps rather than waiting to be signaled which I suspect may be

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-22 Thread Peter Relson
My advice: Do Not Spin. If your implementation of a "lock" is to loop until it is available, you are pretty much doomed to failure in some edge cases over which you likely have no control. You can spin for a while, but then really need to "wait" (or pause) until "posted" (or released) when

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-21 Thread David Crayford
On 2019-10-22 12:09 PM, Mike Hochee wrote: Define application program? COBOL batch or CICS transaction program? Most legacy applications on z/OS don't implement concurrency. Agreed, they don't implement concurrency, however they are often very heavily reliant upon on it, as it is built into

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-21 Thread Mike Hochee
> Define application program? COBOL batch or CICS transaction program? > Most legacy applications on z/OS don't implement concurrency. Agreed, they don't implement concurrency, however they are often very heavily reliant upon on it, as it is built into the database management and message

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-21 Thread David Crayford
On 2019-10-22 1:55 AM, Tony Harminc wrote: On Sun, 20 Oct 2019 at 02:32, David Crayford wrote: The only code I've seen that implements yield are synchronization routines. Consider a spin-lock which is spinning on a CS instruction. Why would any application program on z/OS implement and use a

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-21 Thread Paul Gilmartin
On Mon, 21 Oct 2019 19:01:15 +, Jesse 1 Robinson wrote: >(Now with some actual content.) The standard justification for spin loop is >that the area of code in question is executed *very* frequently and is *very* >short. > I'd say, rather, the typical *wait* is *very* short. >... In other

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-21 Thread Jesse 1 Robinson
(Now with some actual content.) The standard justification for spin loop is that the area of code in question is executed *very* frequently and is *very* short. In other words, not worth the overhead of an actual WAIT nor the delay in having to get redispatched afterwards. Spin loop is not an

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-21 Thread Jesse 1 Robinson
. . J.O.Skip Robinson Southern California Edison Company Electric Dragon Team Paddler SHARE MVS Program Co-Manager 323-715-0595 Mobile 626-543-6132 Office ⇐=== NEW robin...@sce.com -Original Message- From: IBM Mainframe Discussion List On Behalf Of Tony Harminc Sent: Monday, October

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-21 Thread Tony Harminc
On Sun, 20 Oct 2019 at 02:32, David Crayford wrote: > The only code I've seen that implements yield are synchronization > routines. Consider a spin-lock which is spinning on a CS instruction. Why would any application program on z/OS implement and use a spin lock? Why do the authors of such

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-21 Thread Sean Gleann
Back in the days of IPS/ICS dispatching control, wasn't there something that was referred to as the 'wheeler-dealer mechanism' & does it still exist in some form in the WLM code? >From memory: 1. New task gets created and is assigned a time-slice of 1msec, at a priority of 32 (out of 64 - i.e

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-20 Thread Charles Mills
I just looked up "External Interruption" in the Principles. There are at least 9 possible causes. IIRC on the System 360 there was an eight-pin Molex connector available and a customer-provided box of some sort could trigger an external interrupt by pulling the appropriate pin to ground. See

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-20 Thread David Crayford
On 2019-10-18 11:20 PM, Seymour J Metz wrote: ObUnclean Does Unix System Services implement its own spin locks or does it use MVS services? Does any *ix have spin locks outside of the kernel Unclean is subjective ;) pthread_spin_lock()  - not implemented on z/OS

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-20 Thread Robert Prins
On 2019-10-19 14:45, Charles Mills wrote: Others have given you good replies. I've been thinking about your question and thought I would summarize and re-phrase what has been said. You are not very specific in what your situation is, so let me offer three possible problem scenarios, each with

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-20 Thread David Crayford
Maybe the OP just wants to implement sched_yield() for the Dignus compiler runtime? On 2019-10-20 12:46 AM, Charles Mills wrote: Thanks! I suppose some encryption algorithm for which there was no hardware assist available might be a more practical real-world scenario. An encryption

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-19 Thread Tom Brennan
Interesting, thanks! So it generates an external interrupt. I always thought that one was only for the external interrupt "key", but this page indicates CPU timer and some kind of CP-to-CP communication too:

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-19 Thread Charles Mills
Check out "CPU Timer" in the Principles of Operation. Charles -Original Message- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Charles Mills Sent: Saturday, October 19, 2019 12:47 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Best way for a task to

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-19 Thread Charles Mills
Thanks! I suppose some encryption algorithm for which there was no hardware assist available might be a more practical real-world scenario. > Is there something in the dispatcher that is on a timer that ends up saying > this task has gotten enough CPU and it's time to move to the next TCB? In

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-19 Thread Tom Brennan
Great descriptions! I was thinking of the PI calculation myself because that's a case where you're doing real work, but the loop could be coded with no I/O and no SVC calls (which would give up control). Now here's a case I thought about in the past: Assuming I'm running such a PI

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-19 Thread Paul Gilmartin
On Sat, 19 Oct 2019 10:45:39 -0400, Charles Mills wrote: >Others have given you good replies. I've been thinking about your question >and thought I would summarize and re-phrase what has been said. You are not >very specific in what your situation is, so let me offer three possible >problem

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-19 Thread Charles Mills
Others have given you good replies. I've been thinking about your question and thought I would summarize and re-phrase what has been said. You are not very specific in what your situation is, so let me offer three possible problem scenarios, each with its own solution. I. "I am doing something

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-18 Thread Christopher Y. Blaicher
You only get the CPU for a time slice, or until the next interrupt occurs, which is very often. After each interrupt, the highest priority piece of work is dispatched. If you are still at the top, you go next. If not, you wait until you are at the top of the dispatch chain. Chris Blaicher

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-18 Thread Matt Hogstrom
From a design perspective it would seem that your task is done and waiting for more work? Generally I’d think you’d want to wait and have someone post that work is ready or an stimer to wait for a period of time. z/OS is unlike many operating systems where it will pre-empt running work and

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-18 Thread Tony Harminc
On Thu, 17 Oct 2019 at 08:54, Thomas David Rivers wrote: > Does anyone happen to know the best way for a running task > to give up running and let another task run? > Sorta like "I'm done for the moment if something else would like to run". This sounds so wrong right from the start. Or rather,

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-18 Thread Seymour J Metz
ObUnclean Does Unix System Services implement its own spin locks or does it use MVS services? Does any *ix have spin locks outside of the kernel? -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List on behalf

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread David Crayford
Typically, OS services like these and it's Unix equivalent sched_yield() are used in spinlocks. On 2019-10-18 1:20 AM, Mike Hochee wrote: Yes exactly, that is part of what WLM is designed to do. In the real world most shops use WLM service classes and velocity goals to control things like CPU

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Bernd Oppolzer
STIMER WAIT for a small amount of time; I did this some years ago, when I wanted to show to some students how some parallel running subtasks wrote their messages not sequentially, but mixed; but, as it turned out, every subtask did its complete work in one step, once started, because it never

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Ed Jaffe
On 10/17/2019 10:31 AM, Thomas David Rivers wrote: Yeah - I stumbled over CALLDISP - but isn't that AUTHORIZED? What about just a regular un-AUTH'd program? CALLDISP does not require privileged execution unless you specify BRANCH=YES. Unauthorized callers should specify BRANCH=NO. --

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread John McKown
On Thu, Oct 17, 2019 at 12:31 PM Thomas David Rivers wrote: > Don Poitras wrote: > > >CALLDISP > > > > > https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.ieaa100/clldis.htm > > > > > > > > > Yeah - I stumbled over CALLDISP - but isn't that AUTHORIZED? > > What about just

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Mark Jacobs
When BRANCH=NO Environmental factorRequirement Minimum authorization: None. Dispatchable unit mode: Task Cross memory mode: PASN=HASN=SASN AMODE: 24- or 31- or 64-bit ASC mode: Primary Interrupt status: Enabled for I/O and external interrupts Locks: No locks held Control

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Thomas David Rivers
Don Poitras wrote: CALLDISP https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.ieaa100/clldis.htm Yeah - I stumbled over CALLDISP - but isn't that AUTHORIZED? What about just a regular un-AUTH'd program? - Dave R. - p.s. *Thanks* for the pointer... --

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Mike Hochee
Yes exactly, that is part of what WLM is designed to do. In the real world most shops use WLM service classes and velocity goals to control things like CPU dispatching frequency. I'm sure there exist workloads which tend to defy the controls available in WLM, but I suspect they are quite rare.

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Seymour J Metz
Why? If you are waiting for something then you should use system services, e.g., ENQ, WAIT, to delay until it occurs; if you are not waiting for something then why not let the WLM handle what it's designed to handle? -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Tom Marchant
On Thu, 17 Oct 2019 08:54:11 -0400, Thomas David Rivers wrote: >Does anyone happen to know the best way for a running task >to give up running and let another task run? > >But - this isn't "give up" as in ending the task, just giving up >the CPU to allow another task to run and then returning

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread David Crayford
That's awesome Don! So that's how to implement sched_yield()? On 2019-10-17 10:02 PM, Don Poitras wrote: CALLDISP https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.ieaa100/clldis.htm In article <066301d584f2$b397cdc0$1ac76940$@mcn.org> you wrote: #1, MVS manages that

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Vernooij, Kees (ITOP NM) - KLM
"I'm done for the moment if something else would like to run" That's not for the task to decide: the dispatcher, under control of WLM, decides whether you get the CPU or will be removed from it to allow another task to run. All based on WLM directions, which you can influence by selecting a

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Paul Gilmartin
On Thu, 17 Oct 2019 08:54:11 -0400, Thomas David Rivers wrote: >Does anyone happen to know the best way for a running task >to give up running and let another task run? > >But - this isn't "give up" as in ending the task, just giving up >the CPU to allow another task to run and then returning to

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Don Poitras
CALLDISP https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.ieaa100/clldis.htm In article <066301d584f2$b397cdc0$1ac76940$@mcn.org> you wrote: > #1, MVS manages that sort of thing with its wisdom, right? If it thought > someone else should run, it would pre-empt you and

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Charles Mills
#1, MVS manages that sort of thing with its wisdom, right? If it thought someone else should run, it would pre-empt you and give control to that other task. #2, any SVC (or PC?) type system service call will cause MVS to re-evaluate who should be dispatched *I think*. Charles -Original

Re: Best way for a task to give up the CPU and let other tasks run?

2019-10-17 Thread Vernooij, Kees (ITOP NM) - KLM
WLM: give the job a Serice Class with Importance=5 and a Velocity=1. It will be thankful for each CPU second that is left unused by all other tasks in the system. Kees. > -Original Message- > From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On > Behalf Of Thomas