Time-sharing is a very popular technique for computer systems that support numerous terminals. The operating system cycles through all the active programs in the system that need processing and gives each one a small time slice on each cycle.
For example, say there are 20 programs in the system and each program is to be allocated a time slice of 1 second (the time slice usually is much smaller than this, and all slices aren’t necessarily equal).
The computer will work on program 1 for another second, then on program 2 for another one second, and so forth. When it finishes working on program 20 for one second, it will go back to program 1 for another second, program 2 for another second, and so on.
ADVERTISEMENTS:
Thus, if there are an average of 20 programs on the system, each program will get a total of 3 seconds of processing during each minute of actual clock time, or 1 second in every 20 second period.
As you can see, in a time-sharing system it is difficult for a single program to dominate the CPU’s attention, thereby holding up the processing of shorter programs.
Both time-sharing and multiprogramming are techniques for working on many programs concurrently by allotting short uninterrupted time periods to each. They differ, however, in the way they allot time.
ADVERTISEMENTS:
In time-sharing, the computer spends a fixed amount of time on each program and then goes on to another. In multiprogramming, the computer works on a program until it encounters a logical stopping point, such as when more data must be read in, before going on to another.
Many computers today combine time-sharing and multiprogramming techniques to expedite processing.