OS Control Blocks For Beginners
OS Control Blocks For Beginners
OS Control Blocks For Beginners
Written and presented by Steve Comstock for The Trainer's Friend, Inc.
(revised 2009/08/28)
1
Agenda
z/OS as a Resource Manager
Control blocks - definition
Addresses and pointers
Chains and anchors
Control blocks - Address Spaces (ASCB), Tasks (TCB), Requests (PRB,
SVRB), Contents supervision (CDE, XTLST)
Where are the layouts
Reading the layouts
The CVT and PSA
Some details of the above control blocks
Finding the data: DDLIST, SYSUDUMP, control block chasing
The study of control blocks and data areas
2
z/OS Is a Resource Manager
"Resources" includes
I/O Devices and the external hardware configuration
Memory and CPs (physical and virtual)
Units and Volumes
Catalogs, VTOCs, Labels, Data sets, Directories, Members
Address spaces
Tasks
Jobs
Memory contents (e.g.: programs currently loaded)
Users (potential and currently logged on)
3
z/OS Is a Resource Manager, 2
To "Manage" resources means
To know the location and status of each resource
To be able to create, modify, and delete resources
* Lots more
1
2
Control Blocks: Tasks
Work in an address space is organized into tasks
Each task is generally independent of any other task in the
address space (although there are mechanisms for
coordination and communication)
Initiator
program
CDE
XTLST
2
0
Control Blocks - Where Are the Layouts?
There are a number of sources of information about z/OS
control blocks:
http://www.ibm.com/systems/z/os/zos/bkserv/
Select "z/OS Elements and Features", "Book", latest_version
Under the elements and features bookshelf choice, select "List books"
Do a Find for "data areas"; read or download
2
1
Control Blocks - Where Are the Layouts, 2
There are a number of sources of information about z/OS
control blocks, continued:
Note the sudden change of offset; this occurs on the 11th page of the write up; if you don't
look far enough you could miss the fact that PRB + 12 contains the address of the CDE
2
6
Control Blocks - Stability
IBM has long documented the major control blocks pretty
thoroughly
This has been true since the first release of OS/360 was
available
Since you can't allow any two to modify the same area of low
storage at the same time, each CP has its own block of real
storage allocated to virtual addresses 0-8192
Each CP has its own prefix register that does this mapping
A data area called the Prefixed Save Area (PSA) maps the
first 4K of memory for each CP
3
1
The PSA, fields
Now the PSA has some interesting fields; to mention just
a few:
But the pointer to the pointer to the current TCB in the CVT
is not indicated as GUPI
SYSxDUMP DD statement
When you specify a number followed by a decimal point, it is assumed to be a hex address
4
0
Using Control Blocks - Finding the data, 3
So browsing from location 0 shows the PSA and you see
something like this:
DDLIST STORAGE Start:00000000 00.
Command ===> Scroll ===> CSR
********************************************************** Top of Data ************************************************************
+0 (00000000) 000A0000 000130E1 00000000 00000000 00FDDDB8 00000000 7FFFF000 7FFFF000 * .......÷.........Ùù½....".0.".0. *
+20 (00000020) 7FFFF000 7FFFF000 7FFFF000 7FFFF000 00000000 00000000 7FFFF000 7FFFF000 * ".0.".0.".0.".0.........".0.".0. *
+40 (00000040) 00000000 00000000 00000000 00FDDDB8 00000000 00000000 000A0000 000140E1 * .............Ùù½.............. ÷ *
You can now browse relative to this location using a relative address: b +10?
(add x'10' to the current address and then use this as a 31-bit pointer: go to that location) and
you see:
Then from the command line issue: ==> tso alloc fi(isrddn) da(tr.#cbnames) shr reu
Then from the DDLIST panel you can issue commands like:
==> b cvt
==> b cde
and so on!
4
2
Using Control Blocks - Finding the data, 5
Addresses are specified in DDLIST as one of these:
Absolute: 1-8 hex digits followed by a period (e.g.: 3f78.)
Note that each 'b' command lays its output on top of the previous one
Consider doing a PF3 (end) after you're done with one display, to avoid deep nesting
But don't back out of the first 'b 0.' screen, or you'll have to get back in all over again
4
4
Using Control Blocks - Finding the data, 7
More information available from:
ASCB: 00FBAD00
+0000 ASCB..... ASCB FWDP..... 00FC9700 BWDP..... 00FC8400 LTCS..... 00000000 SVRB..... 007FD6C0
+0014 SYNC..... 000F680B IOSP..... 00000000 R01C..... 0000 WQID..... 0000 SAWQ..... 00000000
. . .
TCB: 007FF048
+0000 RBP...... 007FDAC8 PIE...... 00000000 DEB...... 007C1038 TIO...... 007C6FE8 CMP...... 940C1000
. . .
+0070 FSA...... 00006008 TCB...... 00000000 TME...... 00000000 JSTCB.... 007FF048 NTC...... 00000000
+0084 OTC...... 007FF350 LTC...... 00000000 IQE...... 00000000 ECB...... 007D4EEC TSFLG.... 20
. . .
PRB: 007CFC10
-0020 XSB...... 7FFFDEE0 FLAGS2... 00 RTPSW1... 078D0000 B6B00030 RTPSW2... 00020001
-000C 7F7BB000 FLAGS1... 00000000 WLIC..... 00020001
+0000 RSV...... 00000000 00000000 SZSTAB... 00110082 CDE...... 007FF008
4
6
Using Control Blocks - control block chasing
Here is an example of finding the module name of the
current task in Assembler:
L 2,540 point to TCB
L 2,0(,2) point to PRB
L 2,12(,2) point to CDE
ICM 2,8,zero clear leftmost bits
MVC o_name,8(2) grab name
.
.
.
zero DC f'0'
When 0 is specified as a base register or an index register, the contents of R0 are not used, but
rather a value of 0
So "L 2,540" means "load the contents of absolute location 540, for 4 bytes, into R2"
4
7
Control Block Chasing
You can also chase control blocks in other languages:
Learn how they look things up, what they consider most
important, how to reference and use control blocks
http://www.trainersfriend.com
303.393.8716
Contact us for a copy of the Assembler Sales: kitty@trainersfriend.com
program used to test lecture points.
Technical: steve@trainersfriend.com
5
2