Time Sharing Operating System

Learn via video courses
Topics Covered

Overview

The Time-Sharing Operating System is a type of operating system in which the user can perform more than one task and each task gets the same amount of time to execute. It is also called a multitasking operating system.

What is a Time Sharing Operating System?

Before knowing the Time-sharing operating system, we should understand what an operating system is. An operating system is a program used to interact between the system hardware and the user. The operating system acts as an interface between the software and the hardware.

What is a time-sharing Operating System

In a time-sharing operating system, each task uses the CPU in such a way that the response time of the CPU is minimized. Each task takes the same amount of time to execute.

The time-sharing operating system is different from a multiprogramming operating system. In a multiprogramming operating system, the main objective is to maximize the use of the CPU. But in Time-sharing OS, the main aim is to minimize the response time of the CPU.

Working of Time-Sharing Operating System

The Time-Sharing Operating System uses CPU scheduling and multiprogramming.

Let's see how CPU scheduling and multiprogramming are used in the Timesharing Operating System.

  • When the user performs more than one task, each process's CPU time is divided.
  • There is a time quantum fixed for each process to execute at a time. This time quantum is minimal and in 10-100 milliseconds. Time quantum is also known as time slot or time slice.
  • For example, if there are three processes, P1, P2, and P3, running on the system. Suppose the time Quantum is fixed to 4 nanoseconds (ns). Let's see further how these processes will be executed.
  • Process P1 will execute first for 4ns and as soon as it gets over, process P2 starts executing for 4ns, and when P2 is executed for 4ns then process P3 executes for 4ns. This process continues till all the processes are completed.
  • In this way, if the process runs for only the fixed time quantum, the switching between the processes is very fast. So, the user thinks that all the processes are running simultaneously. In this way, response time of the CPU is minimized.

Working of Time-sharing operating system

The above diagram shows the working of the time-sharing operating system.

The process 4 in the diagram is shown in active state. Process 5 is in ready state while process 1,2,3 and 6 are in waiting state.

Let's understand what these active state, ready state, and waiting for state means.

  1. Active state - The process currently using the CPU is said to be in an active state. Only one process can be inactive state as the CPU can be assigned to only one process at a time for processing.
  2. Ready state - The process that is ready for execution and is waiting for the CPU to get assigned to it is said to be in a Ready state. More than one process can be in a Ready state at a time, but the CPU is allocated to only one of them at a time for processing.
  3. Waiting State - The processes that are not ready for execution and are waiting for some input/output process to be completed are said to be in a waiting state. Once the input/output process is completed, the process jumps to a Ready state and is ready for execution.

switching from one state to another

As shown in the diagram above, the process can switch from one state to another. Once the process executes its one-time quantum, it goes to the Ready state and is ready for execution again. If the process gets some input/output operation while in the active state, it goes to the waiting state and waits there until the input/output is completed and then goes to the ready state again as soon as the input/output operation is completed.

Challenges for Time-sharing Operating System

The main challenges that Time-sharing OS has are:-

  • Time-sharing operating system consumes many resources. There is a very fast switching between the processes. It needs a queue to keep the process in order for further execution after a certain time period.
  • Time-sharing operating system also requires high specification hardware as the very fast switching between the process for CPU execution is required.
  • As there is very fast switching between the processes, there is a risk of data mixing between the processes of different programs.

Example of Time-Sharing Operating System

For example, In a transaction processing system, all types of processors can execute every user program in a small burst or quantum of computation. Like, when n users exist, then every user is capable of grabbing a time quantum.

Some examples of Time-sharing operating systems are:

  • UNIX
  • Multics
  • Linux
  • Windows 2000 server
  • Windows NT server
  • TOPS-10 (DEC)
  • TOPS-20 (DEC)

Advantages and Disadvantages of Time-Sharing Operating System

Advantages

  • Time-sharing operating system works in such a way that it minimizes the response time of the CPU.
  • Each process gets an equal opportunity as the processes get equal time quantum for execution at a time by the CPU.
  • CPU idle time is also reduced as the CPU is continuously switching between the process for the process, so the idle time is minimized in the Time-sharing operating system.

Disadvantages

  • There are chances of data mixing due to fast switching between the processes.
  • Time-sharing OS faces reliability issues.
  • Data communication is a problem in Time-Sharing Operating Systems as communication is an essential factor for the processes to get the CPU processing time.

Elevate your understanding of operating systems with our free course. Enroll now and get a comprehensive overview of their structure and importance.

Conclusion

  • In a Time-Sharing Operating System, each process gets equal opportunity, i.e. equal time quantum for execution.
  • It tries to minimize the response time of the CPU.
  • It uses CPU scheduling and multiprogramming to work.
  • Processes can be in an Active state, ready state, or waiting state.
  • Time-Sharing Operating System requires high-specification hardware and uses lots of resources.
  • CPU idle time is reduced.
  • Reliability, Data mixing, and communication are some problems faced in Time-sharing operating systems.
  • UNIX and LINUX are examples of Time-sharing operating systems.