What is the difference between elapsed time and the CPU time

JES2/3, JCL, utilities.
Post Reply
Pragya
Registered Member
Posts: 65
Joined: Wed Jun 19, 2013 9:49 am

What is the difference between elapsed time and the CPU time

Post by Pragya »

What is the difference between elapsed time and the CPU time?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between elapsed time and the CPU

Post by Robert Sample »

Under z/OS, there are typically hundreds of tasks running simultaneously on any given system. These include started tasks (which would include DB2, MQ series, Websphere, system tasks), TSO users, batch jobs, CICS regions. The system manages these tasks and allows each to run for a certain amount of time each minute. CPU time is the amount of time the task is actually executed for while elapsed time represents the total amount of time the task has been around. The ratio between CPU and elapsed time can run from close to 1:1 (for a high-priority task running with no other work being done) to 1:100 (or higher) for a heavily loaded system with a low-priority task.
User avatar
BobThomas
Registered Member
Posts: 70
Joined: Sat Jun 15, 2013 11:04 am

Re: What is the difference between elapsed time and the CPU

Post by BobThomas »

Can the ratio be 100:1, per your example, Robert?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between elapsed time and the CPU

Post by Robert Sample »

It can be MUCH higher than that. Job management is generally handled by Workload Manager (WLM) these days. There are 6 priority classes for a job in WLM -- 1 through 5 and DISCRETIONARY. A discretionary job gets CPU time if -- and only if -- no other job with a numeric priority can use the CPU time. When a system is heavily loaded (defined as 100% CPU utilization), a discretionary job may hang around for days without getting much CPU time at all.

Example: at my site, compile jobs run discretionary. Programmers hate month-end processing as the CPU is 100% for a long time (24 to 72 hours usually). A compile job that runs 2 minutes the rest of the month was documented as taking 6 hours during month end. Since it took about 5 seconds of CPU time, the normal ratio was 24 to 1 but during month end processing the ratio went over 4000 to 1 (6 hours is 21600 seconds).
Pragya
Registered Member
Posts: 65
Joined: Wed Jun 19, 2013 9:49 am

Re: What is the difference between elapsed time and the CPU

Post by Pragya »

Thanks Robert. However, why would we design a system like that? Is not "this way of designing system" just making unnecessary hog? I've also seen compile Jobs to take hours, as you said, but is it the only way system can be designed - are there not any alternatives to it?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between elapsed time and the CPU

Post by Robert Sample »

The system was designed that way because IBM designed it that way. Many students want to know the answer to "why" questions, and many times the why is not known -- because of the age of the operating system, or because it is proprietary information, or because the system designers have never specified the reason(s). Usually there are reasons, and those reasons can be very good ones, but those reasons may not be available to anyone. Programmers who have been around for a while realize that the "why" doesn't really matter -- what matters is understanding how to accomplish their goals within the existing structure.

z/OS was designed to run with 100% CPU utilization for long periods of time. Most Unix / Windows systems were designed to run about 20% CPU utilization and can get very slow when CPU goes over 90%. One thing to remember is that compile jobs are generally considered development work and as such are less important than production work. The programmer may not agree, but if the company is running payroll or billing on the production system, few managers would be willing to make the production work take longer just so a programmer can get their compile done. And since a typical mainframe will have between 100 and 500 things going on at the same time, 24 hours a day, tradeoffs have to be made. The most common hierarchy I've seen is production online, then production batch, then test online, then test batch (which may include compiles but also they may be considered lower priority than test batch). Workload Manager (WLM) is how those priorities are enforced on a z/OS system; while WLM is not a perfect system it certainly gets as much work done as possible.
User avatar
BobThomas
Registered Member
Posts: 70
Joined: Sat Jun 15, 2013 11:04 am

Re: What is the difference between elapsed time and the CPU

Post by BobThomas »

Robert Sample wrote:Example: at my site, compile jobs run discretionary. Programmers hate month-end processing as the CPU is 100% for a long time (24 to 72 hours usually). A compile job that runs 2 minutes the rest of the month was documented as taking 6 hours during month end. Since it took about 5 seconds of CPU time, the normal ratio was 24 to 1 but during month end processing the ratio went over 4000 to 1 (6 hours is 21600 seconds).
Count me in. I too hate Month ends.

And sorry for a late reply Could not get time to come online.

Thanks,
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”