Don, A useful application of a Count 1-Bits instruction could be page allocation.
For example, let us consider the following case. My system is configured with 1M segments and 4K pages. A segment map of 32 bytes can be used to map the status of the 256 pages comprising the segment. I issue a GETMAIN for some number of pages (NP) <= 1 segment (1M) in size. Clearly, if the number of 1-bits in the 32-byte map is <= 256-NP, then the segment may contain adequate free storage to meet my requirement. I can use the Count 1-Bits instruction to quickly scan through all current segments in my address space to determine if there may exist a segment having adequate existing storage to meet my requirement. I will save the count for each segment in a segment page-usage totals map. If there exists no single segment having adequate storage, then I can perform a scan of the segment page-usage totals map, looking for two successive segments having adequate free storage to meet my requirement. If either of the two previous conditions is true, then I will need to examine the segment or segments to determine if the storage is contiguous. If the storage is not contiguous, and if there remain additional segments to be examined, then I will have to resume searching. Otherwise, I will need to allocate a new segment to the address space. All things considered, I would think that we may see some slight improvements in page allocation management as a consequence of the Count 1-Bits instruction. John P. Baker -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of Don Higgins Sent: Tuesday, August 03, 2010 7:55 AM To: [email protected] Subject: OF what use are one-bit counts for a bit string? All I though I'd start a new thread with this subject so those searching index can find it. My first and most memorable practical introduction to bit maps came from the Houston Automatic Spooling Program (HASP) in the early days of OS when it took several seconds for OS to read a few JCL cards, interpret, allocate files, and start a program. HASP the predesssor to JES2 was a subsystem which took over all the card readers and printers and spooled I/O to disk so application programs would run faster using disk and the printing could be done separately. The really cool part of HASP was how fast it was, and part of that speed came from using bit map for all of its disk space. Allocating a new track for printer output for a job consisted of turning on a bit as opposed to updating DSCB's on disk. And yes HASP did have a checkpoint restart facility including the bit table. So on a z196 the new bit counting instruction could be used to more easily count allocated tracks and report total spool space in use. Don Higgins [email protected]
