Status Word and Program States Guide in Operating Systems
Auto Beauty Business Culture Dieting DIY Events Fashion Finance Food Freelancing Gardening Health Hobbies Home Internet Jobs Law Local Media Men's Health Mobile Nutrition Parenting Pets Pregnancy Products Psychology Real Estate Relationships Science Seniors Sports Technology Travel Wellness Women's Health

Status Word and Program States Guide in Operating Systems

Status Word and Program States Guide in Operating Systems

Status Word

Operating control of the computer is reflected in a computer word termed the status word. The status word together with the machine registers reflect the current state of the CPU at any point in time. Changing the contents of the status word tantamount to changing the status of the computer since the CPU uses it to determine how instructions and conditions that arise should be processed. The status word contains the following kinds of information:

  1. The location in main storage of the instruction currently being executed.
  2. The storage protection key.
  3. Codes that determine which interruptions can occur and specify conditions that currently exist.
  4. State indicators that govern the operational state of the CPU.

The status word is used in four ways: (1) to hold information that tells what has happened in the CPU. (2) To hold information that denotes what is currently happening in the CPU. (3) To hold information that governs what operations can or cannot be performed by the CPU. (4) To hold information that denotes what can or cannot happen in the future. Thus, the status word is composed  of mask fields, state bits, codes, lengths, and addresses. The significance of the status word is amplified in subsequent paragraphs.

Program States

Modern computers are designed to accommodate several active users in main storage simultaneously- an operational technique known as multiprogramming. This technique requires that the operating system manage the resources of the computer system dynamically and that the users be protected from one another. It is not difficult to imagine the confusion and inefficiency that would result from several users attempting to perform their own IO, and utilize external storage as well, in a multiprogramming environment. For this reason, most modern computers limit the functions that can be performed by an applications program.

In general, two states of the CPU are defined: the supervisor state and the problem state. A program operating in the supervisor state has access to the facilities of the entire computer system. This is achieved through privileged and nonprivileged instructions. Privileged instructions are used to initiate IO, load the status word, manipulate storage keys, and perform other critical functions-those that cannot affect the program of another use. It follows that a program operating in the supervisor state can use both privileged and nonprivileged instructions.

The problem state is a state of the CPU that permits only nonprivileged instructions to be executed and is obviously intended for applications programs. Routines of the operating system that are involved with the overall management of the computer system normally operate in the supervisor state. When a program operating in the problem state requires the services of a routine that operates in the supervisor state, two functions must be performed:

  1. Program control must be passed to require routine.
  2. The state of the CPU must be changed in the supervisor state. 

When the supervisor/problem state is perhaps the most obvious state that the CPU can be in since it determines the kinds of instructions that can be executed by an operating program. Other states that affect the operation of the CPU are: (1) the Stopped/Operating state, (2) he Wait/Running state, and (3) the Masked/Interruptable state.

When the CPU is in the stopped state, instructions cannot be executed and interruptions cannot be taken. If the CPU is in the operating state, then it is either waiting or running. If it is in the running state, then instructions are being processed and interruptions can be taken. In the wait state, instructions are not executed but interruptions can be take place. Normally, the operating system will put the CPU into the wait state when it has no work to do. The CPU is subsequently taken out of the wait state by an interruption that denotes an external event, a condition, or a request that must be attended to by the operating system. 

When the CPU can be interrupted for a given event, that interruption is said to be enabled and a mask bit in the status word or an auxiliary control register is set. When the mask bit is not set, the interruption is said to be masked off or disabled and that particular interruption is not recognized. In general, a masked/interruptable state exists for each type of interruption. However, some interruptions are of prime importance and can never be masked off.

The CPU is put into a particular state by loading status word with appropriate bits set. In general, a new status word is loaded with a "load status word" instruction that can be issued by a program executing in the supervisor state or as the result of an interruption that causes a new status word to be loaded. 

Shopping online? Find the latest coupon codes for programming tools brands and score big discounts on your favorite brands. Shop through our partner network for the best discounts on popular programming tools stores with exclusive discounts, site-wide promo codes, and single-use codes.
Need an answer?
Get insightful answers from community-recommended
in Computer Programming & Languages on Knoji.
Would you recommend this author as an expert in Computer Programming & Languages?
You have 0 recommendations remaining to grant today.
Comments (0)