# VM (operating system)

VM (often: VM/CMS) is a family of IBM virtual machine operating systems used on IBM mainframes System/370, System/390, zSeries, System z and compatible systems, including the Hercules emulator for personal computers.

## Design

The heart of the VM architecture is the Control Program or hypervisor abbreviated CP, VM-CP and sometimes, ambiguously, VM. It runs on the physical hardware, and creates the virtual machine environment. VM-CP provides full virtualization of the physical machine – including all I/O and other privileged operations. It performs the system's resource-sharing, including device management, dispatching, virtual storage management, and other traditional operating system tasks. Each VM user is provided with a separate virtual machine having its own address space, virtual devices, etc., and which is capable of running any software that could be run on a stand-alone machine. A given VM mainframe typically runs hundreds or thousands of virtual machine instances. VM-CP began life as CP-370, a reimplementation of CP-67, itself a reimplementation of CP-40.
Running within each virtual machine is another operating system, a guest operating system. This might be:
* CMS (Conversational Monitor System, renamed from the Cambridge Monitor System of CP/CMS). Most virtual machines run CMS, a lightweight, single-user operating system. Its interactive environment is comparable to that of a single-user PC, including a file system, programming services, device access, and command-line processing. (While an earlier version of CMS was uncharitably described as "CP/M on a mainframe", the comparison is an anachronism; the author of CP/M, Gary Kildall, was an experienced CMS user.)
* GCS (Group Control System), which provides a limited simulation of the MVS API. IBM originally provided GCS in order to run VTAM without a service OS/VS1 virtual machine and VTAM Communications Network Application (VCNA). RSCS V2 also ran under GCS.
* A mainstream operating system. IBM's mainstream operating systems (e.g., the MVS and DOS/VSE families, OS/VS1, TSS/370, or another layer of VM/370 itself (see below)) can be loaded and run without modification. The VM hypervisor treats guest operating systems as application programs with exceptional privileges – it prevents them from directly using privileged instructions (those which would let applications take over the whole system or significant parts of it), but simulates privileged instructions on their behalf. Most mainframe operating systems terminate a normal application which tries to usurp the operating system's privileges. The VM hypervisor can simulate several types of console terminals for the guest operating system, such as the hardcopy line-mode 3215, the graphical 3270 family, and the integrated console on newer System/390 and System Z machines. Other users can then access running virtual machines using the DIAL command at the logon screen, which will connect their terminal to the first available emulated 3270 device, or the first available 2703 device if the user is DIALing from a typewriter terminal.
* Another copy of VM. A second level instance of VM can be fully virtualized inside a virtual machine. This is how VM development and testing is done (a second-level VM can potentially implement a different virtualization of the hardware). This technique was used to develop S/370 software before S/370 hardware was available, and it has continued to play a role in new hardware development at IBM. The literature cites practical examples of virtualization five levels deep. Levels of VM below the top are also treated as applications but with exceptional privileges.
* A copy of the mainframe version of AIX or Linux. In the mainframe environment, these operating systems often run under VM, and are handled like other guest operating systems. (They can also run as 'native' operating systems on the bare hardware.) There was also the short-lived IX/370, as well as S/370 and S/390 versions of AIX (AIX/370 and AIX/ESA).
* A specialized VM subsystem. Several non-CMS systems run within VM-CP virtual machines, providing services to CMS users such as spooling, interprocess communications, specialized device support, and networking. They operate behind the scenes, extending the services available to CMS without adding to the VM-CP control program. By running in separate virtual machines, they receive the same security and reliability protections as other VM users. Examples include:
** RSCS (Remote Spooling and Communication Subsystem, aka VNET) – communication and information transfer facilities between virtual machines and other systems
** RACF (Resource Access Control Facility) — a security system
** Shared File System (SFS), which organizes shared files in a directory tree (the servers are commonly named "VMSERVx")
** VTAM (Virtual Telecommunications Access Method) – a facility that provides support for a Systems Network Architecture network
** PVM (VM/Pass-Through Facility) – a facility that provides remote access to other VM systems
** TCPIP, SMTP, FTPSERVE, PORTMAP, VMNFS – a set of service machines that provide TCP/IP networking to VM/CMS
** Db2 Server for VM – a SQL database system, the servers are often named similarly to "SQLMACH" and "SQLMSTR"
** DIRMAINT – A simplified user directory management system (the directory is a listing of every account on the system, including virtual hardware configuration, user passwords, and minidisks).
** MUMPS/VM — an implementation of the MUMPS database and programming language which could run as guest on VM/370. MUMPS/VM was introduced in 1987 and discontinued in 1991.
* A user-written or modified operating system, such as National CSS's CSS or Boston University's VPS/VM.

## Versions

The following versions are known:

### Virtual Machine Facility/370

    VM/370, released in 1972, is a System/370 reimplementation of earlier CP/CMS operating system.

### VM/370 Basic System Extensions Program Product

    VM/BSE (BSEPP) is an enhancement to VM/370 that adds support for more devices (such as 3370-type fixed-block-architecture DASD drives), improvements to the CMS environment (such as an improved editor), and some stability enhancements to CP.

### VM/370 System Extensions Program Product

    VM/SE (SEPP) is an enhancement to VM/370 that includes the facilities of VM/BSE, as well as a few additional fixes and features.

### Virtual Machine/System Product

    VM/SP, a milestone version, replaces VM/370, VM/BSE and VM/SE. Release 1 added EXEC2 and XEDIT System Product Editor; Release 3 added REXX; Release 6 added the shared filesystem.

### Virtual Machine/System Product High Performance Option

    VM/SP HPO adds additional device support and functionality to VM/SP, and allows certain S/370 machines that can utilize more than 16 MB of real storage to do so, up to 64 MB. This version was intended for users that would be running multiple S/370 guests at once.

### Virtual Machine/Extended Architecture Migration Aid

    VM/XA MA is intended to ease the migration from MVS/370 to MVS/XA by allowing both to run concurrently on the same processor complex.

### Virtual Machine/Extended Architecture System Facility

    VM/XA SF is an upgraded VM/XA MA with improved functionality and performance.

### Virtual Machine/Extended Architecture System Product

    VM/XA SP is an upgraded VM/XA MA with improved functionality and performance, offered as a replacement for VM/SP HPO on machines supporting S/370-XA. It includes a version of CMS that can run in either S/370 or S/370-XA mode.

### Virtual Machine/Enterprise Systems Architecture

    VM/ESA provides the facilities of VM/SP, VM/SP HPO and VM/XA SP. VM/ESA version 1 can run in S/370, ESA/370 or ESA/390 mode; it does not support S/370 XA mode. Version 2 only runs in ESA/390 mode. The S/370-capable versions of VM/ESA were actually their own separate version from the ESA/390 versions of VM/ESA, as the S/370 versions are based on the older VM/SP HPO codebase, and the ESA/390 versions are based on the newer VM/XA codebase.

### z/VM

    z/VM, the last version still widely used as one of the main full virtualization solutions for the mainframe market. z/VM 4.4 was the last version that could run in ESA/390 mode; subsequent versions only run in z/Architecture mode.
The CMS in the name refers to the Conversational Monitor System, a component of the product that is a single-user operating system that runs in a virtual machine and provides conversational time-sharing in VM.

## Hypervisor interface

IBM coined the term hypervisor for the 360/65 and later used it for the DIAG handler of CP-67.
The Diagnose instruction ('83'x—no mnemonic) is a privileged instruction originally intended by IBM to perform "built-in diagnostic functions, or other model-dependent functions." IBM repurposed DIAG for "communication between a virtual machine and CP." The instruction contains two four-bit register numbers, called Rx and Ry, which can "contain operand storage addresses or return codes passed to the DIAGNOSE interface," and a two-byte code "that CP uses to determine what DIAGNOSE function to perform." The available diagnose functions include:
| Hexadecimal code | Function |
| 0000 | Store Extended-Identification Code |
| 0004 | Examine Real Storage |
| 0008 | Virtual Console Function—Execute a CP command |
| 0018 | Standard DASD I/O |
| 0020 | General I/O—Execute any valid CCW chain on a tape or disk device |
| 003C | Update the VM/370 directory |
| 0058 | 3270 Virtual Console Interface—perform full-screen I/O on an IBM 3270 terminal |
| 0060 | Determine Virtual Machine Storage Size |
| 0068 | Virtual Machine Communication Facility (VMCF) |
At one time, CMS was capable of running on a bare machine, as a true operating system (though such a configuration would be unusual). It now runs only as a guest OS under VM. This is because CMS relies on a hypervisor interface to VM-CP, to perform file system operations and request other VM services. This paravirtualization interface:
* Provides a fast path to VM-CP, to avoid the overhead of full simulation.
* Was first developed as a performance improvement for CP/CMS release 2.1, an important early milestone in CP's efficiency.
* Uses a non-virtualized, model-dependent machine instruction as a signal between CMS and CP: DIAG (diagnose).

## Minidisks

CMS and other operating systems often have DASD requirements much smaller than the sizes of actual volumes. For this reason CP allows an installation to define virtual disks of any size up to the capacity of the device. For CKD volumes, a minidisk must be defined in full cylinders. A minidisk has the same attributes as the underlying real disk, except that it is usually smaller and the beginning of each minidisk is mapped to cylinder or block 0. The minidisk may be accessed using the same channel programs as the real disk.
A minidisk that has been initialized with a CMS file system is referred to as a CMS minidisk, although CMS is not the only system that can use them.
It is common practice to define full volume minidisks for use by such guest operating systems as z/OS instead of using DEDICATE to assign the volume to a specific virtual machine. In addition, "full-pack links" are often defined for every DASD on the system, and are owned by the MAINT userid. These are used for backing up the system using the DASD Dump/Restore program, where the entire contents of a DASD are written to tape (or another DASD) exactly.

## Shared File System

With modern VM versions, most of the system can be installed to SFS, with the few remaining minidisks being the ones absolutely necessary for the system to start up, and the ones being owned by the filepool server machines.
VM/SP Release 6 introduced the Shared File System which vastly improved CMS file storage capabilities. The CMS minidisk file system does not support directories (folders) at all, however, the SFS does. SFS also introduces more granular security. With CMS minidisks, the system can be configured to allow or deny users read-only or read-write access to a disk, but single files cannot have the same security. SFS alleviates this, and vastly improves performance.
The SFS is provided by service virtual machines. On a modern VM system, there are usually three that are required: VMSERVR, the "recovery machine" that does not actually serve any files; VMSERVS, the server for the VMSYS filepool; and VMSERVU, the server for the VMSYSU (user) filepool. The file pool server machines own several minidisks, usually including a CMS A-disk (virtual device address 191, containing the file pool configuration files), a control disk, a log disk, and any number of data disks that actually store user files.
If a user account is configured to only use SFS (and does not own any minidisks), the user's A-disk will be FILEPOOL:USERID. and any subsequent directories that the user creates will be FILEPOOL:USERID.DIR1.DIR2.DIR3 where the equivalent UNIX file path is /dir1/dir2/dir3. SFS directories can have much more granular access controls when compared to minidisks (which, as mentioned above, can often only have a read password, a write password, and a multi-write password). SFS directories also solve the issues that may arise when two users write to the same CMS minidisk at the same time, which may cause disk corruption (as the CMS VM performing the writes may be unaware that another CMS instance is also writing to the minidisk).
The file pool server machines also serve a closely related filesystem: the Byte File System. BFS is used to store files on a UNIX-style filesystem. Its primary use is for the VM OpenExtensions POSIX environment for CMS. The CMS user virtual machines themselves communicate with the SFS server virtual machines through the IUCV mechanism.

## History

The early history of VM is described in the articles CP/CMS and History of CP/CMS. VM/370 is a reimplementation of CP/CMS, and was made available in 1972 as part of IBM's System/370 Advanced Function announcement (which added virtual memory hardware and operating systems to the System/370 series). Early releases of VM through VM/370 Release 6 continued in open source through 1981, and today are considered to be in the public domain. This policy ended in 1977 with the chargeable VM/SE and VM/BSE upgrades and in 1980 with VM/System Product (VM/SP). However, IBM continued providing updates in source form for existing code for many years, although the upgrades to all but the free base required a license. As with CP-67, privileged instructions in a virtual machine cause a program interrupt, and CP simulated the behavior of the privileged instruction. VM remained an important platform within IBM, used for operating system development and time-sharing use; but for customers it remained IBM's "other operating system". The OS and DOS families remained IBM's strategic products, and customers were not encouraged to run VM. Those that did formed close working relationships, continuing the community-support model of early CP/CMS users. In the meantime, the system struggled with political infighting within IBM over what resources should be available to the project, as compared with other IBM efforts. A basic problem with the system was seen at IBM's field sales level: VM/CMS demonstrably reduced the amount of hardware needed to support a given number of time-sharing users. IBM was, after all, in the business of selling computer systems.
Melinda Varian provides this fascinating quote, illustrating VM's unexpected success:
   The marketing forecasts for VM/370 predicted that no more than one 168 would ever run VM during the entire life of the product. In fact, the first 168 delivered to a customer ran only CP and CMS. Ten years later, ten percent of the large processors being shipped from Poughkeepsie would be destined to run VM, as would a very substantial portion of the mid-range machines that were built in Endicott. Before fifteen years had passed, there would be more VM licenses than MVS licenses.
A PC DOS version that runs CMS on the XT/370 (and later on the AT/370) is called VM/PC. VM/PC 1.1 was based on VM/SP release 3. When IBM introduced the P/370 and P/390 processor cards, a PC could now run full VM systems, including VM/370, VM/SP, VM/XA, and VM/ESA (these cards were fully compatible with S/370 and S/390 mainframes, and could run any S/370 operating system from the 31-bit era, e.g., MVS/ESA, VSE/ESA).
In addition to the base VM/SP releases, IBM also introduced VM/SP HPO (High Performance Option). This add-on (which is installed over the base VM/SP release) improved several key system facilities, including allowing the usage of more than 16 MB of storage (RAM) on supported models (such as the IBM 4381). With VM/SP HPO installed, the new limit was 64 MB; however, a single user (or virtual machine) could not use more than 16 MB. The functions of the spool filesystem were also improved, allowing 9900 spool files to be created per user, rather than 9900 for the whole system. The architecture of the spool filesystem was also enhanced, each spool file now had a unique user ID associated with it, and reader file control blocks were now held in virtual storage. The system could also be configured to deny certain users access to the vector facility (by means of user directory entries).
Releases of VM since VM/SP Release 1 supported multiprocessor systems. System/370 versions of VM (such as VM/SP and VM/SP HPO) supported a maximum of two processors, with the system operating in either UP (uniprocessor) mode, MP (multiprocessor) mode, or AP (attached processor) mode. AP mode is the same as MP mode, except the second processor lacks I/O capability. System/370-XA releases of VM (such as VM/XA) supported more. System/390 releases (such as VM/ESA) almost removed the limit entirely, and some modern z/VM systems can have as many as 80 processors. The per-VM limit for defined processors is 64.
When IBM introduced the System/370 Extended Architecture on the 3081, customers were faced with the need to run a production MVS/370 system while testing MVS/XA on the same machine. IBM's solution was VM/XA Migration Aid, which used the new Start Interpretive Execution (SIE) instruction to run the virtual machine. SIE automatically handled some privileged instructions and returned to CP for cases that it couldn't handle. The Processor Resource/System Manager (PR/SM) of the later 3090 also used SIE. There were several VM/XA products before it was eventually supplanted by VM/ESA and z/VM.
In addition to RSCS networking, IBM also provided users with VTAM networking. ACF/VTAM for VM was fully compatible with ACF/VTAM on MVS and VSE. Like RSCS, VTAM on VM ran under the specialized GCS operating system. However, VM also supported TCP/IP networking. In the late 1980s, IBM produced a TCP/IP stack for VM/SP and VM/XA. The stack supported IPv4 networks, and a variety of network interface systems (such as inter-mainframe channel-to-channel links, or a specialized IBM RT PC that would relay traffic out to a Token Ring or Ethernet network). The stack provided support for Telnet connections, from either simple line-mode terminal emulators or VT100-compatible emulators, or proper IBM 3270 terminal emulators. The stack also provided an FTP server. IBM also produced an optional NFS server for VM; early versions were rather primitive, but modern versions are much more advanced.
There was also a fourth networking option, known as VM/Pass-Through Facility (or more commonly called, PVM). PVM, like VTAM, allowed for connections to remote VM/CMS systems, as well as other IBM systems. If two VM/CMS nodes were linked together over a channel-to-channel link or bisync link (possibly using a dialup modem or leased line), a user could remotely connect to either system by entering "DIAL PVM" on the VM login screen, then entering the system node name (or choosing it from a list of available nodes). Alternatively, a user running CMS could use the PASSTHRU program that was installed alongside PVM, allowing for quick access to remote systems without having to log out of the user's session. PVM also supported accessing non-VM systems, by utilizing a 3x74 emulation technique. Later releases of PVM also featured a component that could accept connections from a SNA network.
VM was also the cornerstone operating system of BITNET, as the RSCS system available for VM provided a simple network that was easy to implement, and somewhat reliable. VM sites were interlinked by means of an RSCS VM on each VM system communicating with one another, and users could send and receive messages, files, and batch jobs through RSCS. The "NOTE" command used XEDIT to display a dialog to create an email, from which the user could send it. If the user specified an address in the form of user at node, the email file would be delivered to RSCS, which would then deliver it to the target user on the target system. If the site has TCP/IP installed, RSCS could work with the SMTP service machine to deliver notes (emails) to remote systems, as well as receive them. If the user specified user at some.host.name, the NOTE program would deliver the email to the SMTP service machine, which would then route it out to the destination site on the Internet.
VM's role changed within IBM when hardware evolution led to significant changes in processor architecture. Backward compatibility remained a cornerstone of the IBM mainframe family, which still uses the basic instruction set introduced with the original System/360; but the need for efficient use of the 64-bit zSeries made the VM approach much more attractive. VM was also utilized in data centers converting from DOS/VSE to MVS and is useful when running mainframe AIX and Linux, platforms that were to become increasingly important. The current z/VM platform has finally achieved the recognition within IBM that VM users long felt it deserved. Some z/VM sites run thousands of simultaneous virtual machine users on a single system. z/VM was first released in October 2000 and remains in active use and development.
IBM and third parties have offered many applications and tools that run under VM. Examples include RAMIS, FOCUS, SPSS, NOMAD, DB2, REXX, RACF, and OfficeVision. Current VM offerings run the gamut of mainframe applications, including HTTP servers, database managers, analysis tools, engineering packages, and financial systems.

## CP commands

As of release 6, the VM/370 Control Program has a number of commands for General Users, concerned with defining and controlling the user's virtual machine. Lower-case portions of the command are optional
| Command | Description |
| #CP | Allows the user to issue a CP command from a command environment, or any other virtual machine after pressing the break key (defaults to PA1) |
| ADSTOP | Sets an address stop to halt the virtual machine at a specific instruction |
| ATTN | Causes an attention interruption allowing CP to take control in a command environment |
| Begin | Continue or resume execution of the user's virtual machine, optionally at a specified address |
| CHange | Alter attributes of a spool file or files. For example, the output class or the name of the file can be changed, or printer-specific attributes set |
| Close | Closes an open printer, punch, reader, or console file and releases it to the spooling system |
| COUPLE | Connect a virtual channel-to-channel adapter (CTCA) to another. Also used to connect simulated QDIO Ethernet cards to a virtual switch. |
| CP | Execute a CP command in a CMS environment |
| DEFine | Alter the current virtual machine configuration. Add virtual devices or change available storage size |
| DETach | Remove a virtual device or channel from the current configuration |
| DIAL | Connect your terminal at the logon screen to a logged-on multi-access virtual machine's simulated 3270 or typewriter terminals |
| DISConn | Disconnect your terminal while allowing your virtual machine to continue running |
| Display | Display virtual machine storage or (virtual) hardware registers |
| DUMP | Print a snapshot dump of the current virtual machine on the virtual spooled printer |
| ECHO | Set the virtual machine to echo typed lines |
| EXTernal | Cause an external interrupt to the virtual machine |
| INDicate | Display current system load or your resource usage |
| Ipl | IPL (boot) an operating system on your virtual machine |
| LINK | Attach a device from another virtual machine, if that machine's definition allows sharing |
| LOADVFCB | Specify a forms control buffer (FCB) for a virtual printer |
| LOGoff LOGout | Terminate execution of the current virtual machine and disconnect from the system |
| Logon Login | Sign on to the system |
| Message MSG | Send a one-line message to the system operator or another user |
| NOTReady | Cause a virtual device to appear not ready |
| ORDer | Reorder closed spool files by ID or class |
| PURge | Delete closed spool files for a device by class,m ID, or ALL |
| Query | Display status information for your virtual machine, or the message of the day, or number or names of logged-in users |
| READY | Cause a device end interruption for a device |
| REQuest | Cause an interrupt on your virtual console |
| RESET | Clear all pending interrupts for a device |
| REWind | Rewind a real (non virtual) magnetic tape unit |
| SET | Set various attributes for your virtual machine, including messaging or terminal function keys |
| SLeep | Place your virtual machine in a dormant state indefinitely or for a specified period of time |
| SMsg | Send a one-line special message to another virtual machine (usually used to control the operation of the virtual machine; commonly used with RSCS) |
| SPool | Set options for a spooled virtual device (printer, reader, or punch) |
| STore | Alter the contents of registers or storage of your virtual machine |
| SYStem | Reset or restart your virtual machine or clear storage |
| TAg | Set a tag associated with a spooled device or file. The tag is usually used by VM's Remote Spooling Communications Subystem (RSCS) to identify the destination of a file |
| TERMinal | Set characteristics of your terminal |
| TRace | Start or stop tracing of specified virtual machine activities |
| TRANsfer | Transfer a spool file to or from another user |
| VMDUMP | Dump your virtual machine in a format readable by the Interactive Problem Control System (IPCS) program product |

## OpenEdition extensions

Starting with VM/ESA Version 2, IBM introduced the chargeable optional feature OpenEdition for VM/ESA Shell and Utilities Feature, which provides POSIX compatibility for CMS. The stand-out feature was a UNIX shell for CMS. The C compiler for this UNIX environment is provided by either C/370 or C for VM/ESA. Neither the CMS filesystem nor the standard VM Shared File System has any support for UNIX-style files and paths; instead, the Byte File System is used. Once a BFS extent is created in an SFS file pool, the user can mount it using the OPENVM MOUNT /../VMBFS:fileservername:filepoolname /path/to/mount/point. The user must also mount the root filesystem, done with OPENVM MOUNT /../VMBFS:VMSYS:ROOT/ /, a shell can then be started with OPENVM SHELL. Unlike the normal SFS, access to BFS filesystems is controlled by POSIX permissions (with chmod and chown).
Starting with z/VM Version 3, IBM integrated OpenEdition into z/VM and renamed it OpenExtensions. OpenEdition and OpenExtensions provide POSIX.2 compliance to CMS. Programs compiled to run under the OpenExtensions shell are stored in the same format as standard CMS executable modules. Visual editors, such as vi are unavailable, as 3270 terminals are not capable. Users can use ed or XEDIT instead of vi.

## Marketing

In the early 1980s, the VM group within SHARE (the IBM user group) sought a mascot or logo for the community to adopt. This was in part a response to IBM's MVS users selecting the turkey as a mascot (chosen, according to legend, by the MVS Performance Group in the early days of MVS, when its performance was a sore topic). In 1983, the teddy bear became VM's de facto mascot at SHARE 60, when teddy bear stickers were attached to the nametags of "cuddlier oldtimers" to flag them for newcomers as "friendly if approached". The bears were a hit and soon appeared widely. Bears were awarded to inductees of the "Order of the Knights of VM", individuals who made "useful contributions" to the community.